1
$\begingroup$

I'm a little mystified as to the behaviour of Plot. In one case below I am directly executing on a list element. In the other I am (I think) doing exactly the same thing.

screenshot

{\!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"-", 
RowBox[{"0.8428052992418218`", " ", 
SuperscriptBox["x", "7"]}]}], "+", 
RowBox[{"2.9498185473463763`", " ", 
SuperscriptBox["x", "6"]}], "-", 
RowBox[{"10.376841190414979`", " ", 
SuperscriptBox["x", "5"]}], "+", 
RowBox[{"18.567556607671506`", " ", 
SuperscriptBox["x", "4"]}], "-", 
RowBox[{"19.835589895411935`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"12.785737509119585`", " ", 
SuperscriptBox["x", "2"]}], "-", 
RowBox[{"5.056824588888251`", " ", "x"}], "+", "1.`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\), \!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"-", 
RowBox[{"0.17818628606314801`", " ", 
SuperscriptBox["x", "7"]}]}], "+", 
RowBox[{"0.623652001221018`", " ", 
SuperscriptBox["x", "6"]}], "-", 
RowBox[{"0.766226907641884`", " ", 
SuperscriptBox["x", "5"]}], "+", 
RowBox[{"0.35643726605216447`", " ", 
SuperscriptBox["x", "4"]}], "-", 
RowBox[{"1.833259838113068`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"2.8302784917279467`", " ", 
SuperscriptBox["x", "2"]}], "-", 
RowBox[{"2.379191319891826`", " ", "x"}], "+", "1.`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\), \!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"-", 
RowBox[{"0.000018895233526195646`", " ", 
SuperscriptBox["x", "7"]}]}], "+", 
RowBox[{"0.00006613331734168476`", " ", 
SuperscriptBox["x", "6"]}], "+", 
RowBox[{"7.050073190254268`*^-6", " ", 
SuperscriptBox["x", "5"]}], "-", 
RowBox[{"0.00018295847632984757`", " ", 
SuperscriptBox["x", "4"]}], "-", 
RowBox[{"0.02188974160496609`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"0.15805063754244977`", " ", 
SuperscriptBox["x", "2"]}], "-", 
RowBox[{"0.5622288462589179`", " ", "x"}], "+", "1.`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\), \!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"0.00008075374690358442`", " ", 
SuperscriptBox["x", "7"]}], "-", 
RowBox[{"0.0002826381141625455`", " ", 
SuperscriptBox["x", "6"]}], "+", 
RowBox[{"0.006395977611793048`", " ", 
SuperscriptBox["x", "5"]}], "-", 
RowBox[{"0.015283348744076256`", " ", 
SuperscriptBox["x", "4"]}], "+", 
RowBox[{"0.019300390555482223`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"0.11119144385377162`", " ", 
SuperscriptBox["x", "2"]}], "-", 
RowBox[{"0.4715749018628204`", " ", "x"}], "+", 
      "0.9999999999999999`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\), \!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"2.7481113699184277`*^-6", " ", 
SuperscriptBox["x", "7"]}], "-", 
RowBox[{"9.618389794714496`*^-6", " ", 
SuperscriptBox["x", "6"]}], "-", 
RowBox[{"0.00016708892041431852`", " ", 
SuperscriptBox["x", "5"]}], "+", 
RowBox[{"0.00044176827552258255`", " ", 
SuperscriptBox["x", "4"]}], "+", 
RowBox[{"0.01300177132742992`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"0.10505076553843518`", " ", 
SuperscriptBox["x", "2"]}], "+", 
RowBox[{"0.45836833608337313`", " ", "x"}], "+", "1.`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\), \!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"0.00006827623743710186`", " ", 
SuperscriptBox["x", "7"]}], "-", 
RowBox[{"0.00023896683102985652`", " ", 
SuperscriptBox["x", "6"]}], "-", 
RowBox[{"0.0017602742919764405`", " ", 
SuperscriptBox["x", "5"]}], "+", 
RowBox[{"0.004998102807515743`", " ", 
SuperscriptBox["x", "4"]}], "+", 
RowBox[{"0.021156532004700534`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"0.08814761576991853`", " ", 
SuperscriptBox["x", "2"]}], "+", 
RowBox[{"0.41987525779948176`", " ", "x"}], "+", "1.`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\), \!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"-", 
RowBox[{"0.023487877236053424`", " ", 
SuperscriptBox["x", "7"]}]}], "+", 
RowBox[{"0.08220757032618699`", " ", 
SuperscriptBox["x", "6"]}], "-", 
RowBox[{"0.4204788526870417`", " ", 
SuperscriptBox["x", "5"]}], "+", 
RowBox[{"0.8456782059021367`", " ", 
SuperscriptBox["x", "4"]}], "-", 
RowBox[{"0.9216087821424758`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"0.7028387524746703`", " ", 
SuperscriptBox["x", "2"]}], "-", 
RowBox[{"1.1856144547716247`", " ", "x"}], "+", "1.`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\), \!\(\*
TagBox[
FormBox[
RowBox[{
RowBox[{"-", 
RowBox[{"0.00025723275547461085`", " ", 
SuperscriptBox["x", "7"]}]}], "+", 
RowBox[{"0.000900314644161138`", " ", 
SuperscriptBox["x", "6"]}], "-", 
RowBox[{"0.00004607105199456746`", " ", 
SuperscriptBox["x", "5"]}], "-", 
RowBox[{"0.002135608980416426`", " ", 
SuperscriptBox["x", "4"]}], "+", 
RowBox[{"0.08484600384284115`", " ", 
SuperscriptBox["x", "3"]}], "+", 
RowBox[{"0.0003167605382352677`", " ", 
SuperscriptBox["x", "2"]}], "-", 
RowBox[{"0.025169829012923813`", " ", "x"}], "+", "1.`"}],
TraditionalForm],
TraditionalForm,
Editable->True]\)}

Plot[ -0.842805 x^7 + 2.94982 x^6 - 10.3768 x^5 + 18.5676 x^4 - 
  19.8356 x^3 + 12.7857 x^2 - 5.05682 x + 1. , {x, -2, 2}]
Plot[ gsols[[1]], {x, -2, 2} ]
$\endgroup$
3
  • 1
    $\begingroup$ Sorry, I didn't read carefully. It appears that you have TraditionalForm wrapped around every single expression in that list. If you get rid of TraditionalForm, it should work. Appears to be the same situation as here: mathematica.stackexchange.com/questions/3098/… $\endgroup$
    – Szabolcs
    Commented Dec 7, 2014 at 18:53
  • $\begingroup$ It does work, but now for every x first the complete list gsols is evaluated and of that only the first element element is used for the plotting. For efficiency, I would prefer Plot[gsols[[1]]//Evaluate, {x, -2, 2}] $\endgroup$ Commented Dec 7, 2014 at 19:37
  • $\begingroup$ Is there a simple way to remove all the TraditionalForm wrapping? I don't honestly know how my equations got contaminated with that in the first place. $\endgroup$
    – Quant
    Commented Dec 8, 2014 at 0:53

1 Answer 1

0
$\begingroup$

Your Input gsols=Table[...] may be labeled with TraditionalForm (or any other cell). If you now set the cell back to StandardForm the output should be accordingly. Not sure about the removing of the TraditionalForm wrapping at output... otherwise start your calcs in a fresh notebook an avoid TraditionalForm.

enter image description here

$\endgroup$
1
  • $\begingroup$ Well, I could help, thanks for the acceptance! $\endgroup$
    – user9660
    Commented Dec 9, 2014 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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