[Scilab-users] 'fsolver'

Stéphane Mottelet stephane.mottelet at utc.fr
Wed Jan 27 17:17:57 CET 2016


Le 27/01/2016 16:54, fujimoto2005 a écrit :
> The feature of my f(x) defined for x>0 is as follows.
> f(x)<0 for x<x1
> f(x1)=0
> f(x) >0 for x1<x<x2
> f(x)=0 for x>=x2
>
> 'fsolver' gives some x such as x>x2 as a solution.
> I want to get x1 as a solution.
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/fsolver-tp4033340p4033345.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
A quick and dirty way of finding the minimum norm solution is to use 
lsqrsolve and to penalize the residual with the squared norm of the 
solution, like in this example (find one of the two closest to zero 
solution of cos(x)=0) :

function  res=f1(x)
   res=cos(x)
endfunction

function  res=f2(x, m)
   res=[f1(x)
        %eps^(1/4)*x]
endfunction

format(20)

[x1,v,info]=fsolve(0,f1)

disp(x1)

[x2,v,info]=lsqrsolve(0,f2,2)
[x1,v,info]=fsolve(x2,f1)

disp(x1)


But the main problem is the tuning of the penalization parameter. But when it works well, you can then start from x2, hoping that you are in the basin of attraction of your solution.


S.

-- 
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne -  CS 60319
60203 Compiègne cedex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160127/62c7cd4a/attachment.htm>


More information about the users mailing list