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, 22 May 2016 09:48:37 +0200Bug in sage solvehttps://ask.sagemath.org/question/33487/bug-in-sage-solve/ Sage raises an error when I try to solve the following:
`solve(a*exp(k*2) - n, a*exp(k*8)-m, a, k, solution_dict=True)`
What is the reason for this?
Sat, 21 May 2016 09:09:31 +0200https://ask.sagemath.org/question/33487/bug-in-sage-solve/Answer by calc314 for <p>Sage raises an error when I try to solve the following:</p>
<p><code>solve(a*exp(k*2) - n, a*exp(k*8)-m, a, k, solution_dict=True)</code></p>
<p>What is the reason for this?</p>
https://ask.sagemath.org/question/33487/bug-in-sage-solve/?answer=33489#post-id-33489 You need to define the variables using the `var` command. Also, the syntax for `solve` is slightly different.
var('a k n m')
solve([a*exp(k*2) - n==0, a*exp(k*8)-m==0], [a, k], solution_dict=True)
Unfortunately, Sage (which uses Maxima for this) does not solve the equation.
However, sympy does a nice job of solving here.
var('a k n m')
import sympy as sp
sp.solve([a*exp(k*2) - n, a*exp(k*8)-m], [a, k],dict=True)
Sat, 21 May 2016 14:17:59 +0200https://ask.sagemath.org/question/33487/bug-in-sage-solve/?answer=33489#post-id-33489Comment by proy for <p>You need to define the variables using the <code>var</code> command. Also, the syntax for <code>solve</code> is slightly different.</p>
<pre><code>var('a k n m')
solve([a*exp(k*2) - n==0, a*exp(k*8)-m==0], [a, k], solution_dict=True)
</code></pre>
<p>Unfortunately, Sage (which uses Maxima for this) does not solve the equation.</p>
<p>However, sympy does a nice job of solving here.</p>
<pre><code>var('a k n m')
import sympy as sp
sp.solve([a*exp(k*2) - n, a*exp(k*8)-m], [a, k],dict=True)
</code></pre>
https://ask.sagemath.org/question/33487/bug-in-sage-solve/?comment=33507#post-id-33507Thank you. Just strange that Sage can't solve such simple system.Sun, 22 May 2016 09:48:37 +0200https://ask.sagemath.org/question/33487/bug-in-sage-solve/?comment=33507#post-id-33507