I have


g[x_]=TraditionalForm[Series[f[x], {x, 0, 4}]]

Is there a way to get the answer to print out as

Ln(1+x) = x-x^2/2+x^3/3-x^4/4+O(x^5)

I've tried to use StringJoin but this doesn't seem to work

Thanks for the help in advance

  • $\begingroup$ why doesn't Ln[1 + x] == Series[f[x], {x, 0, 4}] // TraditionalForm work for you? $\endgroup$
    – user42582
    Aug 30, 2017 at 11:08
  • $\begingroup$ Because when I go change f[x] then it doesn't automatically update the left hand side of the answer $\endgroup$ Aug 30, 2017 at 11:20
  • $\begingroup$ f[x] == Series[f[x], {x, 0, 4}] // TraditionalForm ? $\endgroup$
    – user42582
    Aug 30, 2017 at 11:21
  • $\begingroup$ How do I get the mathematica formatting on the question. I hope what I've typed in the question isn't misleading, I do want the answer to appear in traditional form, it's just that when I copied and pasted from mathematica it came out this way $\endgroup$ Aug 30, 2017 at 11:23
  • $\begingroup$ @user42582 Oh man, that works :P Thanks very much $\endgroup$ Aug 30, 2017 at 11:26

2 Answers 2


It seems that

f[x] == Series[f[x], {x, 0, 4}] // TraditionalForm

does the trick.

On a more general note, one could also use:

pretty[f_, x_, n_] := Module[{},
 f[x] == Series[f[x], {x, 0, n}] // TraditionalForm

like so:


to get the desired output.

Note, that there is no concatenation needed. Furthermore, Mathematica does not need to splice together functions and strings (even though it could have done, easily). See TraditionalForm from Wolfram Language reference guide.

  • $\begingroup$ Thank you very much for this. How do you get the mathematica like formatting $\endgroup$ Aug 30, 2017 at 12:03
  • $\begingroup$ you're welcome; please give an example of what you mean by "mathematica-like formating"; would mathematica.stackexchange.com/editing-help help out? $\endgroup$
    – user42582
    Aug 30, 2017 at 12:50
  • $\begingroup$ That definitely helps. What I meant was formatting the text so it looks like mathematica code rather than plain text. Thanks. $\endgroup$ Aug 30, 2017 at 13:11

Try this

StringJoin[{ToString[f[x]], " = ", ToString[g[x]]}]

$Log[1+x] = x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+O\left(x^5\right)$


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.