![]() | 1 | initial version |
The solution you get does not evaluate the integrals, which are held
expressins. The simplest way to force their evaluation is :
sage: solution.unhold()
Warning: piecewise indefinite integration does not return a continuous antiderivative
Warning: piecewise indefinite integration does not return a continuous antiderivative
1/36*(9*(2*t*e^(2*t) - 5*e^6 - e^(2*t))*e^t*heaviside(t - 3) - 4*(3*t*e^(3*t) - 8*e^9 - e^(3*t))*heaviside(t - 3))*e^(-3*t) + 6*e^(-2*t) - 4*e^(-3*t)
136(9(2te(2t)−5e6−e(2t))etH(t−3)−4(3te(3t)−8e9−e(3t))H(t−3))e(−3t)+6e(−2t)−4e(−3t)
Thi works if and only if Sage is able to get a closed form of your integrals ; otherwise, it will return the held form...
Another way to force these evaluations is to evaluate the string representation of your representation :
sage: eval(preparse(repr(solution)))
Warning: piecewise indefinite integration does not return a continuous antiderivative
Warning: piecewise indefinite integration does not return a continuous antiderivative
1/36*(9*(2*t*e^(2*t) - 5*e^6 - e^(2*t))*e^t*heaviside(t - 3) - 4*(3*t*e^(3*t) - 8*e^9 - e^(3*t))*heaviside(t - 3))*e^(-3*t) + 6*e^(-2*t) - 4*e^(-3*t)
136(9(2te(2t)−5e6−e(2t))etH(t−3)−4(3te(3t)−8e9−e(3t))H(t−3))e(−3t)+6e(−2t)−4e(−3t)
In that specific case, you may also convert it to sympy, where the doit()
method allows for such a re-evaluation :
sage: solution._sympy_().doit()._sage_()
1/36*(9*(2*t*e^(2*t) - 5*e^6 - e^(2*t))*e^t*heaviside(t - 3) - 4*(3*t*e^(3*t) - 8*e^9 - e^(3*t))*heaviside(t - 3))*e^(-3*t) + 6*e^(-2*t) - 4*e^(-3*t)
136(9(2te(2t)−5e6−e(2t))etH(t−3)−4(3te(3t)−8e9−e(3t))H(t−3))e(−3t)+6e(−2t)−4e(−3t)
BTW :
sage: import sympy
sage: sympy.dsolve(equation._sympy_())._sage_()
y(t) == -1/4*(5*e^6*heaviside(t - 3) - 4*C1)*e^(-2*t) + 1/9*(8*e^9*heaviside(t - 3) + 9*C2)*e^(-3*t) + 1/6*t*heaviside(t - 3) - 5/36*heaviside(t - 3)
y(t)=−14(5e6H(t−3)−4C1)e(−2t)+19(8e9H(t−3)+9C2)e(−3t)+16tH(t−3)−536H(t−3)
(Converting the boundary condituions to sympy is a tad intricate...).
Such conversions to other CAS may be helpful if this CAS is able to gett a closed form of these integral. But that may entail further work to convert these closed forms back to Sage :
sage: solution._mathematica_().sage(locals={"HeavisideTheta":heaviside})
1/36*(9*((2*t - 1)*e^(2*t) - 5*e^6)*e^t*heaviside(t - 3) - 4*((3*t - 1)*e^(3*t) - 8*e^9)*heaviside(t - 3))*e^(-3*t) + 6*e^(-2*t) - 4*e^(-3*t)
136(9((2t−1)e(2t)−5e6)etH(t−3)−4((3t−1)e(3t)−8e9)H(t−3))e(−3t)+6e(−2t)−4e(−3t)
HTH,