# [pstricks] psNewton

Herbert Voss Herbert.Voss at FU-Berlin.DE
Wed Apr 13 12:05:25 CEST 2011

Am 13.04.2011 08:18, schrieb Markus Krebs:

> It may be useful for teaching to have a psNewton-macro

Oh, there are a lot of useful things in the life :-)

With the pst-plot from
http://texnik.dante.de/tex/generic/pst-plot/
you can use:

\documentclass{article}
\usepackage{pst-plot}
\begin{document}

\def\f{-(1/192)*x^3-(1/12)*x-(1/192)*Pi*x^2-(1/12)*Pi+2}
\def\fDerive{-(3/192)*x^2-(1/12)-(2/192)*Pi*x}

\psset{plotpoints=2000,unit=0.5,algebraic}
\begin{pspicture*}[showgrid](-20,-10)(8,20)
\psaxes[Dx=6,Dy=4]{->}(0,0)(-20,-10)(8,20)[$x$,270][$y$,0]
\psplot[algebraic,linewidth=2pt,linecolor=blue]{-20}{10}{\f}
\psxTick(-15){x_0}
\psNewton[linecolor=red,linewidth=0.5pt,showDerivation=false]{-15}{\f}{10}
%
%-15, -9.567466932, -4.903526029, 3.026073041, 6.688396612, 5.580230655
\end{pspicture*}

\begin{pspicture*}[showgrid](-20,-10)(8,20)
\psaxes[Dx=6,Dy=4]{->}(0,0)(-20,-10)(8,20)[$x$,270][$y$,0]
\psplot[algebraic,linewidth=2pt,linecolor=blue]{-20}{10}{\f}
\psxTick(-15){x_0}
\psNewton[linecolor=red,linewidth=0.5pt,showpoints]{-15}{\f}[\fDerive]{10}
\end{pspicture*}

\end{document}

\psNewton{xStart}{Func}[f-Derivation]{steps}

Without the optional [f-Derivation] it uses an epsilon of 0.01
for the derivation

Herbert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto.png
Type: image/png
Size: 56964 bytes
Desc: not available