[prev in list] [next in list] [prev in thread] [next in thread] 

List:       scilab-users
Subject:    Re: [Scilab-users] find a zero of a system of nonlinear functions
From:       Samuel Gougeon <sgougeon () free ! fr>
Date:       2017-11-28 14:12:13
Message-ID: bb4273f4-298a-62e4-155c-619d65e275e4 () free ! fr
[Download RAW message or body]

Le 28/11/2017 à 12:30, CRETE Denis a écrit :
> Hello,
> I am not convinced that in the quoted document the first argument is a range:
> the values returned by the function fsolve are generally not lying in the intended \
> "range"; if you try:
> fsolve([0.4,0.45,0.5],f)
> ans  =
> - 1.    6.    228.
> If I understand correctly, the first argument is considered as a vector, i.e. that \
> the function f takes a vector as argument and returns a vector of the same \
> dimension, with elements sin(2*%pi*xi).
You are all right, Denis.
But this feature could actually be used to parallelize computations of 
several roots, provided that the function is well vectorized. But it's 
not the case: there is a mistake:
Le 28/11/2017 à 11:58, Hermes a écrit :
> .../...
> function y=f(x)
> y=exp(-x.^2)*cos(4*x);
> endfunction
.* cos() should be used instead of *cos()

Le 28/11/2017 à 11:12, Hermes a écrit :
> .../...
> function y = poly_cubic(x)
> y = 3 - 10*x + 2*x^2 + 3*x^3;
> endfunction

This one is definitely not vectorized. .^should be used instead of ^.

HTH
Samuel

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic