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.Mon, 27 Sep 2021 18:11:50 +0200Weird c-values from solving system of equationshttps://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/Here is the issue:
sage: a_1, a_2, b_1, b_2 = var('a_1 a_2 b_1 b_2')
sage: eq1 = a_1 * a_2^2 - a_2 * a_1^3 == 0
sage: eq2 = 2*a_1*a_2*b_2 + b_2*a_2^2 - 3*a_2*a_1^2*b_1 - a_1*b_2
sage: eq3 = a_2^3 - a_2^2*a_1^2
sage: eq4 = 3*a_2^2*b_2 - 2*a_2*a_1^2*b_2 - 2*a_2^2*b_1
sage: solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2)
[[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440], [a_1 == c2441, a_2 == 0, b_1 == c2442, b_2 == 0], [a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]]
im getting these weird c2439 and c2440 solutions, are they just arbitrary complex numbers? Shouldn't they rather be prefixed with 'r' in that case? Can anyone tell me what these c-values are?Thu, 16 Sep 2021 14:52:20 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/Comment by dsejas for <p>Here is the issue:</p>
<pre><code>sage: a_1, a_2, b_1, b_2 = var('a_1 a_2 b_1 b_2')
sage: eq1 = a_1 * a_2^2 - a_2 * a_1^3 == 0
sage: eq2 = 2*a_1*a_2*b_2 + b_2*a_2^2 - 3*a_2*a_1^2*b_1 - a_1*b_2
sage: eq3 = a_2^3 - a_2^2*a_1^2
sage: eq4 = 3*a_2^2*b_2 - 2*a_2*a_1^2*b_2 - 2*a_2^2*b_1
sage: solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2)
[[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440], [a_1 == c2441, a_2 == 0, b_1 == c2442, b_2 == 0], [a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]]
</code></pre>
<p>im getting these weird c2439 and c2440 solutions, are they just arbitrary complex numbers? Shouldn't they rather be prefixed with 'r' in that case? Can anyone tell me what these c-values are?</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59099#post-id-59099Hello, @Emmanuel Charpentier! I deleted my previous comment that indicated that I couldn't reproduce the error message you obtained. The problem was that I accidentally solved the system with Sage's `solve()` function directly instead of using Maxima.
This made me wonder why Sage returns an answer when asked to solve with the `algorithm='maxima'` option instead of an error, so I took a look at the code. As it turns out, Sage's `solve()` function first tries to use Maxima's `solve`, and if that fails, it tries with `to_poly_solve`. Indeed, the following Maxima code should return the same solutions as Sage:
load(to_poly_solver);
to_poly_solve(Sys, Unk);
In Sage you can write
m = maxima(Sys)
m.to_poly_solve(Unk)
or the shorter version
maxima.to_poly_solve([Sys, Unk])Sun, 19 Sep 2021 04:00:47 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59099#post-id-59099Comment by Emmanuel Charpentier for <p>Here is the issue:</p>
<pre><code>sage: a_1, a_2, b_1, b_2 = var('a_1 a_2 b_1 b_2')
sage: eq1 = a_1 * a_2^2 - a_2 * a_1^3 == 0
sage: eq2 = 2*a_1*a_2*b_2 + b_2*a_2^2 - 3*a_2*a_1^2*b_1 - a_1*b_2
sage: eq3 = a_2^3 - a_2^2*a_1^2
sage: eq4 = 3*a_2^2*b_2 - 2*a_2*a_1^2*b_2 - 2*a_2^2*b_1
sage: solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2)
[[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440], [a_1 == c2441, a_2 == 0, b_1 == c2442, b_2 == 0], [a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]]
</code></pre>
<p>im getting these weird c2439 and c2440 solutions, are they just arbitrary complex numbers? Shouldn't they rather be prefixed with 'r' in that case? Can anyone tell me what these c-values are?</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59077#post-id-59077Maxima can't solve this system (checked in Maxima itself) :
sage: maxima_calculus.solve(maxima_calculus(Sys),maxima_calculus(Unk))
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
[ Snip...]
TypeError: ECL says: Error executing code in Maxima: algsys: system too complicated; give up.
Sympy gives a bizarre (and incompletely solved) answer ; Giac's result can't be backtranslated to Sage. The result you got may well come from Fricas :
sage: solve(Sys, Unk, algorithm="fricas")
[[a_1 == 0, a_2 == 0, b_1 == c10757, b_2 == c10758], [a_1 == c10759, a_2 == 0, b_1 == c10760, b_2 == 0], [a_1 == c10761, a_2 == c10761^2, b_1 == 0, b_2 == 0]]
Do you have Fricas installed ?Fri, 17 Sep 2021 10:53:17 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59077#post-id-59077Answer by dsejas for <p>Here is the issue:</p>
<pre><code>sage: a_1, a_2, b_1, b_2 = var('a_1 a_2 b_1 b_2')
sage: eq1 = a_1 * a_2^2 - a_2 * a_1^3 == 0
sage: eq2 = 2*a_1*a_2*b_2 + b_2*a_2^2 - 3*a_2*a_1^2*b_1 - a_1*b_2
sage: eq3 = a_2^3 - a_2^2*a_1^2
sage: eq4 = 3*a_2^2*b_2 - 2*a_2*a_1^2*b_2 - 2*a_2^2*b_1
sage: solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2)
[[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440], [a_1 == c2441, a_2 == 0, b_1 == c2442, b_2 == 0], [a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]]
</code></pre>
<p>im getting these weird c2439 and c2440 solutions, are they just arbitrary complex numbers? Shouldn't they rather be prefixed with 'r' in that case? Can anyone tell me what these c-values are?</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?answer=59082#post-id-59082Hello, @arneovi! The variables of the form `cN`, where `N` is a natural number, are parameters. For example, one of the solutions you obtained is
[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440]
This can be rewritten as $a_1=0$, $a_2=0$, $b_1=s$ and $b_2=t$, where $s,t\in\mathbb{R}$. On the other hand, one of the other solutions you obtained is
[a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]
In this case, you should notice that, unlike the previous example, the two occurrences of the variables of the from `cN` is the same one. Therefore, this can be rewritten as $a_1=t$, $a_2=t^2$, $b_1=0$ and $b_2=0$.
That should answer your question. However, I should also point out a potential problem that you might or might not find when using `solve()`. The `solve()` function accepts an `algorithm` parameter, which can take the values `maxima` (the default), `sympy`, `giac` and `fricas`. This indicates the Computer Algebra System that you want to use to solve the equation(s). In the case of `maxima`, `giac` and `fricas`, I obtained exactly the same results as you; however, `sympy` caused me some trouble. Indeed, when calling
solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2, algorithm='sympy')
I obtained some results tat are consistent with the ones you obtained. For example, here is part of the output for this case:
[{a_1: 0, a_2: 0},
{a_1: 0, a_2: 0},
{a_2: 0, a_1: 0},
{a_2: 0, b_2: 0},
...]
On the other hand, `Sympy` also gave me this result:
{a_1: -1/6*2^(5/6)*sqrt(3*2^(2/3)*(3*I*sqrt(303) + 1499)^(1/3) + 48*2^(1/3) + 624/(3*I*sqrt(303) + 1499)^(1/3)),
b_1: 1/2*b_2,
a_2: 1/3*2^(1/3)*(3*I*sqrt(303) + 1499)^(1/3) + 104/3*2^(2/3)/(3*I*sqrt(303) + 1499)^(1/3) + 16/3}
After replacing in the original equations, it would seem that the whole system is satisfied, except for `eq2`. ([Here](https://sagecell.sagemath.org/?z=eJyFUDFuwzAM3A34D9osKTEUkqrRDJkydTM6FypcICgMpE7iCAX6-5K0km7pIJ2OPN1R-h5m2-TG1dXwDmZnWgidx2SfQuf89TJnS0IxkPN8fCm1DTmzMhC3W5csBGXxWZSFdBjDIz0HfmggBPRZCDLJMgZqlW5m_8XCJob7jA8zhXWB6upwkWR5sOcdE5pWUBkkFcgQ6JnyQi_TrQzv_iYnrYtcuqAGIDq5TOqOiRbfVITSityixUVdW035c7pXFt-66vlCfzr-TKevcTi-jtOn3e_XJvMHnudxyra3_By3NoJYkApGxuvhvGvepsb9Al4kc-Y=&lang=sage&interacts=eJyLjgUAARUAuQ==) is a SageCell using this exact solution, just in case you feel curious. However, be warned: I had to use polynomial rings in order to obtain numerical approximations, because the mathematical expressions are too complicated for `full_simplify()`.)
**My suggestion:** Although very useful, the `solve()` function not always gives the right and/or complete answer. It is always a good idea to check with different algorithms. Even better, if you can solve the system by hand in a reasonable amount of time and with a reasonable amount of effort, it is best to do it so.
I hope this helps!Fri, 17 Sep 2021 20:56:38 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?answer=59082#post-id-59082Comment by dsejas for <p>Hello, <a href="/users/33212/arneovi/">@arneovi</a>! The variables of the form <code>cN</code>, where <code>N</code> is a natural number, are parameters. For example, one of the solutions you obtained is</p>
<pre><code>[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440]
</code></pre>
<p>This can be rewritten as $a_1=0$, $a_2=0$, $b_1=s$ and $b_2=t$, where $s,t\in\mathbb{R}$. On the other hand, one of the other solutions you obtained is</p>
<pre><code>[a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]
</code></pre>
<p>In this case, you should notice that, unlike the previous example, the two occurrences of the variables of the from <code>cN</code> is the same one. Therefore, this can be rewritten as $a_1=t$, $a_2=t^2$, $b_1=0$ and $b_2=0$.</p>
<p>That should answer your question. However, I should also point out a potential problem that you might or might not find when using <code>solve()</code>. The <code>solve()</code> function accepts an <code>algorithm</code> parameter, which can take the values <code>maxima</code> (the default), <code>sympy</code>, <code>giac</code> and <code>fricas</code>. This indicates the Computer Algebra System that you want to use to solve the equation(s). In the case of <code>maxima</code>, <code>giac</code> and <code>fricas</code>, I obtained exactly the same results as you; however, <code>sympy</code> caused me some trouble. Indeed, when calling</p>
<pre><code>solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2, algorithm='sympy')
</code></pre>
<p>I obtained some results tat are consistent with the ones you obtained. For example, here is part of the output for this case:</p>
<pre><code>[{a_1: 0, a_2: 0},
{a_1: 0, a_2: 0},
{a_2: 0, a_1: 0},
{a_2: 0, b_2: 0},
...]
</code></pre>
<p>On the other hand, <code>Sympy</code> also gave me this result:</p>
<pre><code>{a_1: -1/6*2^(5/6)*sqrt(3*2^(2/3)*(3*I*sqrt(303) + 1499)^(1/3) + 48*2^(1/3) + 624/(3*I*sqrt(303) + 1499)^(1/3)),
b_1: 1/2*b_2,
a_2: 1/3*2^(1/3)*(3*I*sqrt(303) + 1499)^(1/3) + 104/3*2^(2/3)/(3*I*sqrt(303) + 1499)^(1/3) + 16/3}
</code></pre>
<p>After replacing in the original equations, it would seem that the whole system is satisfied, except for <code>eq2</code>. (<a href="https://sagecell.sagemath.org/?z=eJyFUDFuwzAM3A34D9osKTEUkqrRDJkydTM6FypcICgMpE7iCAX6-5K0km7pIJ2OPN1R-h5m2-TG1dXwDmZnWgidx2SfQuf89TJnS0IxkPN8fCm1DTmzMhC3W5csBGXxWZSFdBjDIz0HfmggBPRZCDLJMgZqlW5m_8XCJob7jA8zhXWB6upwkWR5sOcdE5pWUBkkFcgQ6JnyQi_TrQzv_iYnrYtcuqAGIDq5TOqOiRbfVITSityixUVdW035c7pXFt-66vlCfzr-TKevcTi-jtOn3e_XJvMHnudxyra3_By3NoJYkApGxuvhvGvepsb9Al4kc-Y=&lang=sage&interacts=eJyLjgUAARUAuQ==">Here</a> is a SageCell using this exact solution, just in case you feel curious. However, be warned: I had to use polynomial rings in order to obtain numerical approximations, because the mathematical expressions are too complicated for <code>full_simplify()</code>.)</p>
<p><strong>My suggestion:</strong> Although very useful, the <code>solve()</code> function not always gives the right and/or complete answer. It is always a good idea to check with different algorithms. Even better, if you can solve the system by hand in a reasonable amount of time and with a reasonable amount of effort, it is best to do it so.</p>
<p>I hope this helps!</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59177#post-id-59177Hello, @arneovi! This is a very good question! I had never noticed these `r` and `c` parameters. It seems to me that the parameters could as well be complex in this particular case.
After studying the code and experimenting a little with Maxima, I can tell that `r` parameters are produced by Maxima's `solve()` while `c` parameters are produced by `to_poly_solve()` from the same software. However, I know that there exist special names for parameters. For example, the code `solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)` will produce `[[x == 1/4*pi + pi*z2169, y == -1/4*pi - pi*z2169]]`, where the `z` indicates an integer parameter.
I have posted [this related question](https://ask.sagemath.org/question/59176/difference-between-r-and-c-solution-parameters/) asking for clarification.Mon, 27 Sep 2021 18:11:50 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59177#post-id-59177Comment by arneovi for <p>Hello, <a href="/users/33212/arneovi/">@arneovi</a>! The variables of the form <code>cN</code>, where <code>N</code> is a natural number, are parameters. For example, one of the solutions you obtained is</p>
<pre><code>[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440]
</code></pre>
<p>This can be rewritten as $a_1=0$, $a_2=0$, $b_1=s$ and $b_2=t$, where $s,t\in\mathbb{R}$. On the other hand, one of the other solutions you obtained is</p>
<pre><code>[a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]
</code></pre>
<p>In this case, you should notice that, unlike the previous example, the two occurrences of the variables of the from <code>cN</code> is the same one. Therefore, this can be rewritten as $a_1=t$, $a_2=t^2$, $b_1=0$ and $b_2=0$.</p>
<p>That should answer your question. However, I should also point out a potential problem that you might or might not find when using <code>solve()</code>. The <code>solve()</code> function accepts an <code>algorithm</code> parameter, which can take the values <code>maxima</code> (the default), <code>sympy</code>, <code>giac</code> and <code>fricas</code>. This indicates the Computer Algebra System that you want to use to solve the equation(s). In the case of <code>maxima</code>, <code>giac</code> and <code>fricas</code>, I obtained exactly the same results as you; however, <code>sympy</code> caused me some trouble. Indeed, when calling</p>
<pre><code>solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2, algorithm='sympy')
</code></pre>
<p>I obtained some results tat are consistent with the ones you obtained. For example, here is part of the output for this case:</p>
<pre><code>[{a_1: 0, a_2: 0},
{a_1: 0, a_2: 0},
{a_2: 0, a_1: 0},
{a_2: 0, b_2: 0},
...]
</code></pre>
<p>On the other hand, <code>Sympy</code> also gave me this result:</p>
<pre><code>{a_1: -1/6*2^(5/6)*sqrt(3*2^(2/3)*(3*I*sqrt(303) + 1499)^(1/3) + 48*2^(1/3) + 624/(3*I*sqrt(303) + 1499)^(1/3)),
b_1: 1/2*b_2,
a_2: 1/3*2^(1/3)*(3*I*sqrt(303) + 1499)^(1/3) + 104/3*2^(2/3)/(3*I*sqrt(303) + 1499)^(1/3) + 16/3}
</code></pre>
<p>After replacing in the original equations, it would seem that the whole system is satisfied, except for <code>eq2</code>. (<a href="https://sagecell.sagemath.org/?z=eJyFUDFuwzAM3A34D9osKTEUkqrRDJkydTM6FypcICgMpE7iCAX6-5K0km7pIJ2OPN1R-h5m2-TG1dXwDmZnWgidx2SfQuf89TJnS0IxkPN8fCm1DTmzMhC3W5csBGXxWZSFdBjDIz0HfmggBPRZCDLJMgZqlW5m_8XCJob7jA8zhXWB6upwkWR5sOcdE5pWUBkkFcgQ6JnyQi_TrQzv_iYnrYtcuqAGIDq5TOqOiRbfVITSityixUVdW035c7pXFt-66vlCfzr-TKevcTi-jtOn3e_XJvMHnudxyra3_By3NoJYkApGxuvhvGvepsb9Al4kc-Y=&lang=sage&interacts=eJyLjgUAARUAuQ==">Here</a> is a SageCell using this exact solution, just in case you feel curious. However, be warned: I had to use polynomial rings in order to obtain numerical approximations, because the mathematical expressions are too complicated for <code>full_simplify()</code>.)</p>
<p><strong>My suggestion:</strong> Although very useful, the <code>solve()</code> function not always gives the right and/or complete answer. It is always a good idea to check with different algorithms. Even better, if you can solve the system by hand in a reasonable amount of time and with a reasonable amount of effort, it is best to do it so.</p>
<p>I hope this helps!</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59175#post-id-59175@dsejas
I thought the r-variable is the standard parameter? Running this :
a_1, a_2, b_1, b_2 = var('a_1, a_2, b_1, b_2')
eq1 = a_2^2 - a_2*a_1^2 == 0
eq2 = a_2*b_2 - 2*a_1*a_2*b_1 + a_2*b_2 - a_1^2*b_1 == 0
solve([eq1, eq2], a_1, a_2, b_1, b_2)
i get:
[[a_1 == 0, a_2 == 0, b_1 == r4, b_2 == r5], [a_1 == r6, a_2 == 0, b_1 == 0, b_2 == r7], [a_1 == r8, a_2 == r8^2, b_1 == r9, b_2 == 1/2*(2*r8 + 1)*r9]]Mon, 27 Sep 2021 14:34:15 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59175#post-id-59175Comment by dsejas for <p>Hello, <a href="/users/33212/arneovi/">@arneovi</a>! The variables of the form <code>cN</code>, where <code>N</code> is a natural number, are parameters. For example, one of the solutions you obtained is</p>
<pre><code>[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440]
</code></pre>
<p>This can be rewritten as $a_1=0$, $a_2=0$, $b_1=s$ and $b_2=t$, where $s,t\in\mathbb{R}$. On the other hand, one of the other solutions you obtained is</p>
<pre><code>[a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]
</code></pre>
<p>In this case, you should notice that, unlike the previous example, the two occurrences of the variables of the from <code>cN</code> is the same one. Therefore, this can be rewritten as $a_1=t$, $a_2=t^2$, $b_1=0$ and $b_2=0$.</p>
<p>That should answer your question. However, I should also point out a potential problem that you might or might not find when using <code>solve()</code>. The <code>solve()</code> function accepts an <code>algorithm</code> parameter, which can take the values <code>maxima</code> (the default), <code>sympy</code>, <code>giac</code> and <code>fricas</code>. This indicates the Computer Algebra System that you want to use to solve the equation(s). In the case of <code>maxima</code>, <code>giac</code> and <code>fricas</code>, I obtained exactly the same results as you; however, <code>sympy</code> caused me some trouble. Indeed, when calling</p>
<pre><code>solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2, algorithm='sympy')
</code></pre>
<p>I obtained some results tat are consistent with the ones you obtained. For example, here is part of the output for this case:</p>
<pre><code>[{a_1: 0, a_2: 0},
{a_1: 0, a_2: 0},
{a_2: 0, a_1: 0},
{a_2: 0, b_2: 0},
...]
</code></pre>
<p>On the other hand, <code>Sympy</code> also gave me this result:</p>
<pre><code>{a_1: -1/6*2^(5/6)*sqrt(3*2^(2/3)*(3*I*sqrt(303) + 1499)^(1/3) + 48*2^(1/3) + 624/(3*I*sqrt(303) + 1499)^(1/3)),
b_1: 1/2*b_2,
a_2: 1/3*2^(1/3)*(3*I*sqrt(303) + 1499)^(1/3) + 104/3*2^(2/3)/(3*I*sqrt(303) + 1499)^(1/3) + 16/3}
</code></pre>
<p>After replacing in the original equations, it would seem that the whole system is satisfied, except for <code>eq2</code>. (<a href="https://sagecell.sagemath.org/?z=eJyFUDFuwzAM3A34D9osKTEUkqrRDJkydTM6FypcICgMpE7iCAX6-5K0km7pIJ2OPN1R-h5m2-TG1dXwDmZnWgidx2SfQuf89TJnS0IxkPN8fCm1DTmzMhC3W5csBGXxWZSFdBjDIz0HfmggBPRZCDLJMgZqlW5m_8XCJob7jA8zhXWB6upwkWR5sOcdE5pWUBkkFcgQ6JnyQi_TrQzv_iYnrYtcuqAGIDq5TOqOiRbfVITSityixUVdW035c7pXFt-66vlCfzr-TKevcTi-jtOn3e_XJvMHnudxyra3_By3NoJYkApGxuvhvGvepsb9Al4kc-Y=&lang=sage&interacts=eJyLjgUAARUAuQ==">Here</a> is a SageCell using this exact solution, just in case you feel curious. However, be warned: I had to use polynomial rings in order to obtain numerical approximations, because the mathematical expressions are too complicated for <code>full_simplify()</code>.)</p>
<p><strong>My suggestion:</strong> Although very useful, the <code>solve()</code> function not always gives the right and/or complete answer. It is always a good idea to check with different algorithms. Even better, if you can solve the system by hand in a reasonable amount of time and with a reasonable amount of effort, it is best to do it so.</p>
<p>I hope this helps!</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59161#post-id-59161Hello, @arneovi! In my daily use of Sage I didn't find any instance where the parameters are expressed in the form `rN`, where `N` is a positive integer. Therefore, I cannot help with your doubt about `r` variables. Perhaps you could post this as a different question in the forum, giving an appropriate example.Sun, 26 Sep 2021 05:15:25 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59161#post-id-59161Comment by dsejas for <p>Hello, <a href="/users/33212/arneovi/">@arneovi</a>! The variables of the form <code>cN</code>, where <code>N</code> is a natural number, are parameters. For example, one of the solutions you obtained is</p>
<pre><code>[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440]
</code></pre>
<p>This can be rewritten as $a_1=0$, $a_2=0$, $b_1=s$ and $b_2=t$, where $s,t\in\mathbb{R}$. On the other hand, one of the other solutions you obtained is</p>
<pre><code>[a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]
</code></pre>
<p>In this case, you should notice that, unlike the previous example, the two occurrences of the variables of the from <code>cN</code> is the same one. Therefore, this can be rewritten as $a_1=t$, $a_2=t^2$, $b_1=0$ and $b_2=0$.</p>
<p>That should answer your question. However, I should also point out a potential problem that you might or might not find when using <code>solve()</code>. The <code>solve()</code> function accepts an <code>algorithm</code> parameter, which can take the values <code>maxima</code> (the default), <code>sympy</code>, <code>giac</code> and <code>fricas</code>. This indicates the Computer Algebra System that you want to use to solve the equation(s). In the case of <code>maxima</code>, <code>giac</code> and <code>fricas</code>, I obtained exactly the same results as you; however, <code>sympy</code> caused me some trouble. Indeed, when calling</p>
<pre><code>solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2, algorithm='sympy')
</code></pre>
<p>I obtained some results tat are consistent with the ones you obtained. For example, here is part of the output for this case:</p>
<pre><code>[{a_1: 0, a_2: 0},
{a_1: 0, a_2: 0},
{a_2: 0, a_1: 0},
{a_2: 0, b_2: 0},
...]
</code></pre>
<p>On the other hand, <code>Sympy</code> also gave me this result:</p>
<pre><code>{a_1: -1/6*2^(5/6)*sqrt(3*2^(2/3)*(3*I*sqrt(303) + 1499)^(1/3) + 48*2^(1/3) + 624/(3*I*sqrt(303) + 1499)^(1/3)),
b_1: 1/2*b_2,
a_2: 1/3*2^(1/3)*(3*I*sqrt(303) + 1499)^(1/3) + 104/3*2^(2/3)/(3*I*sqrt(303) + 1499)^(1/3) + 16/3}
</code></pre>
<p>After replacing in the original equations, it would seem that the whole system is satisfied, except for <code>eq2</code>. (<a href="https://sagecell.sagemath.org/?z=eJyFUDFuwzAM3A34D9osKTEUkqrRDJkydTM6FypcICgMpE7iCAX6-5K0km7pIJ2OPN1R-h5m2-TG1dXwDmZnWgidx2SfQuf89TJnS0IxkPN8fCm1DTmzMhC3W5csBGXxWZSFdBjDIz0HfmggBPRZCDLJMgZqlW5m_8XCJob7jA8zhXWB6upwkWR5sOcdE5pWUBkkFcgQ6JnyQi_TrQzv_iYnrYtcuqAGIDq5TOqOiRbfVITSityixUVdW035c7pXFt-66vlCfzr-TKevcTi-jtOn3e_XJvMHnudxyra3_By3NoJYkApGxuvhvGvepsb9Al4kc-Y=&lang=sage&interacts=eJyLjgUAARUAuQ==">Here</a> is a SageCell using this exact solution, just in case you feel curious. However, be warned: I had to use polynomial rings in order to obtain numerical approximations, because the mathematical expressions are too complicated for <code>full_simplify()</code>.)</p>
<p><strong>My suggestion:</strong> Although very useful, the <code>solve()</code> function not always gives the right and/or complete answer. It is always a good idea to check with different algorithms. Even better, if you can solve the system by hand in a reasonable amount of time and with a reasonable amount of effort, it is best to do it so.</p>
<p>I hope this helps!</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59160#post-id-59160Hello, @Emmanuel Charpentier! Concerning the solution `{a_1: 0, b_1: 1/2*b_2, a_2: 0}` being a particular case of `{a_1:0, a_2: 0}`, you are totally right. I just edited the answer in kind. (Perhaps I should stop answering questions at 2 o'clock in the morning, because I make these types of mistakes, but it is the only available time I have.) Thank you for your comment!Sun, 26 Sep 2021 05:11:53 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59160#post-id-59160Comment by arneovi for <p>Hello, <a href="/users/33212/arneovi/">@arneovi</a>! The variables of the form <code>cN</code>, where <code>N</code> is a natural number, are parameters. For example, one of the solutions you obtained is</p>
<pre><code>[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440]
</code></pre>
<p>This can be rewritten as $a_1=0$, $a_2=0$, $b_1=s$ and $b_2=t$, where $s,t\in\mathbb{R}$. On the other hand, one of the other solutions you obtained is</p>
<pre><code>[a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]
</code></pre>
<p>In this case, you should notice that, unlike the previous example, the two occurrences of the variables of the from <code>cN</code> is the same one. Therefore, this can be rewritten as $a_1=t$, $a_2=t^2$, $b_1=0$ and $b_2=0$.</p>
<p>That should answer your question. However, I should also point out a potential problem that you might or might not find when using <code>solve()</code>. The <code>solve()</code> function accepts an <code>algorithm</code> parameter, which can take the values <code>maxima</code> (the default), <code>sympy</code>, <code>giac</code> and <code>fricas</code>. This indicates the Computer Algebra System that you want to use to solve the equation(s). In the case of <code>maxima</code>, <code>giac</code> and <code>fricas</code>, I obtained exactly the same results as you; however, <code>sympy</code> caused me some trouble. Indeed, when calling</p>
<pre><code>solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2, algorithm='sympy')
</code></pre>
<p>I obtained some results tat are consistent with the ones you obtained. For example, here is part of the output for this case:</p>
<pre><code>[{a_1: 0, a_2: 0},
{a_1: 0, a_2: 0},
{a_2: 0, a_1: 0},
{a_2: 0, b_2: 0},
...]
</code></pre>
<p>On the other hand, <code>Sympy</code> also gave me this result:</p>
<pre><code>{a_1: -1/6*2^(5/6)*sqrt(3*2^(2/3)*(3*I*sqrt(303) + 1499)^(1/3) + 48*2^(1/3) + 624/(3*I*sqrt(303) + 1499)^(1/3)),
b_1: 1/2*b_2,
a_2: 1/3*2^(1/3)*(3*I*sqrt(303) + 1499)^(1/3) + 104/3*2^(2/3)/(3*I*sqrt(303) + 1499)^(1/3) + 16/3}
</code></pre>
<p>After replacing in the original equations, it would seem that the whole system is satisfied, except for <code>eq2</code>. (<a href="https://sagecell.sagemath.org/?z=eJyFUDFuwzAM3A34D9osKTEUkqrRDJkydTM6FypcICgMpE7iCAX6-5K0km7pIJ2OPN1R-h5m2-TG1dXwDmZnWgidx2SfQuf89TJnS0IxkPN8fCm1DTmzMhC3W5csBGXxWZSFdBjDIz0HfmggBPRZCDLJMgZqlW5m_8XCJob7jA8zhXWB6upwkWR5sOcdE5pWUBkkFcgQ6JnyQi_TrQzv_iYnrYtcuqAGIDq5TOqOiRbfVITSityixUVdW035c7pXFt-66vlCfzr-TKevcTi-jtOn3e_XJvMHnudxyra3_By3NoJYkApGxuvhvGvepsb9Al4kc-Y=&lang=sage&interacts=eJyLjgUAARUAuQ==">Here</a> is a SageCell using this exact solution, just in case you feel curious. However, be warned: I had to use polynomial rings in order to obtain numerical approximations, because the mathematical expressions are too complicated for <code>full_simplify()</code>.)</p>
<p><strong>My suggestion:</strong> Although very useful, the <code>solve()</code> function not always gives the right and/or complete answer. It is always a good idea to check with different algorithms. Even better, if you can solve the system by hand in a reasonable amount of time and with a reasonable amount of effort, it is best to do it so.</p>
<p>I hope this helps!</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59129#post-id-59129Thank you! I thought maybe it was parameters but was confused since I thought the "r" variables were parameters, like for example r23? Is there any difference between r and c parameters? Real and complex numbers maybe? I tried solving these by hand but this is just part of a bigger calculation so in the next step i will need to introduce more equations and variables so I would like to avoid doing it by hand. But I will use this method with caution. Thank you again for your help and suggestions.Thu, 23 Sep 2021 14:24:24 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59129#post-id-59129Comment by Emmanuel Charpentier for <p>Hello, <a href="/users/33212/arneovi/">@arneovi</a>! The variables of the form <code>cN</code>, where <code>N</code> is a natural number, are parameters. For example, one of the solutions you obtained is</p>
<pre><code>[a_1 == 0, a_2 == 0, b_1 == c2439, b_2 == c2440]
</code></pre>
<p>This can be rewritten as $a_1=0$, $a_2=0$, $b_1=s$ and $b_2=t$, where $s,t\in\mathbb{R}$. On the other hand, one of the other solutions you obtained is</p>
<pre><code>[a_1 == c2443, a_2 == c2443^2, b_1 == 0, b_2 == 0]
</code></pre>
<p>In this case, you should notice that, unlike the previous example, the two occurrences of the variables of the from <code>cN</code> is the same one. Therefore, this can be rewritten as $a_1=t$, $a_2=t^2$, $b_1=0$ and $b_2=0$.</p>
<p>That should answer your question. However, I should also point out a potential problem that you might or might not find when using <code>solve()</code>. The <code>solve()</code> function accepts an <code>algorithm</code> parameter, which can take the values <code>maxima</code> (the default), <code>sympy</code>, <code>giac</code> and <code>fricas</code>. This indicates the Computer Algebra System that you want to use to solve the equation(s). In the case of <code>maxima</code>, <code>giac</code> and <code>fricas</code>, I obtained exactly the same results as you; however, <code>sympy</code> caused me some trouble. Indeed, when calling</p>
<pre><code>solve([eq1, eq2, eq3, eq4], a_1, a_2, b_1, b_2, algorithm='sympy')
</code></pre>
<p>I obtained some results tat are consistent with the ones you obtained. For example, here is part of the output for this case:</p>
<pre><code>[{a_1: 0, a_2: 0},
{a_1: 0, a_2: 0},
{a_2: 0, a_1: 0},
{a_2: 0, b_2: 0},
...]
</code></pre>
<p>On the other hand, <code>Sympy</code> also gave me this result:</p>
<pre><code>{a_1: -1/6*2^(5/6)*sqrt(3*2^(2/3)*(3*I*sqrt(303) + 1499)^(1/3) + 48*2^(1/3) + 624/(3*I*sqrt(303) + 1499)^(1/3)),
b_1: 1/2*b_2,
a_2: 1/3*2^(1/3)*(3*I*sqrt(303) + 1499)^(1/3) + 104/3*2^(2/3)/(3*I*sqrt(303) + 1499)^(1/3) + 16/3}
</code></pre>
<p>After replacing in the original equations, it would seem that the whole system is satisfied, except for <code>eq2</code>. (<a href="https://sagecell.sagemath.org/?z=eJyFUDFuwzAM3A34D9osKTEUkqrRDJkydTM6FypcICgMpE7iCAX6-5K0km7pIJ2OPN1R-h5m2-TG1dXwDmZnWgidx2SfQuf89TJnS0IxkPN8fCm1DTmzMhC3W5csBGXxWZSFdBjDIz0HfmggBPRZCDLJMgZqlW5m_8XCJob7jA8zhXWB6upwkWR5sOcdE5pWUBkkFcgQ6JnyQi_TrQzv_iYnrYtcuqAGIDq5TOqOiRbfVITSityixUVdW035c7pXFt-66vlCfzr-TKevcTi-jtOn3e_XJvMHnudxyra3_By3NoJYkApGxuvhvGvepsb9Al4kc-Y=&lang=sage&interacts=eJyLjgUAARUAuQ==">Here</a> is a SageCell using this exact solution, just in case you feel curious. However, be warned: I had to use polynomial rings in order to obtain numerical approximations, because the mathematical expressions are too complicated for <code>full_simplify()</code>.)</p>
<p><strong>My suggestion:</strong> Although very useful, the <code>solve()</code> function not always gives the right and/or complete answer. It is always a good idea to check with different algorithms. Even better, if you can solve the system by hand in a reasonable amount of time and with a reasonable amount of effort, it is best to do it so.</p>
<p>I hope this helps!</p>
https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59112#post-id-59112A couple remarks :
- The solution `{a_1: 0, b_1: 1/2*b_2, a_2: 0}` **is** a special case of `{a_1: 0, a_2: 0}`
- Both Sympy and Mathematica add to the general solutions given by Maxima and Fricas a triplet of solutions (`a1` being in the roots of a a quadrinomial) ;
- Mathematica presents the quadrinomial (and the derivative solutions can be checked),
- Sympy presents the (supposed) roots, which do *not* check (one of them is in Matjematica's quadrinomioal roots (and checks), the other two being *opposite* to the other two Mathematica's quadrinomial's roots (and do *not* check)).Tue, 21 Sep 2021 16:14:29 +0200https://ask.sagemath.org/question/59063/weird-c-values-from-solving-system-of-equations/?comment=59112#post-id-59112