[Scilab-users] The numderivative function consumes a lot of time
Hermes
herozigle at gmail.com
Wed Nov 15 15:46:55 CET 2017
Hi;
The numderivative function consumes a lot of time in the calculations.
In the following script I show two options for my "odes" function
In one of them I use the numderivative function; and the calculation is
extended by 9 minutes. And in the other I use the Jacobian determinant of
the function, for each variable, obtained in wxMaxima. And the calculation
is a few, few, seconds.
I am interested in using the function with numderivative, and very similar
to how I have developed it, since it allows me to use it for systems of more
equations.
//Draghilev's Method
clc;
clear;
function Sys=Q(x)
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
[j,v,info]=fsolve([2;-0.1;3],Q)
ics=j;
//
N=100;
smin=0.0;
smax=0.046;
h=0.001;
*function [dydt]=odes(t,x)
//Scilab
gfd=numderivative(Q,x);
[r,c]=size(gfd)
ic=1:c
for i=1:c
dydt(i)=(-1)^i*det(gfd(1:$-1,find(ic~=i)));
end
endfunction
*
//from wxMaxima
function dydt=odes(t,x)
//dydt=zeros(x);
dydt(1)=-12*(x(2)-2)*x(3)^5+12*x(2)^5*x(3)
dydt(2)=12*(x(1)-2)*x(3)^5-12*x(1)^5*x(3)
dydt(3)=-12*(x(1)-2)*x(2)^5+12*x(1)^5*(x(2)-2)
endfunction
step=smax/N;
t=[smin:step:smax*N];
t0=0
atol=h/100000;
LL= ode( ics,t0, t,atol,odes)
clf;
drawlater()
param3d(LL(3,:)',LL(2,:)',LL(1,:)');
set(gce(),"mark_mode","on","mark_style",2,"mark_size_unit","point","mark_size",4,"line_mode","off")
drawnow()
Is it possible to decrease the calculation time if I manipulate the options
of% ODEOPTIONS = [*, ..., *]?
What parameters would I manipulate?
Gracias
--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
More information about the users
mailing list