I am new to Julia, I have been trying to test the NonlinearSolve.jl installation using the Problem Type 1 of “Getting Started with Nonlinear Rootfinding in Julia”, but it always returns the error ’LoadError: UndefVarError: solve not defined’. I am not able to figure out why. I installed the last version of Julia from Microsoft Repository and installed the NonlinearSolve.jl without any warning or error. Could anyone please help me. I have included the test code here.
using NonlinearSolve
f(u, p) = u .* u .- p
u0 = [1.0, 1.0]
p = 2.0
prob = NonlinearProblem(f, u0, p)
sol = solve(prob)
The thing that is incredibly strange here is that solve would not be defined after using NonlinearSolve runs successfully. I have a very hard time imagining how his could possibly happen.
The first question is where are you running Julia? Did you open the Julia application from the start menu or are you running Julia within another program like Visual Studio Code?
(I suspect a VSCode module issue.)
thank you for your reply. With your instructions the code is working. As stated from Nathan_Boyer I was using Visual Studio Code, so I think is a problem of VSCode configuration. I will study the correct configuration.
The output of the command versioninfo() is:
Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 4 × Intel(R) Core™ i7-5500U CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, broadwell)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
the output of Pkg.status() is:
Status C:\Users\Giovanni\Julia programs\Project.toml
[8913a72c] NonlinearSolve v3.10.0