Message Boards Message Boards

0
|
3287 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Syntax error while pasting a code

Exercise 5—Increasing and Decreasing Function (https://www.wolfram.com/wolfram-u/introduction-to-calculus/functions.html) include this code:

enter image description here

Not sure how to write it correctly. I copied and pasted on a notebook, but showing syntax error. enter image description here

POSTED BY: Rajeev Bagra
5 Replies

I clicked on it in the course page, then I pasted it in my notebook and it was copied correctly. I use V12.3.1 , but I believe it should work fine on several older versions too

POSTED BY: Ahmed Elbanna

This is the code that is generated.Since not sure why so, I decided to use the image option.enter image description here

Plot[\!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
RowBox[{
RowBox[{"-", "2"}], " ", 
SuperscriptBox["x", "2"]}], "+", 
FractionBox[
RowBox[{"5", " ", 
SuperscriptBox["x", "4"]}], "4"], "-", 
FractionBox[
SuperscriptBox["x", "6"], "6"]}], 
RowBox[{
RowBox[{"-", "2.5`"}], "<=", "x", "<=", "2"}]},
{
RowBox[{"-", "4.361979166666664`"}], 
RowBox[{"x", "<", 
RowBox[{"-", "2.5`"}]}]},
{
FractionBox["4", "3"], 
TagBox["True",
"PiecewiseDefault",
AutoDelete->True]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}, "Items" -> {}, 
          "ItemsIndexed" -> {}},
GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{1.}}, "RowsIndexed" -> {}, "Items" -> {}, 
          "ItemsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}, "Items" -> {}, 
          "ItemsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{
      "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
       "Rows" -> {{Baseline}}, "RowsIndexed" -> {}, "Items" -> {}, 
       "ItemsIndexed" -> {}},
GridBoxItemSize->{
      "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
       "Rows" -> {{1.}}, "RowsIndexed" -> {}, "Items" -> {}, 
       "ItemsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}, "Items" -> {}, 
       "ItemsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False]\) , {x, -4, 4}]
POSTED BY: Rajeev Bagra

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

The rules explain how to format your code properly. Posting code Images doesn't help other members to copy your code. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

You can also embed notebook or attach notebook.

enter image description here

POSTED BY: Moderation Team
Posted 2 years ago

Hi Rajeev,

Not sure how you are copying and pasting. It worked fine for me

Plot[Piecewise[{{-2*x^2 + (5*x^4)/4 - x^6/6, -2.5 <= x <= 2}, {-4.361979167, x < -2.5}}, 4/3], {x, -4, 4}]

enter image description here

POSTED BY: Rohit Namjoshi

Not able to access the above code from the source https://www.wolfram.com/wolfram-u/introduction-to-calculus/functions.html that shows something different.

enter image description here

POSTED BY: Rajeev Bagra
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract