[Scilab-users] solve a system of equations in scilab

Hermes herozigle at gmail.com
Sun Sep 17 08:25:14 CEST 2017


Hello,
 Please I need your comments.
I have tried to solve the system with different initial conditions for
fsolve and I always get the same wrong result for the second variable.

function Sys=Q(x,z)
Sys(1)=(x(1)-2)^2+(x(2)+2)^2+z^2-9;
Sys(2)=x(1)^6+x(2)^6+z^6-12;
endfunction
z=0;
[j,v,info]=fsolve([*1.5;-0.9*],list(Q,z))
disp(j,v,info)

Even when putting these initial values, very similar to the expected values,
fsolve returns 
1.496447
0.9574371 the second positive value

By using these values as initial values in this script:

//Draghilev's Method
clear;
function Sys=Q(x,z)
Sys(1)=(x(1)-2)^2+(x(2)+2)^2+z^2-9;
Sys(2)=x(1)^6+x(2)^6+z^6-12;
endfunction
z=0;
[j,v,info]=fsolve([1.5;-0.9],list(Q,z))
disp(j,v,info)

N=100;
smin=0.0;
smax=0.046;
h=0.001;


x01=1.496447;
//3.9691163496*10^-12;
x02=0.9574371;
//0.353580783;
x03=0;
//-1.5130442808;
ics=[x01; x02; x03];

disp(["x(3)^2+(x(2)-2)^2+(x(1)-2)^2-9";"x(3)^6+x(2)^6+x(1)^6-12"],"systema")


disp(["2*(x(1)-2),2*(x(2)-2),2*x(3)";"6*x(1)^5,6*x(2)^5,6*x(3)^5"],"jacobian(Vm,[x(1),x(2),x(3)])");
//

//D1=12*x(2)^5*x(3)-12*(x(2)-2)*x(3)^5;
//D2=12*(x(1)-2)*x(3)^5-12*x(1)^5*x(3);
//DD=12*x(1)^5*(x(2)-2)-12*(x(1)-2)*x(2)^5;
function dydt=odes(t,x)
//dydt=zeros(x);

dydt(1)=-12*x(2)^5*x(3)-12*(x(2)-2)*x(3)^5; 
dydt(2)=12*(x(1)-2)*x(3)^5-12*x(1)^5*x(3);
dydt(3)=12*x(1)^5*(x(2)-2)-12*(x(1)-2)*x(2)^5;
endfunction
step=smax/N;
t=[smin:step:smax*N];
t0=0
atol=h/100000; 
rtol=h/100000;
LL= ode("rk", ics,t0, t',atol,rtol,odes)
LL=LL'
a=gca();//get the handle of the newly created axes
param3d1(LL(:,3),LL(:,2),LL(:,1),alpha=35,theta=45,"X at Y@Z",flag=[2,2])
a.rotation_angles=[65,75];

The calculations have taken a long time without converging to the solution.
I have interrupted the execution of the same.
By entering the correct values, almost instantaneously, you get the
soclucion of the system.
Help Me!!!
gracias





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



More information about the users mailing list