To get the value of 'x' from solve you can use the option
solultion_dict = true as follows:

sage: S = solve(derivative(f,x)==0,x, solution_dict=true)
sage: S[0][x]
tau0*log(tau1/tau0 + 1)
sage: S[0][x].subs(tau0=0.5, tau1=5.0)
1.19894763639919

Also, using the 'N' function will evaluate numerical expressions to a
desired level of accuracy

sage: N(S[0][x].subs(tau0=0.5, tau1=5.0), digits=25)
1.198947636399185334710182

-BFJ

On Mar 16, 5:32 pm, Jose Guzman <n...@neurohost.org> wrote:
> Hi everybody again.
>
> Does anybody if it is possible to use the result of the function solve
> to insert it in a function to resolve it analitically.
>
> For example, I want to get the peak of the following function
>
>  >>> var('tau0,tau1')
>  >>> f(x) = (1-e**(-x/tau0))*(e**(-x/tau1))
>
> For that, I simply derive it and equal to zero
>
>  >>> solve(derivative(f,x)==0,x)
>  >>> [x == tau0*log(tau1/tau0 + 1), e^(-(tau0 + tau1)*x/(tau0*tau1)) == 0]
>
> I would like to take the first expression of that list
>  >>> xpeak = solve(derivative(f,x)==0,x)[0]
>
> for example, to calculate its value when tau0=0.5 and tau1=5.0
>
>  >>> xpeak.subs(tau0=.5, tau1=5.0)
>
> but this returns a symbolic expresion ,
>
> >>> t == 0.500000000000000*log(11.0000000000000)
>
> and not the scalar 1.1989
>
> More importantly, I would like to use this expression to solve
> analytically the y value of that equation as a function of tau0 and tau1
>
> Any suggestion would be greatly appreciated!
>
> Best
>
> Jose.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to