Math & ScienceDrawing mathematical Figures

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
nenu28
Posts: 28
Joined: Mon Jun 27, 2011 11:24 am

Drawing mathematical Figures

Post by nenu28 »

Hello,

I would like to draw three mathematical figures as shown in the attached file. I have tried to use the xypic package but could not get them. How can I get them?


Thanks
Attachments
CalculDiff.pdf
(64.99 KiB) Downloaded 810 times

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Drawing mathematical Figures

Post by Stefan Kottwitz »

Hi,

you could use TikZ or PSTricks. For an inspiration, have a look at
Stefan
LaTeX.org admin
frederic
Posts: 9
Joined: Mon Jun 27, 2011 7:25 pm

Drawing mathematical Figures

Post by frederic »

Using Tikz, one possible version is as follows.

Code: Select all

\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\draw[->] (-2,0) -- (2,0) node[right] {$x$};
\draw[->] (0,-2) -- (0,2) node[left] {$y$};

\draw (-2,-2) -- (2,2);
\draw (-2,2) -- (2,-2);

\draw[domain=-1.3:1.3,variable=\t] 
      plot ({cosh(\t)},{sinh(\t)})
      plot ({-cosh(\t)},{sinh(\t)})
      plot ({sinh(\t)},{cosh(\t)})
      plot ({sinh(\t)},{-cosh(\t)});

\foreach \t in {-0.9,0,0.9}{
  \pgfmathsetmacro{\px}{cosh(\t)}
  \pgfmathsetmacro{\py}{sinh(\t)}
  \draw[thick,->,red] (\px,\py) -- ++($0.3*(\py,\px)$);
  \draw[thick,->,red] (-\px,\py) -- ++($0.3*(\py,-\px)$);
  \draw[thick,->,red] (\py,\px) -- ++($0.3*(\px,\py)$);
  \draw[thick,->,red] (\py,-\px) -- ++($0.3*(-\px,\py)$);
}

\foreach \t in {0.3,1,1.6}{
  \draw[thick,->,red] (\t,\t) -- ++(0.4,0.4);
  \draw[thick,->,red] (-\t,-\t) -- ++(-0.4,-0.4);
  \draw[thick,->,red] (\t,-\t) -- ++(0.4,-0.4);
  \draw[thick,->,red] (-\t,\t) -- ++(-0.4,0.4);
}

\end{tikzpicture}

\begin{tikzpicture}
\draw[->] (-2.5,0) -- (2.5,0) node[right] {$x$};
\draw[->] (0,-2.5) -- (0,2.5) node[left] {$y$};

\draw (0,0) circle[radius=1];
\draw (0,0) circle[radius=2];

\foreach \angle in {0,90,180,270}{
  \draw[rotate=\angle,->] (1,0) -- ++(0,1.2);
  \draw[rotate=\angle,->] (2,0) -- ++(0,1.5);
}

\node[above left] at (0,0) {$0$};
\node[left] at (-2,2) {$X(x)$}; 

\end{tikzpicture}

\begin{tikzpicture}
\foreach \angle in {0,45,...,350}{
  \draw[shorten <=10pt,->] (0,0) -- (\angle:2);}
\node at (0,0) {$0$};
\node[right] at (45:2) {$X(x)$};
\end{tikzpicture}

\end{document}
I hope this helps
nenu
Posts: 5
Joined: Sun Sep 12, 2010 7:30 pm

Re: Drawing mathematical Figures

Post by nenu »

Hi and thanks for your advises.
For the code you submitted, it does not work. There is an error message during the execution. Could you tell me how do you execute it ?

Once again thanks.
frederic
Posts: 9
Joined: Mon Jun 27, 2011 7:25 pm

Drawing mathematical Figures

Post by frederic »

I tried it again and it compiles fine. It is probably the version of the pgf/tikz engine. I'm using version 2.1.

You should include the error message in your post.

To see what version you have installed, try the following:

Code: Select all

\documentclass{minimal}

\usepackage{tikz}

\begin{document}

\pgfversion

\end{document}
If you have an earlier version, you should upgrade.

The result is
texshop_image.png
texshop_image.png (35.77 KiB) Viewed 11547 times
nenu
Posts: 5
Joined: Sun Sep 12, 2010 7:30 pm

Re: Drawing mathematical Figures

Post by nenu »

You right, it is the version of the pgf. Mine is 2.00. How can I update it or install the latest version, the one you are using ?
The error message during the execution is "!Package PGF Math error: Unknown function 'cosh'".

Thanks
frederic
Posts: 9
Joined: Mon Jun 27, 2011 7:25 pm

Re: Drawing mathematical Figures

Post by frederic »

How to get the latest version depends on your system.

If you are using MikTeX, it comes with a package updater. I can't say more because I don't use it.

If you are using TeXLive, there is also an updater. On Linux it is a command line utility (someone else can tell you what the command is, I don't know it). On the Mac, there is a graphical interface called TeXlive Utility. Unfortunately, for the moment, the repository is frozen until the 2011 version is ready.

You may find it on CTAN and manually install it (or at least place it in the folder you are working in)
nenu
Posts: 5
Joined: Sun Sep 12, 2010 7:30 pm

Re: Drawing mathematical Figures

Post by nenu »

Thanks Frederic,
My system is MikTex, I have downloaded the latest one (MikTek 2.9) which came with pgf 2.1. I tried the code, it works or compiles fine. Thank you so much.
ilonpilaaja
Posts: 1
Joined: Tue Aug 09, 2011 10:06 am

Re: Drawing mathematical Figures

Post by ilonpilaaja »

Hi all,

this is my first post in the community.
Talking of pstricks, is it capable of producing
nice-looking graphs as in the attached document?
Put another way, what kind of tools the authors
of this document used in order to produce their
graphs?
Attachments
From site http://igm.univ-mlv.fr/~lecroq/string/index.html
From site http://igm.univ-mlv.fr/~lecroq/string/index.html
snapshot1.png (49.99 KiB) Viewed 11418 times
Post Reply