Ask Your Question
0

Differential of a integral?

asked 2019-10-24 19:17:51 +0100

serk12 gravatar image

updated 2020-06-01 14:44:34 +0100

FrédéricC gravatar image

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 flag offensive close merge delete

Comments

this indefinite integration seems not very easy !, wolfram alpha

ortollj gravatar imageortollj ( 2019-10-25 09:40:05 +0100 )edit

Works much faster if you express your question directly in Mathematica

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2019-10-25 12:12:25 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-10-25 09:22:24 +0100

Emmanuel Charpentier gravatar image

updated 2019-10-25 18:39:15 +0100

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,

edit flag offensive delete link more

Comments

Thank you so much for an answer so well developed

serk12 gravatar imageserk12 ( 2019-10-25 21:45:31 +0100 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2019-10-24 19:17:51 +0100

Seen: 658 times

Last updated: Oct 25 '19