Ask Your Question
1

crash on integral attempt

asked 2015-03-27 21:02:26 +0200

beeson gravatar image

updated 2015-03-27 22:17:40 +0200

vdelecroix gravatar image

Sage version 6.5 app on Mac OS 10.95. Following code tries to evaluate the total curvature of a certain space curve. The answer should be given as a complete elliptic integral of the second kind (which I then hoped to numerically evaluate for a range of values of r). But I get "Error executing code in Maxima".

r,t = var('r,t')
assume(r > 0)
X = vector((r * cos(t) - (1/3)* r^3 * cos(3*t), 
             - r * sin(t) - (1/3) *r^3 * sin(3*t),
             r^2 *cos(2*t)))
Xtheta = X.diff(t)
AbsXtheta = abs(Xtheta)
T = (1/AbsXtheta) * Xtheta    ## unit tangent
kappa = abs(T.diff(t))
kappa = kappa.expand().trig_simplify().canonicalize_radical()
print(kappa)
Curvature = integral(kappa,t,0,2*pi)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-03-27 23:07:53 +0200

tmonteil gravatar image

updated 2015-03-27 23:14:41 +0200

If you final aim is to numerically evaluate for a range of values of r, you can do the following:

sage: Curvature = lambda r : numerical_integral(kappa(r=r),0,2*pi)

This defines Curvature as a function of r that computes the integral numerically. Then you can do:

sage: Curvature(2)
(16.716333138156095, 4.079736172387635e-10)
sage: Curvature(10)
(18.745787025936806, 2.081200437091458e-13)

The second value is an estimation of the error, if you just want the approximated value of the integral, you can do:

sage: Curvature = lambda r : numerical_integral(kappa(r=r),0,2*pi)[0]
sage: Curvature(2)
16.716333138156095
edit flag offensive delete link more
0

answered 2015-03-28 07:51:42 +0200

nbruin gravatar image

It doesn't help resolving the question immediately, but it seems the problem here is maxima's "abs_integrate" package. In maxima:

(%i1) display2d:false;
(%o1) false
(%i2) integrate(sqrt(16*r^2*sin(t)^4 + 9*r^4 - 16*r^2*sin(t)^2 + 10*r^2 + 1)/(r^2 + 1),t,0,2*%pi);
(%o2) ('integrate(sqrt(16*r^2*sin(t)^4-16*r^2*sin(t)^2+9*r^4+10*r^2+1),t,0,2*%pi)) /(r^2+1)
(%i3) load(abs_integrate);
(%o3) "/usr/local/sage/sage-git/local/share/maxima/5.34.1/share/contrib/integration/abs_integrate.mac"
(%i4) integrate(sqrt(16*r^2*sin(t)^4 + 9*r^4 - 16*r^2*sin(t)^2 + 10*r^2 + 1)/(r^2 + 1),t,0,2*%pi);
sign: argument cannot be imaginary; found %i
#0: intfudu(exp=sqrt(9*r^4*%e^-(4*%i*t)+8*r^2*%e^-(4*%i*t)+%e^-(4*%i*t)+r^2*%e^-(8*%i*t)+r^2)*%e^(2*%i*t),%voi=t (partition.mac line 95)
#1: extra_integrate(q=sqrt(9*r^4*%e^-(4*%i*t)+8*r^2*%e^-(4*%i*t)+%e^-(4*%i*t)+r^2*%e^(8*%i*t)+r^2)*%e^(2*%i*t),x=t)
 -- an error. To debug this try: debugmode(true);

so, it doesn't seem within maxima's current capabilities to express this integral into functions that allow for more efficient approximation methods.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-03-27 21:02:26 +0200

Seen: 511 times

Last updated: Mar 28 '15