An error in implementation of "for" loop while using "IntervalArithmetic.jl" package in "Pluto.jl" notebook

Hello

I am trying to find a root of an equation using Interval Newton method in Julia. I am using “IntervalArithmetic.jl” package in “Pluto.jl” notebook. The code seems logically correct (checked a few times) but it is giving an error syntax: "for" at /Users/dycobs/.julia/pluto_notebooks/Mini revelation.jl#==#4e903eeb-0172-4cd3-b5e9-21d235f99d28:13 expected "end", got "NXk"
The code is here

begin
using IntervalArithmetic, Plots, ForwardDiff, PlutoUI, FiniteDiff

	f(x) = a - b * x
	
	l = 10   
	m = 10
	a1 = vec(mince(100..200, l))
	b1 = vec(mince(1..2, m))
	
	d(f, x) = ForwardDiff.derivative(f, x) 
	local Xnew = 0..300
	nn = 10 
	NXk = (0..0)
	for i in 1:nn
		for j in 1:l
			a = a1[j]
			for k in 1:m
				b = b1[k]
				NXk_new = mid(Xnew) - (f(mid(Xnew)) / d(f, Xnew))
				NXk = NXk ∪ NXk_new
			end
		end
		Xkplus NXk ∩ Xnew
		Xnew = Xkplus
		@show(interval(i), Xnew)
	end
end

Could you please explain the possible reason behind the error?

Thank you

Something’s missing here :wink:

2 Likes