Closed
Description
using NonlinearSolve
N = 100_000;
levels = 1.5 .* rand(N);
out = zeros(N);
myfun(x, lv) = x * sin(x) - lv
function f(out, levels, u0)
for i in 1:N
out[i] = solve(NonlinearProblem{false}(NonlinearFunction{false}(myfun),
u0, levels[i]), Falsi()).u
end
end
function f2(out, levels, u0)
for i in 1:N
out[i] = solve(NonlinearProblem{false}(NonlinearFunction{false}(myfun),
u0, levels[i]), NewtonRaphson()).u
end
end
@time f(out, levels, (0.0, 2.0))
@time f2(out, levels, 1.0)
Metadata
Metadata
Assignees
Labels
No labels