[pstricks] info about \psCumIntegral

Alexander Grahn A.Grahn at hzdr.de
Thu Dec 13 18:12:04 CET 2018


On Thu, Dec 13, 2018 at 02:57:12PM +0100, Carlo Alberini wrote:
>Dear Alexander, 
>	thank you for your mail; I think about a function like:
>
>$\int_{2x+3}^{\frac{1}{x+1}}f(t)dt$, with some f(t) as you like. 
>
>It would be fantastic if I could have the plot af such a function… written with the “algebraic” option (easy and fast …)
>
>Thank you
>Carlo
>
>> Il giorno 13 dic 2018, alle ore 14:47, Alexander Grahn <A.Grahn at hzdr.de> ha scritto:
>> 
>> Dear Carlo,
>> 
>> On Thu, Dec 13, 2018 at 01:25:56PM +0100, Carlo Alberini wrote:
>>> Dear list,
>>>   I write this message after reading the pst-func manual. I have found very interesting the command \psCumIntegral and I have two questions about it:
>>> 
>>> - the command works only with the integration interval from 0 to x, or si it possible to put - as integration interval - also two functions like f(x) and g(x)? ... in order to have the plot of an integral function like $F(x)=\int_{f(x)}^{g(x)}f(t)dt$ ...?
>>> 
>>> and 
>>> 
>>> - is it possible to write, in such a way, the function under the integral operator with the option “algebraic”, or not? ... like this ...
>>> 
>>> \psCumIntegral[algebraic,plotpoints=1000,Simpson=10,linecolor=blue]{1}{9}{ln(x)/(1+x^3)}
>>> 
>>> Thank you so much for your help and your tips!
>>> 
>>> Best regards 
>>> Carlo 
>> 
>> could you please specify f(x) and g(x)?
>> 
>> Alexander

Here, \pstODEsolve from package pst-ode is (ab)used for integrating  ln(t)/(1+t^3)
between g(x)=2x+3 and h(x)=1/(x+1).

Everything input in algebraic notation (infix notation). Some Postscript
required for assembling result list `result' to be plotted with
\listplot from pst-plot.

Hope this is what you expect.

Alexander

  \documentclass[a5paper]{article}
  
  \usepackage{pst-ode,pst-plot}
  
  \begin{document}

  \pstVerb{/result {} def} %initialise empty result list
  \multido{\nX=1.00+0.01}{801}{% 801 plotpoints for x=1.0, 1.01, ..., 9.0
    % one call of \pstODEsolve returns integral = [g(x) 0 h(x) F(h(x))] --> two output points
	%
	%                     format for `integral'----v      two output points---v   v---initial value at g(x)
    \pstODEsolve[algebraicAll,silent]{integral}{t | y[0]}{2*\nX+3}{1/(\nX+1)}{2}{0.0}{ln(t)/(1+t^3)}
    %                      integration interval from g(x)----^    to    ^----h(x)
	%
    % append [x F(h(x))] to results list
    \pstVerb{/result [result \nX\space integral exch pop exch pop exch pop] cvx def}
	%
    %print to stdout
    \pstVerb{[\nX\space integral exch pop exch pop exch pop] ==}
  }
  
  \begin{equation}
    f:x \mapsto \int_{2x+3}^{1/(x+1)} \frac{\ln(t)}{1+t^3}\, \textrm{d}t
  \end{equation}
  
  %plot result
  \psset{xunit=0.5,yunit=500}
  \begin{center}
  \begin{pspicture}(-3,-0.006)(10,0)
    \psaxes[Dx=1,Dy=0.001](0,0)(0,-0.006)(10,0)
    \listplot[linecolor=red]{result}
  \end{pspicture}
  \end{center}
  \end{document}



More information about the PSTricks mailing list