# Differential of a integral?

So I'm trying to calculate the frenet thrihedrom in the "clasic" way, (doing an arc length and his integrals) but sage don't let me do a diff of a integral. Here ismy code:

var('t, n')
assume(n > 0)
c=vector((t,t**2,t**3))

l=sqrt(1+4*t*t+9*t**4)
L= l.integral(t, 0, n)

C=vector((t/L,(t/L)**2,(t/L)**3))
T=C.diff(t)

I get this error:

AttributeError: 'sage.rings.rational.Rational' object has no attribute 'diff'

Any idea of how to do a Diff of a integral?

edit retag close merge delete

this indefinite integration seems not very easy !, wolfram alpha

( 2019-10-25 09:40:05 +0200 )edit

Works much faster if you express your question directly in Mathematica

( 2019-10-25 12:12:25 +0200 )edit

Sort by » oldest newest most voted

I'm no sure I understand the error message. Might be a bug.

I forwarded a (minimal case of) your question to sage-support.

EDIT : Yes, that's a bug, nicely explained by Nils Bruin on sage-support. The rest of my answer is still valid, though...

EDIT 2 : This is now Trac#28656.

The sticking point is that neither Maxima, Sympy, Giac nor Fricas can compute L explicitely. It turns out that you may work around the problem and use sage to compute your expression, by replacing L by a formal function and defining l by its differential:

sage: L=function("L")
sage: l(t)=diff(L(t),t)
sage: C=vector((t/L(t), (t/L(t))^2, (t/L(t))^3))
sage: C.diff(t).subs(diff(L(t), t)==f(t))
(-t*f(t)/L(t)^2 + 1/L(t), -2*t^2*f(t)/L(t)^3 + 2*t/L(t)^2, -3*t^3*f(t)/L(t)^4 + 3*t^2/L(t)^3)

Now, if you can obtain an expression for L, you may substitute in the latter expression.

It turns out that:

sage: mathematica.Integrate(sqrt(1+4*t*t+9*t**4),t)
(27*Sqrt[(-I)/(-2*I + Sqrt[5])]*t*(1 + 4*t^2 + 9*t^4) -
4*(2*I + Sqrt[5])*Sqrt[(-2*I + Sqrt[5] - (9*I)*t^2)/(-2*I + Sqrt[5])]*
Sqrt[(2*I + Sqrt[5] + (9*I)*t^2)/(2*I + Sqrt[5])]*
EllipticE[I*ArcSinh[3*Sqrt[(-I)/(-2*I + Sqrt[5])]*t],
(2*I - Sqrt[5])/(2*I + Sqrt[5])] + 2*(-5*I + 2*Sqrt[5])*
Sqrt[(-2*I + Sqrt[5] - (9*I)*t^2)/(-2*I + Sqrt[5])]*
Sqrt[(2*I + Sqrt[5] + (9*I)*t^2)/(2*I + Sqrt[5])]*
EllipticF[I*ArcSinh[3*Sqrt[(-I)/(-2*I + Sqrt[5])]*t],
(2*I - Sqrt[5])/(2*I + Sqrt[5])])/(81*Sqrt[(-I)/(-2*I + Sqrt[5])]*
Sqrt[1 + 4*t^2 + 9*t^4])

(i. e. $$\frac{2 \left(2 \sqrt{5}-5 i\right) \sqrt{\frac{-9 i t^2+\sqrt{5}-2 i}{\sqrt{5}-2 i}} \sqrt{\frac{9 i t^2+\sqrt{5}+2 i}{\sqrt{5}+2 i}} F\left(i \sinh ^{-1}\left(3 \sqrt{-\frac{i}{-2 i+\sqrt{5}}} t\right)|\frac{2 i-\sqrt{5}}{2 i+\sqrt{5}}\right)-4 \left(\sqrt{5}+2 i\right) \sqrt{\frac{-9 i t^2+\sqrt{5}-2 i}{\sqrt{5}-2 i}} \sqrt{\frac{9 i t^2+\sqrt{5}+2 i}{\sqrt{5}+2 i}} E\left(i \sinh ^{-1}\left(3 \sqrt{-\frac{i}{-2 i+\sqrt{5}}} t\right)|\frac{2 i-\sqrt{5}}{2 i+\sqrt{5}}\right)+27 \sqrt{-\frac{i}{\sqrt{5}-2 i}} t \left(9 t^4+4 t^2+1\right)}{81 \sqrt{-\frac{i}{\sqrt{5}-2 i}} \sqrt{9 t^4+4 t^2+1}}$$), but also that Sage can't (yet) translate this back to sage...

(BTW :

sage: mathematica.FullSimplify(mathematica.Integrate(sqrt(1+4*t*t+9*t**4),t))
(9*(t + 4*t^3 + 9*t^5) - (2*Sqrt[1 + (2 - I*Sqrt[5])*t^2]*
Sqrt[1 + (2 + I*Sqrt[5])*t^2]*
(2*(2*I + Sqrt[5])*EllipticE[ArcSin[t*Root[9 + 4*#1^2 + #1^4 & , 4, 0]],
-1/9 + ((4*I)/9)*Sqrt[5]] + (5*I - 2*Sqrt[5])*
EllipticF[ArcSin[t*Root[9 + 4*#1^2 + #1^4 & , 4, 0]],
-1/9 + ((4*I)/9)*Sqrt[5]]))/Sqrt[2 - I*Sqrt[5]])/
(27*Sqrt[1 + 4*t^2 + 9*t^4])

, a bit simpler...)

The rest is left to the reader as an exercise (and because I'm running late...:-).

HTH,

more

Thank you so much for an answer so well developed

( 2019-10-25 21:45:31 +0200 )edit