[Scilab-users] use of fsolve

omorr at uns.ac.rs omorr at uns.ac.rs
Tue Sep 3 09:33:45 CEST 2013


Hello,

If I understood you well, you are asking to solve a polynomial in more
than one variable and to get all of the possible multiple solutions at
once. As far as I know, there is no easy way to get all of this
numerically. I do not believe there is a simple way to do that in Scilab
as well (I would like that I was wrong about it).

Maybe to try finding the solution using some symbolical engine (Maxima,
Maple, Mathematica...)

Regards,
Radovan

> Dear All
>
>
>
> Additional � silly � question : in the system herebellow, the solver finds
> 4
> values  (1 per variable), but we know there�s 4 couples of results due to
> the 2nd order ; of course the values depend on the starting point
>
>
>
> I feel there�s a strategy in order to find all the solution but I don�t
> know
> (or I don�t remember) how to proceed : any advice or reading in order to
> solve such kind of system ?
>
>
>
> Thanks
>
>
>
> Paul
>
>
>
> De : users-bounces at lists.scilab.org
> [mailto:users-bounces at lists.scilab.org]
> De la part de Radovan Omorjan
> Envoy� : lundi 2 septembre 2013 17:32
> � : International users mailing list for Scilab.
> Objet : Re: [Scilab-users] use of fsolve
>
>
>
> Hello,
>
> If you have some additional parameters in your function like this
>
> f(x,a,b..)=0
>
> searching x, then use list() in fsolve() calling with the function name as
> the first argument and parameters as subsequent arguments - like this f.e.
>
> clc, clear
> function f=foo(x, cst, R_)
>     f(1) = (x(3) - cst(3))*(x(3) - x(1)) + (x(4) - cst(4))*(x(4) - x(2)) ;
>     f(2) = (x(1) - cst(1))*(x(3) - x(1)) + (x(2) - cst(2))*(x(4) - x(2)) ;
>     f(3) = (x(1) - cst(1))^2 + (x(2) - cst(2))^2 - R_(1)^2 ;
>     f(4) = (x(3) - cst(3))^2 + (x(4) - cst(4))^2 - R_(2)^2 ;
> endfunction
>
> // constants
> a = [106 ; 30 ; 54 ; 15] //a would be cst
> b = [9 ; 9]              //b would be R_
>
> //Initial guess
>  x1 = zeros(4,1)
>
> // calculation using fsolve
> // ind - termination indicator
> // x - solution
> // f - function values at the solution
> [x,f,ind] = fsolve(x1,list(foo,a,b))
>
> Regards,
> Radovan
>
> On 9/2/2013 3:32 PM, Carrico, Paul wrote:
>
> Dear All
> A basic question : what is the correct synthax is order to call the
> constants cst and R_ in the foo function ? do I need to use "global"
> variable ?
> Thanks
> Paul
> function [f, ind]=foo(x, cst, R_, ind)
>     f(1) = (x(3) - cst(3))*(x(3) - x(1)) + (x(4) - cst(4))*(x(4) - x(2)) ;
>     f(2) = (x(1) - cst(1))*(x(3) - x(1)) + (x(2) - cst(2))*(x(4) - x(2)) ;
>     f(3) = (x(1) - cst(1))^2 + (x(2) - cst(2))^2 - R_(1)^2 ;
>     f(4) = (x(3) - cst(3))^2 + (x(4) - cst(4))^2 - R_(2)^2 ;
> endfunction
>
> function [f, ind]=foo2(x, ind)
>     cst = [106 ; 30 ; 54 ; 15]
>     R_ = [9 ; 9]
>     f(1) = (x(3) - cst(3))*(x(3) - x(1)) + (x(4) - cst(4))*(x(4) - x(2)) ;
>     f(2) = (x(1) - cst(1))*(x(3) - x(1)) + (x(2) - cst(2))*(x(4) - x(2)) ;
>     f(3) = (x(1) - cst(1))^2 + (x(2) - cst(2))^2 - R_(1)^2 ;
>     f(4) = (x(3) - cst(3))^2 + (x(4) - cst(4))^2 - R_(2)^2 ;
> endfunction
>
> // constants
> cst = [106 ; 30 ; 54 ; 15]
> R_ = [9 ; 9]
>
> x0 = cst
> x1 = zeros(4,1)
>
> // calculationusing fsolve
> T1 = fsolve(x0,foo)
> T2 = fsolve(x1,foo2)
>
>
>
> ----------------------------------------------------------------------------
> ----
>
>
> Le pr�sent mail et ses pi�ces jointes sont confidentiels et destin�s � la
> personne ou aux personnes vis�e(s) ci-dessus. Si vous avez re�u cet e-mail
> par erreur, veuillez contacter imm�diatement l'exp�diteur et effacer le
> message de votre syst�me. Toute divulgation, copie ou distribution de cet
> e-mail est strictement interdite.
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error, please contact the sender and
> delete the email from your system. If you are not the named addressee you
> should not disseminate, distribute or copy this email.
>
>
>
>
> _______________________________________________
> 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
>





More information about the users mailing list