I'd like to build up a 3D-Plot (based on pst-solides3d), where the function looks like

x=u, y=v and z=\int_0^x \frac{\sin\left(\pi t \right)}{\pi t} - \frac{1}{3} \mathrm{d}t+\frac{1}{\pi^2}\sin\left(\pi \frac{x}{y}.

I do not know, how to define this function - esp. the sine integral - within the \defFunction argument. Is the a Si function? Thanks in advance

  • Bye the way - wouldn't it be great to be able to enter LaTeX-Math-Code directly here - maybe inside of ( ) or so? – Bastian Ebeling Mar 1 '11 at 9:46
  • You could always take a screen shot. – TH. Mar 1 '11 at 9:55
  • Indeed - but this is not that way easy or elegant as it would be to simply insert $a^2$ or (a^2). Further I think most of us here are also able to read Math-TeX code directly. – Bastian Ebeling Mar 1 '11 at 9:59
  • 2
    We had LaTeX math rendering on in the beginning, but requested to have it turned off: This is a site about TeX, not math. – Hendrik Vogt Mar 1 '11 at 10:08

the package pst-func has a PostScript macro Si which expects a value on the stack and returns the integral. For more information see the documentation of pst-func. Here is only an idea of how it can be done. Don't know how to handle your values, because PostScript needs degrees for the sin function which can be done internally with DegtoRad:


\psset{Decran=50,viewpoint=10 20 40 rtp2xyz,lightsrc=viewpoint}
  {u tx@FuncDict begin Si end u 3 div sub u v Div RadtoDeg sin Pi dup mul div add }  
\psSolid[object=surfaceparametree,base=-1 1 -1 1,function=func,
         ngrid=40 40,hue=0 1]

$x=u$, $y=v$ and 
$z=\int_0^x \frac{\sin\left(\pi t \right)}{\pi t} - 
\frac{1}{3} \mathrm{d}t+\frac{1}{\pi^2}\sin\left(\pi \frac{x}{y}\right)$

enter image description here

  • Hi Herbert, this is exactly what I needed. Thank you! – Bastian Ebeling Mar 1 '11 at 10:39
  • Now - this results in a new question for me: I tried your example compiling with xelatex - but it went wront. I thaugh with xelatex pstrick should compile fine, or? – Bastian Ebeling Mar 1 '11 at 10:46
  • 1
    @Bastian: yes, I had no problem with current TeXLive 2010 – user2478 Mar 1 '11 at 11:01
  • 2
    Hmmm, you are right - this problem only arises on MikTeX. It is time for me to remove this installation... ;-) Thanks again! – Bastian Ebeling Mar 1 '11 at 11:03

enter image description here

The Asymptote is capable of calculations of the integral of f from a to b using adaptive Simpson integration. However, when configured with the GNU Scientific Library (GSL), it includes Si(x) = int(sin(t)/t, t=0..x) function as well. plot-si.tex:


z&=\int_0^x \frac{\sin\left(\pi t \right)}{\pi t} - 
\frac{1}{3} \mathrm{d}t+\frac{1}{\pi^2}\sin\left(\pi \frac{x}{y}\right)
=\frac{\Si(\pi x)}{\pi}-\frac{x}3 +\frac{1}{\pi^2}\sin\left(\pi \frac{x}{y}\right)

import gsl;
import graph3;
import palette;
real f(pair p){return Si(pi*p.x)/pi-1/3*p.x+1/pi^2*sin(pi*p.x/p.y);}
real Arg(triple v) {return f((v.x,v.y));}
real ep=1e-7;
surface s=surface(f, (-1+ep,-1+ep),(1,1),nx=200);


run latexmk -f pdf plot-si.tex.

  • I get error when running latexmk -f pdf plot-si.tex. So, I try to load it with txs:///asy-pdf-chain in TeXstudio but I get error: out of memory, runscript.tlu:902: command failed with exit code 1: asy plot-si-1.asy, Process exited with error(s). What should I do to compile it perfectly? – Trong Vuong Mar 19 at 12:06
  • @chishimutoji: Try it step-by-step: After step 1: pdflatex plot-si.tex : the file plot-si-1.asy must show up. Run step 2: asy plot-si-1.asy , at this step a pdf image plot-si-1+0_0.pdf must be created (may take some time, so be patient) to be included into the final document on the next step. And final step - run pdflatex plot-si.tex again and get plot-si.pdf. I just checked and got (1 page, 3300786 bytes) file, but on the other system the size may be slightly different. – g.kov Mar 19 at 13:42
  • With step 2: asy plot-si-1.asy , I get **error: out ... asy plot-si-1.asy. :-((. Note: I compile the different files normally. With this file, I don't get output. :-( . I use Asymptote 2.44 – Trong Vuong Mar 19 at 14:02
  • Haiz, I just compile it normally. The reason is ** nx=200 **, it is changed to ** nx=90 **. :-)). – Trong Vuong Mar 19 at 14:13
  • @chishimutoji: Try to upgrade to the current Asymptote version 2.47? – g.kov Mar 19 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.