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.Sun, 23 Oct 2016 20:27:25 +0200Sage won't solve a symbolic equation unless it is in a specific form.https://ask.sagemath.org/question/35234/sage-wont-solve-a-symbolic-equation-unless-it-is-in-a-specific-form/ I am trying to get sage to solve for the intersection of two Gaussian distributions. Using the solve command does not yield an answer unless I more the exponential terms to both sides. I am trying to solve for the variable y. here is the code:
eqn =1/(sqrt(2*pi*N))*exp(-y^2/(2*N)) == 1/(sqrt(2*pi*(N+P)))*exp(-y^2/(2*(N+P)))
solve(eqn, y)
this results in:
[e^(1/2*y^2/(N + P)) == sqrt(pi*N)*e^(1/2*y^2/N)/sqrt(pi*N + pi*P)]
Which doesn't solve for y.
However If before calling solve I divide both sides by one of the exponentials, the solve functions works as expected.
solve(eqn/exp(-y^2/(2*N)), y)
which yields:
[y == -sqrt(2*N*log(sqrt(pi*N + pi*P)/sqrt(pi*N)) + 2*N^2*log(sqrt(pi*N
+ pi*P)/sqrt(pi*N))/P), y == sqrt(2*N*log(sqrt(pi*N + pi*P)/sqrt(pi*N))
+ 2*N^2*log(sqrt(pi*N + pi*P)/sqrt(pi*N))/P)]
Is this a bug? or am I missing something?Sun, 23 Oct 2016 17:37:48 +0200https://ask.sagemath.org/question/35234/sage-wont-solve-a-symbolic-equation-unless-it-is-in-a-specific-form/Comment by mforets for <p>I am trying to get sage to solve for the intersection of two Gaussian distributions. Using the solve command does not yield an answer unless I more the exponential terms to both sides. I am trying to solve for the variable y. here is the code:</p>
<pre><code>eqn =1/(sqrt(2*pi*N))*exp(-y^2/(2*N)) == 1/(sqrt(2*pi*(N+P)))*exp(-y^2/(2*(N+P)))
solve(eqn, y)
</code></pre>
<p>this results in:</p>
<pre><code>[e^(1/2*y^2/(N + P)) == sqrt(pi*N)*e^(1/2*y^2/N)/sqrt(pi*N + pi*P)]
</code></pre>
<p>Which doesn't solve for y.</p>
<p>However If before calling solve I divide both sides by one of the exponentials, the solve functions works as expected.</p>
<pre><code>solve(eqn/exp(-y^2/(2*N)), y)
</code></pre>
<p>which yields:</p>
<pre><code>[y == -sqrt(2*N*log(sqrt(pi*N + pi*P)/sqrt(pi*N)) + 2*N^2*log(sqrt(pi*N
+ pi*P)/sqrt(pi*N))/P), y == sqrt(2*N*log(sqrt(pi*N + pi*P)/sqrt(pi*N))
+ 2*N^2*log(sqrt(pi*N + pi*P)/sqrt(pi*N))/P)]
</code></pre>
<p>Is this a bug? or am I missing something?</p>
https://ask.sagemath.org/question/35234/sage-wont-solve-a-symbolic-equation-unless-it-is-in-a-specific-form/?comment=35235#post-id-35235I don't know what's missing, but it does work with [Sympy's solve](http://docs.sympy.org/dev/modules/solvers/solvers.html) function.Sun, 23 Oct 2016 20:27:25 +0200https://ask.sagemath.org/question/35234/sage-wont-solve-a-symbolic-equation-unless-it-is-in-a-specific-form/?comment=35235#post-id-35235