Here's the code I'm using: (theta_array is just a dummy for the real
thing, but the errors are the same)

theta_array = [(0,0),(1,2),(pi/2,pi),(pi,4),(3*pi/2,5),(2*pi,2*pi)]
s = spline(theta_array)
ellipse(x) = e^(i*x)-.5*e^(-i*x)
z(t) = ellipse(t)
zprime(t) = derivative(z)
def u(x,b):
    return real(zprime(x)/(z(x)-b)*e^(i*s(x)))

def v(x,b):
    return imag(zprime(x)/(z(x)-b)*e^(i*s(x)))

def f(b):
    return 1/(2*pi*i)*(integral_numerical(u(x,b),0,2*pi)+ i *
integral_numerical(v(x,b),0,2*pi))

f(0)

I'm trying to compute the complex integral from 0 to 2*pi of zprime(t)/
(z(t)-b)*e^(i*s(t))dt

I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/evlutte/.sage/sage_notebook/worksheets/admin/27/code/
34.py", line 21, in <module>
    f(_sage_const_0 )
  File "/home/evlutte/opt/sage-3.2.3/local/lib/python2.5/site-packages/
SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module>

  File "/home/evlutte/.sage/sage_notebook/worksheets/admin/27/code/
34.py", line 19, in f
    return _sage_const_1 /(_sage_const_2 *pi*i)*(integral_numerical(u
(x,b),_sage_const_0 ,_sage_const_2 *pi)+ i * integral_numerical(v
(x,b),_sage_const_0 ,_sage_const_2 *pi))
  File "/home/evlutte/.sage/sage_notebook/worksheets/admin/27/code/
34.py", line 13, in u
    return real(zprime(x)/(z(x)-b)*e**(i*s(x)))
  File "interpolation.pyx", line 97, in
sage.gsl.interpolation.Spline.__call__ (sage/gsl/interpolation.c:1598)
  File "expression.pyx", line 869, in
sage.symbolic.expression.Expression.__float__ (sage/symbolic/
expression.cpp:5679)
TypeError: float() argument must be a string or a number

I guess that sage is trying to evaluate the integral before
substituting the value for b. Is this correct? How can I get around
this?

Thanks for any help you can give.

Ethan
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to