[scilab-Users] Solving multi-variable function

Eric Dubois grocer.toolbox at gmail.com
Thu Mar 13 20:46:42 CET 2008


Unfortunately, the function is not available at the provided address...

Did you provide values to ret_age, mu_tree, delta_t, sigma_b, in order to
feed the optimization program?

Eric.


2008/3/13, Jerry Wang <jerrwang at yahoo.com>:
>
> I did attempt to collapse the 4 variables into a single vector array but I
> received an error after fsolve reaches the end of the first iteration.  The
> error is:
>
> !--error 98
>  variable returned by scilab argument function is incorrect
>
>  --------------------------------------
> I add the function into the scope via:
> --------------------------------------
>     getf('func_for_fsolve.sci');
>
>  --------------------------------------
> I call the function via:
>  --------------------------------------
>     [x_result,v,info]=fsolve([ret_age, mu_tree, delta_t,
> sigma_b],func_for_fsolve);
>
>  --------------------------------------
> Inside func_for_solve I have:
>  --------------------------------------
> function [y] = func_for_fsolve ( x0 )
> ...
> ret_age = round(x0(1));
> mu_tree = x0(2);
> delta_t = x0(3);
> sigma_b = x0(4);
> ...
> [statistical_sustainable] =
> ABSPredictor(mc,now_age,ret_age,mu_tree,delta_t,sigma_b);
> ...
> y = abs(statistical_sustainable(index)./100 - 0.90);
> ...
> y = y + penalties;
> disp('testing123');
> disp('testing234');
> endfunction
>
> --------------------------------------
> --------------------------------------
>
> I tried testing the code by reducing the supplied argument x0 into 1
> scalar variable instead of the 4 scalar vector, and the function call
> worked.  That's why I went ahead and assumed that fsolve takes only one
> variables.  Can you see what I am doing wrong that's causing me to receive:
>  !--error 98
>  variable returned by scilab argument function is incorrect
>
>
> Thank you!
>
> Jerry
>
> ps. the complete func_for_fsolve.sci is uploaded here for your viewing:
> http://www.imagingspot.com/scilab/func_for_fsolve.sci
>
>
>
>
> ----- Original Message ----
> From: Eric Dubois <grocer.toolbox at gmail.com>
> To: users at lists.scilab.org
> Sent: Thursday, March 13, 2008 5:41:21 AM
> Subject: Re: [scilab-Users] Solving multi-variable function
>
> Fsolve takes one variable input, but the input can be a vector of any
> size.
>
> So, collapse your 4 variables into a single vector and adapt your fonction
> accordingly.
>
> Eric.
>
>
> 2008/3/13, Jerry Wang <jerrwang at yahoo.com>:
> >
> >  Hello Scilab-ers,
> >
> > Can any one point me to the right direction?  I want to find the zero
> > point of a function that has 4 variables.  I want scilab to solve for the
> > values of the 4 variables that would give me a result = 0 for the answer.  I
> > initially tried fsolve, but I discovered that fsolve only take one variable
> > input.
> >
> > Any thoughts?  Thanks!
> >
> > Jerry
> >
> > ------------------------------
> > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
> > it now.<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ>
> >
>
>
>
> ------------------------------
> Never miss a thing. Make Yahoo your homepage.<http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20080313/79d08c5d/attachment.htm>


More information about the users mailing list