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, 29 Mar 2020 22:59:15 +0200solve() does not solvehttps://ask.sagemath.org/question/50421/solve-does-not-solve/The output of this system is [] after waiting 10 mins. What's the problem here?
var('a2,b2')
solve([
log(10,a2) + log(10,b2) * 435 == 50.88,
log(10,a2) * 435 + log(10,b2) * 8555 == 979.15], a2,b2)Sun, 29 Mar 2020 19:24:47 +0200https://ask.sagemath.org/question/50421/solve-does-not-solve/Comment by dsejas for <p>The output of this system is [] after waiting 10 mins. What's the problem here?</p>
<pre><code>var('a2,b2')
solve([
log(10,a2) + log(10,b2) * 435 == 50.88,
log(10,a2) * 435 + log(10,b2) * 8555 == 979.15], a2,b2)
</code></pre>
https://ask.sagemath.org/question/50421/solve-does-not-solve/?comment=50423#post-id-50423Hello, @Alex89! One question: Are you trying to determine the base for the logarithm? Remember that `log(10,a2)` means "the logarithm of 10 in base a2", i.e., $\log_{a2}(10)$. Is that correct? Or did you intend to mean "the logarithm of a2 in base 10"?Sun, 29 Mar 2020 20:12:30 +0200https://ask.sagemath.org/question/50421/solve-does-not-solve/?comment=50423#post-id-50423Comment by Alex89 for <p>The output of this system is [] after waiting 10 mins. What's the problem here?</p>
<pre><code>var('a2,b2')
solve([
log(10,a2) + log(10,b2) * 435 == 50.88,
log(10,a2) * 435 + log(10,b2) * 8555 == 979.15], a2,b2)
</code></pre>
https://ask.sagemath.org/question/50421/solve-does-not-solve/?comment=50425#post-id-50425I am sorry, I messed up the log function, I wanted the log of a2 in base 10 - **log(a2, 10)**.
However when I corrected my mistake the function still doesn't work.Sun, 29 Mar 2020 20:44:13 +0200https://ask.sagemath.org/question/50421/solve-does-not-solve/?comment=50425#post-id-50425Answer by dsejas for <p>The output of this system is [] after waiting 10 mins. What's the problem here?</p>
<pre><code>var('a2,b2')
solve([
log(10,a2) + log(10,b2) * 435 == 50.88,
log(10,a2) * 435 + log(10,b2) * 8555 == 979.15], a2,b2)
</code></pre>
https://ask.sagemath.org/question/50421/solve-does-not-solve/?answer=50427#post-id-50427Hello, @Alex89! I don't know exactly why this is failing. I even try using `Sympy` as solver for the problem, but my computer crashed (in SageCell, I got a "Memory Error"). However, you can cleverly solve this system. Check this out:
Let's make a change of variables, making $x=\log_10(a2)$ and $y=\log_10(b2)$. Then, your code can be rewritten as
var('a2,b2')
solve([x + 435*y == 50.88, 435*x + 8555*y == 979.15], x, y)
That gives the following solution:
[[x == (-921/17800), y == (60439/516200)]]
This implies that $\log_{10}(a2)=-921/17800$ and $\log_{10}(b2)=60439/516200$. Now, if you apply the definition of the logarithm, these in turn imply that $a2=10^{-921/17800}$ and $b2=10^{60439/516200}$. If you want these values as numerical values, you do
a2 = N(10^(-921/17800))
b2 = N(10^(60439/516200))
which gives you
a2 = 0.887684071389383
b2 = 1.30943656287307
That's it! I hope this helps!Sun, 29 Mar 2020 21:04:55 +0200https://ask.sagemath.org/question/50421/solve-does-not-solve/?answer=50427#post-id-50427Comment by Alex89 for <p>Hello, <a href="/users/27648/alex89/">@Alex89</a>! I don't know exactly why this is failing. I even try using <code>Sympy</code> as solver for the problem, but my computer crashed (in SageCell, I got a "Memory Error"). However, you can cleverly solve this system. Check this out:</p>
<p>Let's make a change of variables, making $x=\log_10(a2)$ and $y=\log_10(b2)$. Then, your code can be rewritten as</p>
<pre><code>var('a2,b2')
solve([x + 435*y == 50.88, 435*x + 8555*y == 979.15], x, y)
</code></pre>
<p>That gives the following solution:</p>
<pre><code>[[x == (-921/17800), y == (60439/516200)]]
</code></pre>
<p>This implies that $\log_{10}(a2)=-921/17800$ and $\log_{10}(b2)=60439/516200$. Now, if you apply the definition of the logarithm, these in turn imply that $a2=10^{-921/17800}$ and $b2=10^{60439/516200}$. If you want these values as numerical values, you do</p>
<pre><code>a2 = N(10^(-921/17800))
b2 = N(10^(60439/516200))
</code></pre>
<p>which gives you</p>
<pre><code>a2 = 0.887684071389383
b2 = 1.30943656287307
</code></pre>
<p>That's it! I hope this helps!</p>
https://ask.sagemath.org/question/50421/solve-does-not-solve/?comment=50431#post-id-50431Thank you for your answer, the result is what I was looking for. Sucks that solve() does not work with logs.Sun, 29 Mar 2020 22:59:15 +0200https://ask.sagemath.org/question/50421/solve-does-not-solve/?comment=50431#post-id-50431