this is a double problems but want to be combined as one.
I want to show a plot of function (just simple plot, no need for the Newton’s method iteration shown, but if it is possible you can tell me).
Plus the result of the root obtained / the solution of the Newton method. I am using MTH229
(+) I want to ask whether using f'(x) is better than SymPy? How to check it? btime?
(-) I have to type at terminal manually plot(f) to show the graph. I want it to be automatically shown at the same time as the result from the Newton’s method iterations.
this is my code:
# Julia for Newton's method
using MTH229, Plots, LaTeXStrings, SymPy
gr()
@vars x
f(x) = sin(x) - x/4
fp(x) = f'(x)
plot(f, -10, 10, ylims=(-5,10),
label=L"f(x)", framestyle=:zerolines,
legend=:outerright)
newton(f, fp, 2pi, verbose=true)
#type at terminal: plot(f)
Sorry I’m not sure I understand - you’ve marked my post as the solution but are you saying it’s not actually working?
I would not worry about upgrading from 1.7 to 1.8, it’s an upgrade from one minor release to another which by Semver rules is non-breaking (also you can install multiple Julia versions in parallel so checking whether this works probably takes all of ten minutes and won’t affect your 1.7 installation).
Yes it is not working to show the plot at the same time as the computation for Newton’s method, but since I haven’t use newer Julia version I mark it as solution, who knows the problem is in my Julia version.
I will try to make Julia installation parallel then. Thanks!