3
$\begingroup$

Can someone please explain to me the logic of this:

In one cell, when writing

eq = D[y[x], x] + a*y[x] - b*Sin[c*x];
sol = DSolve[eq == 0, y[x], x];
TeXForm[sol]
OutputForm[TeXForm[sol]]

I see only the result of OutputForm:

Mathematica graphics

But in separate cells, then I see both outputs

Mathematica graphics

ps. I was trying to find how to remove the "\" at the end of the OutputForm compared to TeXForm output, and that is why I am doing the above, to compare the outputs.

This happens on both V9 and 10. Should not both output show up, even if in the same cell?

$\endgroup$
3
$\begingroup$

It seems like OutputForm always is the first output one gets and all previous Out[..] are removed if they are equal. Here equal means that Out[1]==Out[2], and not necessarily that Out[1]/TeXForm==Out[2]/OutputForm.

You can change the order to:

eq = D[y[x], x] + a*y[x] - b*Sin[c*x];
sol = DSolve[eq == 0, y[x], x];
OutputForm[TeXForm[sol]]
TeXForm[sol]

\left{\left{y(x)\to \frac{b (a \sin (c x)-c \cos (c x))}{a^2+c^2}+c_1 e^{-a x}\right}\right}

\left{\left{y(x)\to \frac{b (a \sin (c x)-c \cos (c x))}{a^2+c^2}+c_1 e^{-a x}\right}\right}

Your "\" at the end of the OutputForm is just a linebreak. It will be removed, if you make Mma window wider.

$\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.