[Scilab-users] root calculation

Stéphane Mottelet stephane.mottelet at utc.fr
Mon Nov 5 15:02:05 CET 2012


Le 05/11/12 14:53, Adrien Vogt-Schilb a écrit :
> On 05/11/2012 14:45, Paul Carrico wrote:
>> All,
>>
>> Thanks for the feedback ...
>> ... a basic plot shows the curve is monotonic (see attachment) ; I should plot a 3D curve in order to study the influence of the exponents for example to verify there's one and only one root ...
>>
>> ... I've to code a fast function to solve this kind of equation ... hundred thousand (and maybe million) of similar equation to solve :-~
>
> hi
>
> beware not to use one single fsolve to solve a set of independent 
> equations;
>
> somethign like
>
> function [a b] = f(x,y)
> a=x^3 -1
> b= y^(0.6456) +4y^.45 - .566
> endfunction
>
> fsolve([0 0],f)
>
>
> this is a bad idea, because fsolve will systematically calculate db/dx 
> and da/dy, this would take much longer and much more memory than just 
> fsolving x^3 -1, and then y^(0.6456) +4y^.45 - .566
> of course this is much worse when you have N outputs and N inputs to 
> your function, in this case fsolve calculates N^2 derivatives at each 
> step...

fsolve is clearly missing a "jacobian pattern" option...

S.

>
>> That's one of the reasons why I asked about the possible parallelization
>>
>> Regards
>>
>> Paul
>>
>>
>>
>> -----Message d'origine-----
>> De :users-bounces at lists.scilab.org  [mailto:users-bounces at lists.scilab.org] De la part demichael.baudin at contrib.scilab.org
>> Envoyé : lundi 5 novembre 2012 13:59
>> À : International users mailing list for Scilab.
>> Objet : Re: [Scilab-users] root calculation
>>
>> Hi,
>>
>> This is a nonlinear equation, for which we are searching a zero.
>>
>> The fsolve function is designed for this purpose:
>>
>> http://help.scilab.org/fsolve
>>
>> Notice that there might not be a solution. This is why the algorithm is an optimization problem, where the square norm of f(x) is minimized.
>> This method also works for a system of nonlinear equations, so that this is (much) more general than dichotomy, secant, Brent, etc... which are one-variable solvers.
>>
>> No 1-variable method is available at the Scilab level, to my knowledge.
>> But the Brent method is used internally in the computation of the inverse Cumulated Distribution Function (quantile) by the DCDFLIB library (e.g. X=cdfnor("X",Mean,Std,P,Q)). Notice that Matlab has the fzero function :
>>
>> http://www.mathworks.fr/fr/help/matlab/ref/fzero.html
>>
>> which uses Brent's method.
>> But this method is not available directy in Scilab. This is a good design choice in my opinion, since fsolve is much more general. But I guess that fzero may be faster and more robust, in some cases.
>>
>> Best regards,
>>
>> Michaël
>>
>> Le 2012-11-05 13:13, Paul Carrico a écrit :
>>> Dear all,
>>>
>>> This a stupid question, but how can I solve directly in, Scilab an
>>> equation such as :
>>>
>>> 0.403*X^(-0.121) + 60.5*X^(-0.73) - 0.1839 = 0
>>>
>>> ?
>>>
>>> Is-it necessary to code a function ? from memory : dichotomy method,
>>> secant method, Brent one etc. ...
>>>
>>> Regards
>>>
>>> Paul
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121105/2820b7e2/attachment.htm>


More information about the users mailing list