ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 24 Mar 2015 20:05:13 -0500Compact output of solution of DEhttps://ask.sagemath.org/question/26316/compact-output-of-solution-of-de/ When I'm trying to solve DE:
t = var('t')
y = function('y', t)
de = t*(y^2)*diff(y,t) + y^3 == 1
sol = desolve(de,[y,t], [1,2])
the output is pretty ugly:
-1/3*log(y(t)^2 + y(t) + 1) - 1/3*log(y(t) - 1) == -1/3*log(7) + log(t)
When I'm solving this in matlab:
clear;
syms y(t)
y(t) = dsolve(t*(y^2)*diff(y,t) + y^3 == 1, y(1) ==2)
The output looks much better:
y(t) = (exp(log(7) - 3*log(t)) + 1)^(1/3)
Can I see output in sage looking similiar to this from matlab? Simplify(sol) dosen't work. Maybe I've made mistake somewhere, but I can't determine without knowing the form y(t) from sage.
And btw, typing:
t*(y^2)*y'+ y^3 = 1, y(1) = 2
into wolframalpha.com results yet another solution. I'm lost...Tue, 24 Mar 2015 15:51:52 -0500https://ask.sagemath.org/question/26316/compact-output-of-solution-of-de/Comment by kcrisman for <p>When I'm trying to solve DE:</p>
<pre><code>t = var('t')
y = function('y', t)
de = t*(y^2)*diff(y,t) + y^3 == 1
sol = desolve(de,[y,t], [1,2])
</code></pre>
<p>the output is pretty ugly:</p>
<pre><code>-1/3*log(y(t)^2 + y(t) + 1) - 1/3*log(y(t) - 1) == -1/3*log(7) + log(t)
</code></pre>
<p>When I'm solving this in matlab:</p>
<pre><code>clear;
syms y(t)
y(t) = dsolve(t*(y^2)*diff(y,t) + y^3 == 1, y(1) ==2)
</code></pre>
<p>The output looks much better:</p>
<pre><code>y(t) = (exp(log(7) - 3*log(t)) + 1)^(1/3)
</code></pre>
<p>Can I see output in sage looking similiar to this from matlab? Simplify(sol) dosen't work. Maybe I've made mistake somewhere, but I can't determine without knowing the form y(t) from sage.</p>
<p>And btw, typing:</p>
<pre><code>t*(y^2)*y'+ y^3 = 1, y(1) = 2
</code></pre>
<p>into <a href="http://wolframalpha.com">wolframalpha.com</a> results yet another solution. I'm lost...</p>
https://ask.sagemath.org/question/26316/compact-output-of-solution-of-de/?comment=26318#post-id-26318This is the standard output form from Maxima (the engine that does such symbolics inside Sage). Various combos using `log_simplify('all')` and `expand_*` didn't help, though...Tue, 24 Mar 2015 20:05:13 -0500https://ask.sagemath.org/question/26316/compact-output-of-solution-of-de/?comment=26318#post-id-26318