Hello,

Here is the script :

var('epsilon t')
y=function('y')(t)

de = diff(y,t,2)+2*epsilon*diff(y,t,1)+y == 0

assume(epsilon<1)
assume(epsilon>-1)
u(t) = desolve(de,y,ivar=t)

var('k_1')
sol=solve(diff(u(t).subs(_K2=0),t).subs(t=0).subs(_K1=k_1)==1,k_1)
sol.rhs().simplify_full()

u(t).subs(_K2=0).subs(_K1=sol.rhs().simplify_full())


2e^(-epsilont)sin(1/2sqrt(-4epsilon^2 + 4)t)/sqrt(-4*epsilon^2 + 4)

but

(u(t).subs(_K2=0).subs(_K1=sol.rhs().simplify_full())).canonicalize_radical()


e^(-epsilont)sinh(sqrt(epsilon + 1)sqrt(epsilon - 1)t)/(sqrt(epsilon + 1)*sqrt(epsilon - 1))

Could anyone tell me why ?

Thank you

edit retag close merge delete

Hint :

sage: sinh(I*x)
I*sin(x)
sage: sin(I*x)
I*sinh(x)


Also, see ?exponentialize.

And remember that Sage tends to rewrite some expressions "his way", no matter what...

Sort by » oldest newest most voted

Sage is somewhat recalcitrant to work with power (inluding radix) simplification,for excellent reasons. Similarly, it tends to pull imaginary quantities out of trig/hyperbolic functions (see remark above).

After

var('epsilon t')
y=function('y')(t)
de = diff(y,t,2)+2*epsilon*diff(y,t,1)+y == 0
assume(epsilon<1)
assume(epsilon>-1)
u(t) = desolve(de,y,ivar=t)
var('k_1')
sol=solve(diff(u(t).subs(_K2=0),t).subs(t=0).subs(_K1=k_1)==1,k_1)
sol.rhs().simplify_full()
E1=u(t).subs(_K2=0).subs(_K1=sol.rhs().simplify_full())


E1/E2 is

$$\frac{2 \, \sqrt{\epsilon + 1} \sqrt{\epsilon - 1} \sin\left(\frac{1}{2} \, \sqrt{-4 \, \epsilon^{2} + 4} t\right)}{\sqrt{-4 \, \epsilon^{2} + 4} \sinh\left(\sqrt{\epsilon + 1} \sqrt{\epsilon - 1} t\right)}$$

but giac somewhat recklessly can deduce :

sage: (E2/E1)._giac_().simplify()._sage_().factor()
1


HTH,

more