Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
59 views
%var u parametric_plot3d( (sin(u), cos(u), u/10), (u, 0, 20), thickness=5, color='green', plot_points=100) x = var('x'); # declare the variable for function f(x)=x^2-2; # change this to whatever function you like #f(x)=x^3 #f(x)=x/(1+x^2) df=diff(f,x); # Store the Derivative of f Newton(x)=x-(f/df)(x); # Newtons Iterative Formula (simply called Newton) plot(f,[-5,5])
xn=2.0; xn; Newton(xn)
2.00000000000000 1.50000000000000
xn=400 xs=[xn] n=10 for i in [1..n]: xn=N(Newton(xn),digits=20) xs.append(xn) print xn; print xn
200.00250000000000000 100.00624993750078124 50.013124343795699820 25.026556923537957222 12.553236015780712474 6.3562787422813050615 3.3354641267949481821 1.9675404144951971239 1.4920189794877181846 1.4162422506859136334 1.4162422506859136334