ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 17 Dec 2015 19:19:28 +0100Logarithms and desolvehttps://ask.sagemath.org/question/31560/logarithms-and-desolve/ More questions about desolve results:
Using
y = function('y', x)
desolve(diff(y,x) == y*(100-y), y)
results in the solution:
-1/100*log(y(x) - 100) + 1/100*log(y(x)) == _C + x
But that solution does not work for y<100. But it is correct if you assume that it should be log(abs(y(x)-100)) in the first term. Is the abs() implicit?
(The log terms actually comes from the integral of 1/y and 1/(100-y) so it should be absolute values.)Mon, 14 Dec 2015 15:41:29 +0100https://ask.sagemath.org/question/31560/logarithms-and-desolve/Comment by AndersM for <p>More questions about desolve results:
Using</p>
<pre><code> y = function('y', x)
desolve(diff(y,x) == y*(100-y), y)
</code></pre>
<p>results in the solution:</p>
<pre><code>-1/100*log(y(x) - 100) + 1/100*log(y(x)) == _C + x
</code></pre>
<p>But that solution does not work for y<100. But it is correct if you assume that it should be log(abs(y(x)-100)) in the first term. Is the abs() implicit?</p>
<p>(The log terms actually comes from the integral of 1/y and 1/(100-y) so it should be absolute values.)</p>
https://ask.sagemath.org/question/31560/logarithms-and-desolve/?comment=31610#post-id-31610Testing:
assume(x<0)
integral(1/x,x)
And the result is log(x). Hm...Wed, 16 Dec 2015 20:51:09 +0100https://ask.sagemath.org/question/31560/logarithms-and-desolve/?comment=31610#post-id-31610Answer by kcrisman for <p>More questions about desolve results:
Using</p>
<pre><code> y = function('y', x)
desolve(diff(y,x) == y*(100-y), y)
</code></pre>
<p>results in the solution:</p>
<pre><code>-1/100*log(y(x) - 100) + 1/100*log(y(x)) == _C + x
</code></pre>
<p>But that solution does not work for y<100. But it is correct if you assume that it should be log(abs(y(x)-100)) in the first term. Is the abs() implicit?</p>
<p>(The log terms actually comes from the integral of 1/y and 1/(100-y) so it should be absolute values.)</p>
https://ask.sagemath.org/question/31560/logarithms-and-desolve/?answer=31627#post-id-31627`log` is a multivalued function. Most CASes will return `log(x)` and not `log(abs(x))` as the antiderivative of `1/x`. So that is probably the situation here - it is true in the multivalued sense?
Edit: here's how to set that maxima variable - but you have to do it in the "calculus" copy of Maxima inside Sage.
sage: integral(1/x,x)
log(x)
sage: maxima.eval(" logabs:true")
'true'
sage: integral(1/x,x)
log(x)
sage: maxima_calculus.eval(" logabs:true")
'true'
sage: integral(1/x,x)
log(abs(x))Thu, 17 Dec 2015 04:29:06 +0100https://ask.sagemath.org/question/31560/logarithms-and-desolve/?answer=31627#post-id-31627Comment by AndersM for <p><code>log</code> is a multivalued function. Most CASes will return <code>log(x)</code> and not <code>log(abs(x))</code> as the antiderivative of <code>1/x</code>. So that is probably the situation here - it is true in the multivalued sense? </p>
<p>Edit: here's how to set that maxima variable - but you have to do it in the "calculus" copy of Maxima inside Sage.</p>
<pre><code>sage: integral(1/x,x)
log(x)
sage: maxima.eval(" logabs:true")
'true'
sage: integral(1/x,x)
log(x)
sage: maxima_calculus.eval(" logabs:true")
'true'
sage: integral(1/x,x)
log(abs(x))
</code></pre>
https://ask.sagemath.org/question/31560/logarithms-and-desolve/?comment=31645#post-id-31645I found that it is possible to set a option variable in Maxima to get the log(abs(x)) answer when doing integrals http://maxima.sourceforge.net/docs/manual/maxima_10.html . Can you set that variable to True in Sage.Thu, 17 Dec 2015 09:36:44 +0100https://ask.sagemath.org/question/31560/logarithms-and-desolve/?comment=31645#post-id-31645Comment by AndersM for <p><code>log</code> is a multivalued function. Most CASes will return <code>log(x)</code> and not <code>log(abs(x))</code> as the antiderivative of <code>1/x</code>. So that is probably the situation here - it is true in the multivalued sense? </p>
<p>Edit: here's how to set that maxima variable - but you have to do it in the "calculus" copy of Maxima inside Sage.</p>
<pre><code>sage: integral(1/x,x)
log(x)
sage: maxima.eval(" logabs:true")
'true'
sage: integral(1/x,x)
log(x)
sage: maxima_calculus.eval(" logabs:true")
'true'
sage: integral(1/x,x)
log(abs(x))
</code></pre>
https://ask.sagemath.org/question/31560/logarithms-and-desolve/?comment=31661#post-id-31661Thanks!
It even worked in Sage Cell Server.Thu, 17 Dec 2015 19:19:28 +0100https://ask.sagemath.org/question/31560/logarithms-and-desolve/?comment=31661#post-id-31661