[pstricks] pstricks and metapost 2d 3d

Sebastiano Spatola sebastianospatola at virgilio.it
Sun Aug 7 16:34:02 CEST 2005


Dear Group Pstricks,
my name is Sebastiano Spatola and I am a doctor in Mathematica and physics for students of high school. I worked 
I use from more of a Latex year and I have discovered from little days the metapost of 2D and 3D. However to create a figure with labels, headings I 
I must insert any codes in a source .tex 
\listfiles
\documentclass[a4paper]{article}%  Herbert Voss 2004-10-06
\usepackage{pstricks}
\usepackage{pstricks-add}
\usepackage{multido}
\def\func{%
    const0 x sin dup mul 3 mul div neg /p exch def
    p abs sqrt neg /r exch def
    const1 2.0 div neg /q exch def
    p 0 lt {
      p dup mul p mul q dup mul add 0 le {
        q r 3 exp div arccos 
        3 div cos r dup add neg mul
      }{
        q r 3 exp div arch
        3 div cosh r dup add neg mul
      } ifelse
    }{
      q r 3 exp div arsh
      3 div sinh r dup add neg mul      
    } ifelse
}
\begin{document}
\textbf{Dynamical flow around a cylinder}
\[
\left(r^2-\frac{c_1}{r}\right)\sin^2\theta=c_0
\]

which is the same as

\[
r^3-\frac{c_0}{\sin^2\theta}\cdot r-c_1=0
\]

which can be solved by the formula of Cardano:

\[
r^3+3pr+2q=0
\]

\bigskip
\begin{pspicture*}(-5,-2.5)(5,2.5)
  \pstVerb{
    /e 2.718281828459045 def
    /arccos { dup dup mul neg 1.0 add sqrt exch atan } def
    /sinh { dup e exch exp exch neg e exch exp sub 2 div } def
    /cosh { dup e exch exp exch neg e exch exp add 2 div } def
    /arsh { dup dup mul 1 add sqrt add ln } def
    /arch { dup dup mul 1 sub sqrt add ln } def
  }
  \psaxes(0,0)(-5,-2.5)(5,2.5)
  \pscircle[linecolor=red]{1}
  \psset{plotpoints=100,linewidth=0.05pt,polarplot=true,linecolor=blue}
  \multido{\rA=0.005+0.05}{5}{
    \psplot{1}{179}{%
      /const0 \rA\space def 
      /const1 1.0 def % cylinder radius
      \func
    }
    \psplot{181}{359}{%
      /const0 \rA\space def 
      /const1 1.0 def % cylinder radius
      \func
    }%
  }
  \multido{\rA=0.03+0.25}{20}{
    \psplot{1}{179}{%
      /const0 \rA\space def 
      /const1 1.0 def % cylinder radius
      \func
    }
    \psplot{181}{359}{%
      /const0 \rA\space def 
      /const1 1.0 def % cylinder radius
      \func
    }%
  }
\end{pspicture*}

\end{document}



But doesn't exist a program that creates me the inverse Polish notation, interval, etc? How long want to understand first and then to write the codes of a figure?
Not understand nothing when I must to draw a function in 2D and 3D. For example; if  I must to draw the function x*\sqrt(x^2+y^2-1) or the area of the trapezoid of the function x +sin x in the interval [\pi/2  3/4 \pi] as I have to do?  Want years to understand as create only a simple figure; represent of behaviour a give a complex figure. But doesn't exist a program that creates me directly the code that transforms me a function in the inverse Polish notation and that to draw it?
I hope you sent me a answer of my problem.
Best regards 
Sebastiano Spatola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20050807/b7f87f57/attachment.html 


More information about the PSTricks mailing list