Message Boards Message Boards


Displaying Continued Fractions and Nested Surds "properly"

Posted 9 years ago
4 Replies
1 Total Likes

Hi. I'm new to Mathematica, so apologies for the newbie question.

How do I get Mathematica to display continued fractions or nested surds the way you normally would see them?

Nest[1 + 1/# &, "...", 7]

Nest[1 + Sqrt[#] &, "...", 10]

Both end up showing the "+1"s on the "wrong" side of the result. That is, normally when you see these sorts of equations, they start with "1 + " and then have the rest of the nested formula.

I'm teaching a class on the Fibonacci Sequence and Golden Ratio, and would like them to display the way students will most often see them.

POSTED BY: David Schilling
4 Replies

Thanks. That's what the problem is. I like the look of TraditionalForm more for many things, which is why I set it to be the default. Perhaps this should be considered a bug in TraditionalForm? Traditionally no one would write them the backwards way, after all!

POSTED BY: David Schilling

My cells are in Standard Form. If I change them to TraditionalForm then they have the opposite behavior that you are noticing. That also explains the TeXForm result--presumably, and sensibly, the TEeXForm of an expression is based on the TraditionalForm version.

I only very rarely use TraditionalForm as a formatting choice for Mathematica expressions....

POSTED BY: David Reiss

Odd. I wonder if it might be version dependant? I have Mathematica Here's what I see with output cells set to TraditionalForm in my preferences. Also TeXForm is just like yours.

Mathematica 10 display of nested functions

If I type

Nest[1 + Sqrt[#] &, "...", 10] // TreeForm

and hover over the topmost node, interestingly the tooltip shows it the way you would expect.

Mathematica 10 tooltip display of //TreeForm

Any suggestions how to get it to behave the way I'd like? Thanks!

POSTED BY: David Schilling

These seem to format the way you are wishing. Here is a screenshot of the notebook:

enter image description here

I do note however that the TexForm of, say,

Nest[1 + 1/# &, "...", 7] // TeXForm

gives this


which formats (at least in this forum's TeX typsetting) as

$\frac{1}{\frac{1}{\frac{1}{\frac{1}{\frac{1}{\frac{1}{\frac{1}{\text{...}}+1}+1}+1}+1}+1} +1}+1$

Is this the issue that you are referring to? The Mathematica native typesetting seems to be fine. The TeX seems to be the opposite of what's desired.

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract