How to plot Newton's method

It doesn’t look like Newton’s Method, looks more like Lipp’s Method.

Why do you say it doesn’t look like the Newton method, and what is Lipp’s method?

The way it jumps back and forth, it does use a tangent though, and it’s still using a curve.

@j_verzani very nice interactive code using Makie, looks like Newton method to me. And curves display beyond the canvas!

Some snapshots below for the function:
function newton(f=x-> (x/2)^3 - x, x0=1, a=-4, b=4, n=20):



PS: display could be improved further, by showing the zero solution found, etc.

1 Like

ok, I think it depends on the starting poin. It does work good. I was just trying to start with something simpler. I will definatly look it over, and see what all there is for options.

I did a simpler version with Plots.jl

function ralpheson(x)
	f(x)=x^2-sqrt(3)
	plot(f,0:.001:3.3,legend=false)
	plot!([x,x],[0,f(x)])
	for i in 1:45
		n(x)=x-(f(x)/ForwardDiff.derivative(f,x))# Newton-Rapheson formula
		plot!([n(x),x],[0,f((x))],legend=false)
		plot!([n(x),n(x)],[0,f(n(x))],legend=false)# plots each itteration
		x=n(x)# recursion is used to reset x
	end
	plot!()
end

I think I’m going to figure out how to use @bind, to make it interactive.