# [pstricks] \pst-func

Herbert Voss Herbert.Voss at FU-Berlin.DE
Wed Dec 10 13:36:57 CET 2008

Patrice Mégret schrieb:

> I am using pst-func to plot functions with \psIntegral.
> In the documentation, (page 21) <x t function> and <x function> should be written <t x function> and <t function> to be compatible with the relations 16 to 18 and with the stack order.
>
> My functions are:
> F(x,t)=60*\int_0^pi (cos(2pixcos(t))-cos(2pix))^2/sin(t) dt
> and:
> D = 2*(cos^2(2pix))/F
>
> I have no problem to draw F with \psIntegral:
>
> \documentclass[11pt,twoside]{article}
> \usepackage{pstricks}
> \usepackage{pst-func}
> \begin{document}
> \pstVerb{/F {exch dup 3 -1 roll 2 mul Pi mul dup 3 -1 roll COS mul COS exch COS sub 2 exp exch SIN div 60 mul} bind def}
> % ce code définit la fonction [cos(2pix cos(t))-cos(2pix)]^2 / sin(t) avec x=h/lambda
> \psset{llx=-1.5cm,lly=-0.5cm,urx=0.2cm,ury=0.2cm,xAxisLabel={$h/\lambda$},xAxisLabelPos={0.5,-45},yAxisLabel={$R_r$ en ohms},yAxisLabelPos={-0.1,150}}
> \begin{psgraph}[Dy=50,Dx=0.1,xticksize=300 0,yticksize=1 0, comma=true,axesstyle=frame](0,0)(1,300){10cm}{5cm}
> \psIntegral[Simpson=100,plotpoints=200,linecolor=orange,linewidth=1.5pt]{0}{1}(0.01,3.13){F}
> \end{psgraph}
> \end{document}
>
> but I don't see how I can draw D? Maybe I should use the Simpson integration routine inside pst-func.pro but it is not clear for me how to use it.

Patrice,
there seems no quick solution for that problem
and I am limited with my time until end of this year ...
so I cannot help until then.

> By the way, there is a small trouble with the labeling on the x-axis: if Dx=0.1, the last label 1.0 is not printed, if Dx=0.2, the last label 1.0 is printed. To solve the problem, in my final version I have put 1.001 as the max x-axis and Dx=0.1.

that is the old problem with TeX and rounding errors. The labels
are set on TeX side. But it is no problem to fix it in your way.

Herbert