Hi,

I think what Minh was trying to say is that these lines:

Stochastix wrote:
> sage: a=lambda x: alpha*x-mu1+mu2
> sage: f=lambda x: (a(x)*b-c+sqrt((a(x)*b-c)^2+4.0*a(x)*b*r*mu1))/(2*a
> (x)*mu1)
> sage: g=lambda x: (r+l-mu1*f(x))/mu2
> sage: prev=lambda x: f(x)/(f(x)+g(x))
> sage: k=lambda x: diff(prev(x),x)

should instead be written as

a = alpha*x-mu1+mu2
f = (a(x)*b-c+sqrt((a(x)*b-c)^2+4.0*a(x)*b*r*mu1))/(2*a(x)*mu1)
...

Or, if you prefer,

a(x) = alpha*x-mu1+mu2
f(x) = ...

etc.  When you define functions this way, they become elements of the
'SymbolicRing' which Sage has a lot of tools to deal with.  Defining
them with 'lambda' makes them pure Python functions, which are not as
flexible.

> sage: k(x).subs(x=0.03)
> 0.0262047639227205
> 
> 
> By the way, there is something still puzzling me. The equivalent Maple
> code gives a value of .883.
> Who should I believe ?
> 

If you fix the errors as above, do you still get different answers in
Maple and Sage?


Best,
Jason

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

Reply via email to