3
$\begingroup$

How do you make a control label display notation in tradition form? I would like the label to display the function "f(x)= (1/2)x+1" but in traditional form. How could I modify this code so it works? I realize I am using a string, so I would need to change that but don't know what to do.

Manipulate[Plot[If[f, .5 x + 1], {x, -3, 6},
  PlotRange -> {{-1, 6}, {-1, 5}},
  Ticks -> {Range[-3, 6], Range[-1, 5]},
  GridLines -> Automatic, GridLinesStyle -> Opacity[.03], 
  AxesStyle -> Arrowheads[.03]],

 {{f, False, "f(x)=(1/2)x+1"}, {True, False}}]
$\endgroup$
3
$\begingroup$
Manipulate[
 Plot[If[f, .5 x + 1], {x, -3, 6},
  PlotRange -> {{-1, 6}, {-1, 5}},
  Ticks -> {Range[-3, 6], Range[-1, 5]},
  GridLines -> Automatic,
  GridLinesStyle -> Opacity[.03],
  AxesStyle -> Arrowheads[.03]],
 {{f, False, TraditionalForm[Style["f", Italic][x] == (1/2) x + 1]}, {True, False}}]

enter image description here

$\endgroup$
3
$\begingroup$

I fiddled a little and this works too. I went into the Option Inspector and changed the "InputInline" Cell option to Traditional Form. The code below works so long as I use an Inlinecell inside the quotation marks. One of the positives of doing it this way is that Mathematica doesn't simplify the (1/2)x to x/2.

Manipulate[
 Plot[If[f, .5 x + 1], {x, -3, 6}, PlotRange -> {{-1, 6}, {-1, 5}}, 
  Ticks -> {Range[-3, 6], Range[-1, 5]}, GridLines -> Automatic, 
  GridLinesStyle -> Opacity[.03], 
  AxesStyle -> Arrowheads[.03]], {{f, False, "f(x) = 1/2x+1"}, {True, False}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.