<?xml version="1.0" encoding="UTF-8"?>
<Worksheet><Version major="6" minor="1"/><View-Properties><Zoom percentage="100"/></View-Properties><Styles><Layout alignment="left" bullet="none" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Normal" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Font background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" italic="false" name="Maple Input" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false"/></Styles><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">restart; with(plots):</Font></Text-field></Group><Group><Text-field layout="Normal"/><Text-field layout="Normal"><Font background="[0,0,0]" bold="true" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="20" subscript="false" superscript="false" underline="false">Newton-Raphson</Font></Text-field><Text-field layout="Normal"/></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">g := x-&gt; 3*tanh(x)-x^3;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">plot(g(x), x = -3 .. 3);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">x-g(x)/(diff(g(x), x));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">f := unapply(%, x);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">x1 := 1.2; N:=20;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">xx := Array(1..N):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">xx[1] := x1:</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">for n from 1 to N-1 do</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  xx[n+1] := evalf( f(xx[n]) );</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">end do:</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">pp := seq([i, xx[i]], i = 1 .. N):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">pointplot([pp], labels = (["n", "xn"]));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">xstar := pp[N][2];</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">check with maple's algorithm </Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">fsolve(g(x), x = 1);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Not bad..</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">df := D(f);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">df(xstar);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">the stability is 0, i.e. superstable; this means that the series converges extremely fast</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">g := 'g';</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">f := x-g(x)/(diff(g(x), x));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">diff(f, x);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Since g(xstar) = 0,  we conclude (naively) that df/dx(xstar) = 0 for arbitrary g</Font></Text-field><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">i.e. the system is always superstable whatever g.</Font></Text-field><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">....which is incorrect, as will follow below</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">g := x-&gt; (cosh(4-3/x)-1)^(1/a);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">x-g(x)/(diff(g(x), x));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">f := unapply(%, x);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">df := D(f);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">a := 6;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">plot(g(x), x = .7 .. .8, labels = (["x", "g(x)"]));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">plot([x, f(x)], x = 0 .. 1, labels = (["x", "f(x)"]), legend = (["y=x", "y=f(x)"]));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">x1 := 0.4; N:=200;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">xx := Array(1..N):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">xx[1] := x1:</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">for n from 1 to N-1 do</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  xx[n+1] := evalf( f(xx[n]) );</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">end do:</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">pp := seq([i, xx[i]], i = 1 .. N):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">pointplot([pp], labels = (["n", "xn"]));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">ret := seq([xx[i], xx[i+1]], i = 1 .. N-1):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">pointplot([ret], labels = (["xn", "xn+1"]));</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">apparently a chaotic series is generated</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">g(3/4);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">So there is no question that xstar = 3/4 is the right solution. However:</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">f(3/4);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">df(3/4);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Lets try the limit</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">limit(f(x), x = 3/4);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">limit(df(x), x = 3/4);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">We see that df/dx /= 0, as concluded before.</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Bifurcation diagram</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">a := 'a';</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">N := 200; Nr := 100; x1 := 0.1; amin := 3; amax := 6;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">Nmin := N/2; Nmax := N;</Font></Text-field></Group><Group><Text-field layout="Normal"/><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Define Arrays to store the bifurcation points and r-values</Font></Text-field><Text-field layout="Normal"/></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">Npts := Nmax-Nmin+1;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">points := Array(1..Nr, 1..Npts);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">ri := Array(1..Nr);</Font></Text-field></Group><Group><Text-field layout="Normal"/><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Calculate x[n] for various r</Font></Text-field><Text-field layout="Normal"/></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">xx := Array(1..N): xx[1] := x1:</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">for ir from 1 to Nr do</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  a := evalf(amin + (ir-1) / (Nr-1) * (amax - amin));</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  ri[ir] := a;</Font></Text-field><Text-field layout="Normal"/><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">       Calculate the x[n] series</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  for n from 1 to N-1 do</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">    xx[n+1] := evalf( f(xx[n]) );</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  end do:</Font></Text-field><Text-field layout="Normal"/><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">       Add the converged last section of the series to the bifurcation list</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  points[ir, 1..Npts] := xx[Nmin..Nmax]:</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">end do:</Font></Text-field></Group><Group><Text-field layout="Normal"/><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Plot the bifurcation diagram.  Firstly, we 'serialize' the points Array, by creating an pp Array which contains [r, x] pairs.</Font></Text-field><Text-field layout="Normal"/></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">pp := Array(1..Nr*Npts, 1..2):</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">for ir from 1 to Nr do</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  pp[1 + (ir-1)*Npts..ir*Npts, 1] := ri[ir];</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">  pp[1 + (ir-1)*Npts..ir*Npts, 2] := points[ir];</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">end do:</Font></Text-field></Group><Group><Text-field layout="Normal"/><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Convert the Array to a list and plot the bifurcation diagram</Font></Text-field><Text-field layout="Normal"/></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">convert(pp, listlist):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">pointplot(%, symbol=point, symbolsize=1,labels=["a", "x"]);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">For a = 4.5 there seems to be a period 2</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">a := 4.5;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">f2 := x-&gt; f(f(x));</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">f2(x):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">plot([f(x), f2(x), x], x = .2 .. 1);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">x2a := fsolve(f2(x) = x, x = .6);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">x2b := f(x2a);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">df2 := D(f2):</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">df2(x2a);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">df2(x2b);</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">sigma := df(x2a)*df(x2b);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Three ways that show that x2a,x2b form a stable period -2 solution, since the stability |sigma| &lt; 1  </Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Will maple be fooled? Lets try:</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">a := 6;</Font></Text-field></Group><Group><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font background="[0,0,0]">fsolve(g(x), x = .4);</Font></Text-field></Group><Group><Text-field layout="Normal"><Font background="[0,0,0]" bold="false" executable="false" family="Lucida Bright" foreground="[0,0,0]" italic="false" size="12" subscript="false" superscript="false" underline="false">Clearly not.</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Group><Text-field/></Worksheet>