Thanks. Unfortunately, for my particular example, it didn't work as is

----------------------------------------------------------------------
| Sage Version 4.2, Release Date: 2009-10-24                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: alpha=700
sage: mu1=0.1
sage: mu2=0.2
sage: pI=0.8
sage: l=5
sage: r=1.0
sage: b=r+l
sage: c=r*mu1+l*(1-pI)*mu2
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)
sage: k(x=0.03)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call
last)

/Applications/sage/<ipython console> in <module>()

/Applications/sage/<ipython console> in <lambda>(x)

/Applications/sage/local/lib/python2.6/site-packages/sage/calculus/
functional.pyc in derivative(f, *args, **kwds)
    133     if not isinstance(f, Expression):
    134         f = SR(f)
--> 135     return f.derivative(*args, **kwds)
    136
    137 diff = derivative

/Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
expression.so in sage.symbolic.expression.Expression.derivative (sage/
symbolic/expression.cpp:11427)()

/Applications/sage/local/lib/python2.6/site-packages/sage/misc/
derivative.so in sage.misc.derivative.multi_derivative (sage/misc/
derivative.c:2175)()

/Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
expression.so in sage.symbolic.expression.Expression._derivative (sage/
symbolic/expression.cpp:11721)()

TypeError: argument symb must be a symbol


I had to type

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 ?
-- 
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