[Scilab-users] solve a system of equations in scilab
Hermes
herozigle at gmail.com
Mon Sep 18 14:40:27 CEST 2017
with this script I manage to evaluate and obtain the third value within the
results vector.
clear;
function Sys=Q(x,z)
Sys(1)=(x(1)-2)^2+(x(2)-2)^2+x(3)^2-9;
Sys(2)=x(1)^6+x(2)^6+x(3)^6-12;
Sys(3)=x(3);
endfunction
a=[0,0 0;1 0 0;1.2 -1 0;1.5 -0.9 0]
for i = 1:4
x(3)=0.0;
[j,v,info]=fsolve(a(i,:)',list(Q,x(3)))
disp(j',"estimated zero",v',"value of function at x","results",
a(i,:),"iinitial value:",i)
end
--> exec('C:\Users\hermesr\Documents\Scilab Xcos\fsolve_eje20.sce', -1)
1.
iinitial value:
0. 0. 0.
results
value of function at x
0. 3.553D-15 0.
estimated zero
1.496447 -0.9574371 0.
2.
iinitial value:
1. 0. 0.
results
value of function at x
1.137D-13 1.345D-11 0.
estimated zero
1.496447 -0.9574371 0.
3.
iinitial value:
1.2 -1. 0.
results
value of function at x
0. 3.553D-15 0.
estimated zero
1.496447 -0.9574371 0.
4.
iinitial value:
1.5 -0.9 0.
results
value of function at x
0. 3.553D-15 0.
estimated zero
1.496447 -0.9574371 0.
--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
More information about the users
mailing list