[Scilab-users] find a zero of a system of nonlinear functions

Hermes herozigle at gmail.com
Tue Nov 28 11:12:47 CET 2017


fsolve
I find a zero of a system of nonlinear functions:
y = 3 - 10 * x + 2 * x ^ 2 + 3 * x ^ 3 in the range x = -3: 0.01: 3

but fsolve returns as a solution a vector (in the scrip yr) of the same size
as x.
I have varied the precision tolerance h to several values 1.d-3 to% eps. but
I always get that infinity of solutions.
the only solution that I found is shown in the script.
Is it possible to improve this?

funcprot(0);
function y = poly_cubic(x)
 y = 3 - 10*x + 2*x^2 + 3*x^3;
endfunction

x=-3:0.01:3;
clf()
plot(x,poly_cubic);

disp("-2.3027756 0.3333333 1.3027756  ", "Roots to y = 3 - 10*x + 2*x^2 +
3*x^3")
h=%eps;
yr=fsolve(x,poly_cubic,h)
RR=strtod(unique(string(yr)));
RR=gsort(RR,'g','i');//sort the elements of the array RR in the increasing
order.

disp(RR,"Roots values f(x)")
plot(RR,poly_cubic,"ro") 




--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html



More information about the users mailing list