Math & ScienceRecursive formula with \ddots and last term

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
ANTMW1361
Posts: 3
Joined: Thu Aug 16, 2012 6:50 am

Recursive formula with \ddots and last term

Post by ANTMW1361 »

Hi everybody
I am relatively new. I am trying to write a Recursive formula in latex. I know this popular example of recursive equation:

Code: Select all

\cfrac{1}{\sqrt{2}+
\cfrac{1}{\sqrt{2}+
\cfrac{1}{\sqrt{2}+\dotsb
}}}
What I wanna do is to add \ddots and write the last fraction, so, I need to vertically align equation. I don't know how to do this. I searched a lot and looked everywhere but found nothing. I believe there should be a way for this in Latex. Please help me.
Any idea or help is appreciated in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: Recursive formula with \ddots and last term

Post by cgnieder »

Hi ANTMW1361,

Welcome to our community!

Could you try to show us what you want the output to look like?

Regards
site moderator & package author
ANTMW1361
Posts: 3
Joined: Thu Aug 16, 2012 6:50 am

Recursive formula with \ddots and last term

Post by ANTMW1361 »

Hi Clemens

Thanks for your kind reply.
I want to write this formula in LaTeX:
Image

Regards,
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Recursive formula with \ddots and last term

Post by cgnieder »

Here is an idea:

Code: Select all

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\[
Z_n = \frac{n}{j_p} +
      \cfrac{1}{\frac{2n-1}{j_p} +
        \cfrac{1}{
        \begin{array}{ccc}
          \frac{2n-3}{j_p} & & \\
          & \ddots & \\
          & & \cfrac{1}{\frac{3}{j_p} +
            \cfrac{1}{\frac{1}{j_p} + 1}}
        \end{array}
      }}
\]

\end{document}
Regards
site moderator & package author
ANTMW1361
Posts: 3
Joined: Thu Aug 16, 2012 6:50 am

Re: Recursive formula with \ddots and last term

Post by ANTMW1361 »

Hi Clemens
You completely solved my problem. I appreciate your help.
Kind Regards,
Post Reply