From: Prof. J. S. <jen...@ht...> - 2017-02-19 19:07:32
Attachments:
quartic_equation.wxmx
|
Hello, I'm using maxima to solve equation systems symbolically. To simplify the result, I eliminate "superfluous" variables first. For the following example the result depends on the variable order: e1 and e2 lead to different solutions and the only difference is the order of variables in eliminate() (ua before ue or vice versa). In this case, e1 gets a solution more (k=0). However, k=0 is not a solution of the original equation system [eq1...eq5]. Is there a reason why the order of the variables of eliminate() is important for the solution? Is there a rule to find a variable order that leads to correct results of solve? Otherwise, one has to loop over all results and check whether its a solution. Many thanks! Jens |
From: Prof. J. S. <jen...@ht...> - 2017-02-20 11:08:29
|
Hello, the code of my previous posting is not shown right. Here is the source code of it: eq1: ue-(k*ua)=ue1; eq2: 10000*(ue1^2)=ue2; eq3: 10000*(ue2^2)=ua; eq4: ue=1/100; eq5: ua=1; e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); s1: solve(e1,[k]); s2: solve(e2,[k]); and the results: (%i6) e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); 2 (%o6) [10000000000000000 k 4 3 2 2 (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + 9999) ] (%i7) e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); (%o7) [10000000000000000 4 3 2 2 (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + 9999) ] (%i8) s1: solve(e1,[k]); 9 11 %i - 10 %i + 10 (%o8) [k = ----, k = ----, k = - -------, k = -------, k = 0] 1000 1000 1000 1000 (%i9) s2: solve(e2,[k]); 9 11 %i - 10 %i + 10 (%o9) [k = ----, k = ----, k = - -------, k = -------] 1000 1000 1000 1000 The s1 contains k=0 as a solution which is not the case for s2. Many thanks and best regards, Jens Am 19.02.2017 um 20:07 schrieb Prof. Jens Schönherr: > Hello, > > I'm using maxima to solve equation systems symbolically. To simplify > the result, I eliminate "superfluous" variables first. For the > following example the result depends on the variable order: > > e1 and e2 lead to different solutions and the only difference is the > order of variables in eliminate() (ua before ue or vice versa). In > this case, e1 gets a solution more (k=0). However, k=0 is not a > solution of the original equation system [eq1...eq5]. > > Is there a reason why the order of the variables of eliminate() is > important for the solution? Is there a rule to find a variable order > that leads to correct results of solve? Otherwise, one has to loop > over all results and check whether its a solution. > > Many thanks! > > Jens -- ________________________________________________________________ Prof. Dr.-Ing. Jens Schönherr Digitale Schaltungen und Systementwurf Hochschule für Technik und Wirtschaft Dresden University of Applied Sciences Fakultät Elektrotechnik / Faculty of Electrical Engineering Friedrich-List-Platz 1, 01069 Dresden, Germany Web: http://www.htw-dresden.de/elektrotechnik Phone: +49 351 462 3060 Fax: +49 351 462 2175 ________________________________________________________________ |
From: Raymond R. <ray...@gm...> - 2017-02-20 14:42:32
|
You might find 'elim()' from load(to_poly_solve) ; interesting. In this case e1,e2 are identical and you can see the "pivot points". (%i16) e1: elim([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); (e1) [[1000000000000*k^4-40000000000*k^3+600000000*k^2-4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] (%i17) e2: elim([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); (e2) [[1000000000000*k^4-40000000000*k^3+600000000*k^2-4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] If needed I can insert some MathML or Latex for the above. Just have to find the plugin. Looking at the original equations one can mentally do a resolution and it seems that the factor "k=0" from eliminate is bogus. That is to say: I can't see how one ever gets more than a fourth order polynomial in k. RayR On 02/20/2017 06:08 AM, Prof. Jens Schönherr wrote: > Hello, > > the code of my previous posting is not shown right. Here is the source > code of it: > > eq1: ue-(k*ua)=ue1; > eq2: 10000*(ue1^2)=ue2; > eq3: 10000*(ue2^2)=ua; > eq4: ue=1/100; > eq5: ua=1; > e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > s1: solve(e1,[k]); > s2: solve(e2,[k]); > > and the results: > (%i6) e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > 2 > (%o6) [10000000000000000 k > 4 3 2 2 > (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k > + 9999) ] > (%i7) e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > (%o7) [10000000000000000 > 4 3 2 2 > (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k > + 9999) ] > (%i8) s1: solve(e1,[k]); > 9 11 %i - 10 %i + 10 > (%o8) [k = ----, k = ----, k = - -------, k = -------, k = 0] > 1000 1000 1000 1000 > (%i9) s2: solve(e2,[k]); > 9 11 %i - 10 %i + 10 > (%o9) [k = ----, k = ----, k = - -------, k = -------] > 1000 1000 1000 1000 > > The s1 contains k=0 as a solution which is not the case for s2. > > Many thanks and best regards, > > Jens > > Am 19.02.2017 um 20:07 schrieb Prof. Jens Schönherr: >> Hello, >> >> I'm using maxima to solve equation systems symbolically. To simplify >> the result, I eliminate "superfluous" variables first. For the >> following example the result depends on the variable order: >> >> e1 and e2 lead to different solutions and the only difference is the >> order of variables in eliminate() (ua before ue or vice versa). In >> this case, e1 gets a solution more (k=0). However, k=0 is not a >> solution of the original equation system [eq1...eq5]. >> >> Is there a reason why the order of the variables of eliminate() is >> important for the solution? Is there a rule to find a variable order >> that leads to correct results of solve? Otherwise, one has to loop >> over all results and check whether its a solution. >> >> Many thanks! >> >> Jens > > -- > ________________________________________________________________ > Prof. Dr.-Ing. Jens Schönherr > Digitale Schaltungen und Systementwurf > > Hochschule für Technik und Wirtschaft Dresden > University of Applied Sciences > Fakultät Elektrotechnik / Faculty of Electrical Engineering > Friedrich-List-Platz 1, 01069 Dresden, Germany > > Web:http://www.htw-dresden.de/elektrotechnik > Phone: +49 351 462 3060 > Fax: +49 351 462 2175 > ________________________________________________________________ > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss -- From the QED manifesto: https://www.cs.ru.nl/~freek/qed/qed.html " Mathematics is arguably the foremost creation of the human mind. " |
From: Schönherr, J. <jen...@ht...> - 2017-02-21 17:26:40
|
Dear Raymond, thanks a lot for the hint to elim()! This function solves my issue. I'm still interested in the way eliminate() works. I could reproduce the unexpected behavior of eliminate() with a smaller equation system: eq1: 1/10-(k*a)=b$ eq2: b^2=a$ eq3: a=1$ es1: [eq1,eq2,eq3]$ es2: eliminate(es1,[a]); [10 k + 10 b - 1, (-10 b^2 k) - 10 b + 1] es2[1] is subst(1, a, eq1) because of eq3 es2[2] is subst(b^2, a, eq1) because of eq2 k=0 is no solution of es1 but of es2. Is this a bug of eliminate()? I'd expect that eliminate() uses only one substitution e.g. subst(<expr>, a, <eq>) for all equations <eq>. Do you have any idea why eliminate() works as it does? Kind regards, Jens Von: Raymond Rogers [mailto:ray...@gm...] Gesendet: Montag, 20. Februar 2017 15:42 An: max...@li... Betreff: Re: [Maxima-discuss] Question regarding eliminate() You might find 'elim()' from load(to_poly_solve) ; interesting. In this case e1,e2 are identical and you can see the "pivot points". (%i16) e1: elim([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); (e1) [[1000000000000*k^4-40000000000*k^3+600000000*k^2-4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] (%i17) e2: elim([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); (e2) [[1000000000000*k^4-40000000000*k^3+600000000*k^2-4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] If needed I can insert some MathML or Latex for the above. Just have to find the plugin. Looking at the original equations one can mentally do a resolution and it seems that the factor "k=0" from eliminate is bogus. That is to say: I can't see how one ever gets more than a fourth order polynomial in k. RayR On 02/20/2017 06:08 AM, Prof. Jens Schönherr wrote: Hello, the code of my previous posting is not shown right. Here is the source code of it: eq1: ue-(k*ua)=ue1; eq2: 10000*(ue1^2)=ue2; eq3: 10000*(ue2^2)=ua; eq4: ue=1/100; eq5: ua=1; e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); s1: solve(e1,[k]); s2: solve(e2,[k]); and the results: (%i6) e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); 2 (%o6) [10000000000000000 k 4 3 2 2 (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + 9999) ] (%i7) e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); (%o7) [10000000000000000 4 3 2 2 (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + 9999) ] (%i8) s1: solve(e1,[k]); 9 11 %i - 10 %i + 10 (%o8) [k = ----, k = ----, k = - -------, k = -------, k = 0] 1000 1000 1000 1000 (%i9) s2: solve(e2,[k]); 9 11 %i - 10 %i + 10 (%o9) [k = ----, k = ----, k = - -------, k = -------] 1000 1000 1000 1000 The s1 contains k=0 as a solution which is not the case for s2. Many thanks and best regards, Jens Am 19.02.2017 um 20:07 schrieb Prof. Jens Schönherr: Hello, I'm using maxima to solve equation systems symbolically. To simplify the result, I eliminate "superfluous" variables first. For the following example the result depends on the variable order: e1 and e2 lead to different solutions and the only difference is the order of variables in eliminate() (ua before ue or vice versa). In this case, e1 gets a solution more (k=0). However, k=0 is not a solution of the original equation system [eq1...eq5]. Is there a reason why the order of the variables of eliminate() is important for the solution? Is there a rule to find a variable order that leads to correct results of solve? Otherwise, one has to loop over all results and check whether its a solution. Many thanks! Jens |
From: Stavros M. (Σ. Μ. <mac...@al...> - 2017-02-21 21:52:10
|
I don't know why "eliminate" works this way, but the following gives the solution directly: solve([ue-k*ua = ue1,10000*ue1^2 = ue2,10000*ue2^2 = ua,ue = 1/100,ua = 1], [ua,ue,ue1,ue2,k]) I verified that all permutations of variable orders give the same result (though in different orders). -s On Tue, Feb 21, 2017 at 12:26 PM, Schönherr, Jens < jen...@ht...> wrote: > Dear Raymond, > > thanks a lot for the hint to elim()! This function solves my issue. > > I'm still interested in the way eliminate() works. I could reproduce the > unexpected behavior of eliminate() with a smaller equation system: > eq1: 1/10-(k*a)=b$ > eq2: b^2=a$ > eq3: a=1$ > es1: [eq1,eq2,eq3]$ > es2: eliminate(es1,[a]); > [10 k + 10 b - 1, (-10 b^2 k) - 10 b + 1] > es2[1] is subst(1, a, eq1) because of eq3 > es2[2] is subst(b^2, a, eq1) because of eq2 > > k=0 is no solution of es1 but of es2. Is this a bug of eliminate()? I'd > expect that eliminate() uses only one substitution e.g. subst(<expr>, a, > <eq>) for all equations <eq>. Do you have any idea why eliminate() works as > it does? > > Kind regards, > > Jens > > Von: Raymond Rogers [mailto:ray...@gm...] > Gesendet: Montag, 20. Februar 2017 15:42 > An: max...@li... > Betreff: Re: [Maxima-discuss] Question regarding eliminate() > > You might find 'elim()' from > > load(to_poly_solve) ; > > interesting. > In this case e1,e2 are identical and you can see the "pivot points". > > > (%i16) e1: elim([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > (e1) [[1000000000000*k^4-40000000000*k^3+600000000*k^2- > 4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] > (%i17) e2: elim([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > (e2) [[1000000000000*k^4-40000000000*k^3+600000000*k^2- > 4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] > > If needed I can insert some MathML or Latex for the above. Just have to > find the plugin. > > Looking at the original equations one can mentally do a resolution and it > seems that the factor "k=0" from eliminate is bogus. That is to say: I > can't see how one ever gets more than a fourth order polynomial in k. > > RayR > On 02/20/2017 06:08 AM, Prof. Jens Schönherr wrote: > Hello, > > the code of my previous posting is not shown right. Here is the source > code of it: > > eq1: ue-(k*ua)=ue1; > eq2: 10000*(ue1^2)=ue2; > eq3: 10000*(ue2^2)=ua; > eq4: ue=1/100; > eq5: ua=1; > e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > s1: solve(e1,[k]); > s2: solve(e2,[k]); > > and the results: > (%i6) e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > 2 > (%o6) [10000000000000000 k > 4 3 > 2 2 > (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + > 9999) ] > (%i7) e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > (%o7) [10000000000000000 > 4 3 > 2 2 > (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + > 9999) ] > (%i8) s1: solve(e1,[k]); > 9 11 %i - 10 %i + 10 > (%o8) [k = ----, k = ----, k = - -------, k = -------, k = 0] > 1000 1000 1000 1000 > (%i9) s2: solve(e2,[k]); > 9 11 %i - 10 %i + 10 > (%o9) [k = ----, k = ----, k = - -------, k = -------] > 1000 1000 1000 1000 > > The s1 contains k=0 as a solution which is not the case for s2. > > Many thanks and best regards, > > Jens > Am 19.02.2017 um 20:07 schrieb Prof. Jens Schönherr: > Hello, > > I'm using maxima to solve equation systems symbolically. To simplify the > result, I eliminate "superfluous" variables first. For the following > example the result depends on the variable order: > > e1 and e2 lead to different solutions and the only difference is the order > of variables in eliminate() (ua before ue or vice versa). In this case, e1 > gets a solution more (k=0). However, k=0 is not a solution of the original > equation system [eq1...eq5]. > > Is there a reason why the order of the variables of eliminate() is > important for the solution? Is there a rule to find a variable order that > leads to correct results of solve? Otherwise, one has to loop over all > results and check whether its a solution. > > Many thanks! > > Jens > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |
From: Raymond R. <ray...@gm...> - 2017-02-21 20:32:40
|
Jens, I don't know the eliminate procedure in Maxima but your analysis is interesting. For "es2[2] is subst(b^2, a, eq1) because of eq2" That is born out as correct. Except eliminate[eq3,eq2],[a])=b^2-1 isn't retained. Notice that by ignoring things like this I can add es2[1]+es2[2] =-10*k*(b^2-1) Wa..laa I have introduced k as a solution! additionally notice that the "real" solution is b= +- 1 k= (+-1-1/10)/1 There is also a subtlety that your two terms es2 while individually solvable to k can only both be true for particular values of b (ie. +-1) ; which leaves k undetermined. Like x*2-x*2=0 doesn't say much about x. As a matter of fact if f(x)-g(x)=0 then x*(f(x)-g(x))=0 but the doesn't say anything about the original problem. Sort of rambling but I think the real problem is that es2 didn't include. eliminate([eq3,eq2],[a])=b^2-1 in the eliminate equation set. It kept eliminate([eq1,eq2],[a]); eliminate([eq1,eq3],[a]); and said @#$@# it , I quit. Ray On 02/21/2017 12:26 PM, Schönherr, Jens wrote: > Dear Raymond, > > thanks a lot for the hint to elim()! This function solves my issue. > > I'm still interested in the way eliminate() works. I could reproduce the unexpected behavior of eliminate() with a smaller equation system: > eq1: 1/10-(k*a)=b$ > eq2: b^2=a$ > eq3: a=1$ > es1: [eq1,eq2,eq3]$ > es2: eliminate(es1,[a]); > [10 k + 10 b - 1, (-10 b^2 k) - 10 b + 1] > es2[1] is subst(1, a, eq1) because of eq3 > es2[2] is subst(b^2, a, eq1) because of eq2 > > k=0 is no solution of es1 but of es2. Is this a bug of eliminate()? I'd expect that eliminate() uses only one substitution e.g. subst(<expr>, a, <eq>) for all equations <eq>. Do you have any idea why eliminate() works as it does? > > Kind regards, > > Jens > > Von: Raymond Rogers [mailto:ray...@gm...] > Gesendet: Montag, 20. Februar 2017 15:42 > An: max...@li... > Betreff: Re: [Maxima-discuss] Question regarding eliminate() > > You might find 'elim()' from > > load(to_poly_solve) ; > > interesting. > In this case e1,e2 are identical and you can see the "pivot points". > > > (%i16) e1: elim([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > (e1) [[1000000000000*k^4-40000000000*k^3+600000000*k^2-4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] > (%i17) e2: elim([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > (e2) [[1000000000000*k^4-40000000000*k^3+600000000*k^2-4000000*k+9999],[ue2-10000*k^2+200*k-1,100*ue1+100*k-1,100*ue-1,ua-1]] > > If needed I can insert some MathML or Latex for the above. Just have to find the plugin. > > Looking at the original equations one can mentally do a resolution and it seems that the factor "k=0" from eliminate is bogus. That is to say: I can't see how one ever gets more than a fourth order polynomial in k. > > RayR > On 02/20/2017 06:08 AM, Prof. Jens Schönherr wrote: > Hello, > > the code of my previous posting is not shown right. Here is the source code of it: > > eq1: ue-(k*ua)=ue1; > eq2: 10000*(ue1^2)=ue2; > eq3: 10000*(ue2^2)=ua; > eq4: ue=1/100; > eq5: ua=1; > e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > s1: solve(e1,[k]); > s2: solve(e2,[k]); > > and the results: > (%i6) e1: eliminate([eq1,eq2,eq3,eq4,eq5],[ua,ue,ue1,ue2]); > 2 > (%o6) [10000000000000000 k > 4 3 2 2 > (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + 9999) ] > (%i7) e2: eliminate([eq1,eq2,eq3,eq4,eq5],[ue,ua,ue1,ue2]); > (%o7) [10000000000000000 > 4 3 2 2 > (1000000000000 k - 40000000000 k + 600000000 k - 4000000 k + 9999) ] > (%i8) s1: solve(e1,[k]); > 9 11 %i - 10 %i + 10 > (%o8) [k = ----, k = ----, k = - -------, k = -------, k = 0] > 1000 1000 1000 1000 > (%i9) s2: solve(e2,[k]); > 9 11 %i - 10 %i + 10 > (%o9) [k = ----, k = ----, k = - -------, k = -------] > 1000 1000 1000 1000 > > The s1 contains k=0 as a solution which is not the case for s2. > > Many thanks and best regards, > > Jens > Am 19.02.2017 um 20:07 schrieb Prof. Jens Schönherr: > Hello, > > I'm using maxima to solve equation systems symbolically. To simplify the result, I eliminate "superfluous" variables first. For the following example the result depends on the variable order: > > e1 and e2 lead to different solutions and the only difference is the order of variables in eliminate() (ua before ue or vice versa). In this case, e1 gets a solution more (k=0). However, k=0 is not a solution of the original equation system [eq1...eq5]. > > Is there a reason why the order of the variables of eliminate() is important for the solution? Is there a rule to find a variable order that leads to correct results of solve? Otherwise, one has to loop over all results and check whether its a solution. > > Many thanks! > > Jens > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss -- From the QED manifesto: https://www.cs.ru.nl/~freek/qed/qed.html " Mathematics is arguably the foremost creation of the human mind. " |
From: Thomas D. D. <to...@sp...> - 2017-02-21 20:52:56
|
On 02/21/2017 12:32 PM, Raymond Rogers wrote: > Jens, > I don't know the eliminate procedure in Maxima but your analysis is > interesting. > For "es2[2] is subst(b^2, a, eq1) because of eq2" > That is born out as correct. Except > eliminate[eq3,eq2],[a])=b^2-1 > isn't retained. > Notice that by ignoring things like this I can add > es2[1]+es2[2] =-10*k*(b^2-1) > Wa..laa I have introduced k as a solution! > additionally notice that the "real" solution is > b= +- 1 > k= (+-1-1/10)/1 > There is also a subtlety that your two terms es2 while individually > solvable to k can only both be true for particular values of b (ie. +-1) > ; which leaves k undetermined. Like x*2-x*2=0 doesn't say much about > x. As a matter of fact if f(x)-g(x)=0 then x*(f(x)-g(x))=0 but the > doesn't say anything about the original problem. > > Sort of rambling but I think the real problem is that es2 didn't include. > eliminate([eq3,eq2],[a])=b^2-1 > in the eliminate equation set. > It kept > eliminate([eq1,eq2],[a]); > eliminate([eq1,eq3],[a]); > and said @#$@# it , > I quit. It seems, in this case, that eliminate is having unnatural relations with the pooch. Two of the equations assign numerical values to variables. The problem begs for use of subst, not eliminate, at first. eq1: ue-(k*ua)=ue1; eq2: 10000*(ue1^2)=ue2; eq3: 10000*(ue2^2)=ua; eq4: ue=1/100; eq5: ua=1; eqn: subst([eq4,eq5],[eq1,eq2,eq3]); eqk: eliminate(eqn,[ue1,ue2]); solve(eqk); Tom Dean |
From: Michel T. <ta...@lp...> - 2017-02-22 09:39:06
|
Le 21/02/2017 à 18:26, Schönherr, Jens a écrit : > I'm still interested in the way eliminate() works. I could reproduce the unexpected behavior of eliminate() with a smaller equation system: > eq1: 1/10-(k*a)=b$ > eq2: b^2=a$ > eq3: a=1$ > es1: [eq1,eq2,eq3]$ > es2: eliminate(es1,[a]); > [10 k + 10 b - 1, (-10 b^2 k) - 10 b + 1] > es2[1] is subst(1, a, eq1) because of eq3 > es2[2] is subst(b^2, a, eq1) because of eq2 > > k=0 is no solution of es1 but of es2. Is this a bug of eliminate()? I'd expect that eliminate() uses only one substitution e.g. subst(<expr>, a, <eq>) for all equations <eq>. Do you have any idea why eliminate() works as it does? > > Kind regards, > > Jens As the documentation of eliminate says, it works by computing resultants. So let us reproduce what it does: (%i1) display2d: true; (%o1) true (%i2) p1:1/10-a*k - b$ p2:b^2 - a$ p3:a-1$ (%i5) q1:resultant(p1,p2,a); 2 (%o5) (- 10 b k) - 10 b + 1 (%i6) q2:resultant(p1,p3,a); (%o6) 10 k + 10 b - 1 (%i7) r:resultant(q1,q2,b); 2 (%o7) - 10 k (100 k - 20 k - 99) (%i8) solve(%); 9 11 (%o8) [k = - --, k = --, k = 0] 10 10 So the problem is that eliminate does not work the way you think. It does not substitute a=1 in the other equations, etc. Here the extraneous solution k=0 appears. Is it true that for k=0, q1 and q2 have a common root? Yes, it is b=1/10. In this case p1 vanishes identically, p2 is 1/100 -a, so p1 and p2 have a common root a=1/100 while p1 and p3 have a common root a=1. The fact that these roots are not the same, the algorithms is not aware of. The moral of the story is that things can degenerate in the course of affairs and don't produce what you believe. PS. as an aside, note that while we have display2d: true; solve gives a 2d display. This is a bug somewhere. -- Michel Talon |
From: Michel T. <ta...@lp...> - 2017-02-22 09:52:26
|
Le 22/02/2017 à 10:38, Michel Talon a écrit : > As the documentation of eliminate says, it works by computing > resultants. So let us reproduce what it does: > > (%i1) display2d: true; Sorry there is a bug here! it should be display2d:false; (%i2) p1:1/10-a*k - b$ p2:b^2 - a$ p3:a-1$ q1:resultant(p1,p2,a); q2:resultant(p1,p3,a); r:resultant(q1,q2,b); solve(%); (%o5) (-10*b^2*k)-10*b+1 (%o6) 10*k+10*b-1 (%o7) -10*k*(100*k^2-20*k-99) (%o8) [k = -9/10,k = 11/10,k = 0] -- Michel Talon |
From: Raymond R. <ray...@gm...> - 2017-02-22 14:35:07
|
On 02/22/2017 04:38 AM, Michel Talon wrote: > Le 21/02/2017 à 18:26, Schönherr, Jens a écrit : >> I'm still interested in the way eliminate() works. I could reproduce the unexpected behavior of eliminate() with a smaller equation system: >> eq1: 1/10-(k*a)=b$ >> eq2: b^2=a$ >> eq3: a=1$ >> es1: [eq1,eq2,eq3]$ >> es2: eliminate(es1,[a]); >> [10 k + 10 b - 1, (-10 b^2 k) - 10 b + 1] >> es2[1] is subst(1, a, eq1) because of eq3 >> es2[2] is subst(b^2, a, eq1) because of eq2 >> >> k=0 is no solution of es1 but of es2. Is this a bug of eliminate()? I'd expect that eliminate() uses only one substitution e.g. subst(<expr>, a, <eq>) for all equations <eq>. Do you have any idea why eliminate() works as it does? >> >> Kind regards, >> >> Jens > As the documentation of eliminate says, it works by computing > resultants. So let us reproduce what it does: > > (%i1) display2d: true; > (%o1) true > (%i2) p1:1/10-a*k - b$ p2:b^2 - a$ p3:a-1$ > > (%i5) q1:resultant(p1,p2,a); > 2 > (%o5) (- 10 b k) - 10 b + 1 > (%i6) q2:resultant(p1,p3,a); > (%o6) 10 k + 10 b - 1 > (%i7) r:resultant(q1,q2,b); > 2 > (%o7) - 10 k (100 k - 20 k - 99) > (%i8) solve(%); > 9 11 > (%o8) [k = - --, k = --, k = 0] > 10 10 > So the problem is that eliminate does not work the way you think. It > does not substitute a=1 in the other equations, etc. > > Here the extraneous solution k=0 appears. Is it true that for k=0, q1 > and q2 have a common root? Yes, it is b=1/10. In this case p1 vanishes > identically, p2 is 1/100 -a, so p1 and p2 have a common root a=1/100 > while p1 and p3 have a common root a=1. The fact that these roots are > not the same, the algorithms is not aware of. The moral of the story is > that things can degenerate in the course of affairs and don't produce > what you believe. > > PS. as an aside, note that while we have display2d: true; solve gives > a 2d display. This is a bug somewhere. > > From Wikipedia https://en.wikipedia.org/wiki/Resultant#Elimination_properties : "Unfortunately, this introduce many spurious solutions, which are difficult to remove." -- So don't use "eliminate" in solving? Either go to "elim" or Grobner basis? Actually I like Grobner basis (in Axiom after some research) but it takes some work to clean out answers you don't like (or even to recognize them). |
From: Schönherr, J. <jen...@ht...> - 2017-02-22 19:17:48
|
Thanks a lot for the discussion! At the end, the behavior in question is known and is caused by the underlying algorithm. In general, eliminate() is not applicable to transform equation systems in a way that the set of solutions keeps unchanged because it adds sometimes solutions (as found by Raymond in Wikipedia). To avoid similar misunderstandings in the future I'd recommend to add a note in the documentation of eliminate(). Is there an official way to file a change request? Best regards, Jens -----Ursprüngliche Nachricht----- Von: Michel Talon [mailto:ta...@lp...] Gesendet: Mittwoch, 22. Februar 2017 10:39 An: max...@li... Betreff: Re: [Maxima-discuss] Question regarding eliminate() Le 21/02/2017 à 18:26, Schönherr, Jens a écrit : > I'm still interested in the way eliminate() works. I could reproduce the unexpected behavior of eliminate() with a smaller equation system: > eq1: 1/10-(k*a)=b$ > eq2: b^2=a$ > eq3: a=1$ > es1: [eq1,eq2,eq3]$ > es2: eliminate(es1,[a]); > [10 k + 10 b - 1, (-10 b^2 k) - 10 b + 1] es2[1] is subst(1, a, eq1) > because of eq3 es2[2] is subst(b^2, a, eq1) because of eq2 > > k=0 is no solution of es1 but of es2. Is this a bug of eliminate()? I'd expect that eliminate() uses only one substitution e.g. subst(<expr>, a, <eq>) for all equations <eq>. Do you have any idea why eliminate() works as it does? > > Kind regards, > > Jens As the documentation of eliminate says, it works by computing resultants. So let us reproduce what it does: (%i1) display2d: true; (%o1) true (%i2) p1:1/10-a*k - b$ p2:b^2 - a$ p3:a-1$ (%i5) q1:resultant(p1,p2,a); 2 (%o5) (- 10 b k) - 10 b + 1 (%i6) q2:resultant(p1,p3,a); (%o6) 10 k + 10 b - 1 (%i7) r:resultant(q1,q2,b); 2 (%o7) - 10 k (100 k - 20 k - 99) (%i8) solve(%); 9 11 (%o8) [k = - --, k = --, k = 0] 10 10 So the problem is that eliminate does not work the way you think. It does not substitute a=1 in the other equations, etc. Here the extraneous solution k=0 appears. Is it true that for k=0, q1 and q2 have a common root? Yes, it is b=1/10. In this case p1 vanishes identically, p2 is 1/100 -a, so p1 and p2 have a common root a=1/100 while p1 and p3 have a common root a=1. The fact that these roots are not the same, the algorithms is not aware of. The moral of the story is that things can degenerate in the course of affairs and don't produce what you believe. PS. as an aside, note that while we have display2d: true; solve gives a 2d display. This is a bug somewhere. -- Michel Talon |
From: Robert D. <rob...@gm...> - 2017-02-23 15:43:32
|
On 2017-02-22, Schönherr Jens <jen...@ht...> wrote: > To avoid similar misunderstandings in the future I'd recommend to add > a note in the documentation of eliminate(). Is there an official way > to file a change request? Well, there are some different ways to do that. * post a message to this mailing list with the suggested text * open a bug report https://sourceforge.net/p/maxima/bugs/ * submit a patch https://sourceforge.net/p/maxima/patches/ The bad news is that this project has a lot of catching up to do -- there are many open requests for changes which have not been processed. So if you do make a request, there is a nonzero probability that it will not get processed in a timely manner. That said, thanks for your help, I appreciate it very much. best, Robert Dodier |
From: Robert D. <rob...@gm...> - 2017-02-23 15:50:23
|
On 2017-02-22, Michel Talon <ta...@lp...> wrote: > So the problem is that eliminate does not work the way you think. It > does not substitute a=1 in the other equations, etc. > > Here the extraneous solution k=0 appears. Is it true that for k=0, q1 > and q2 have a common root? Yes, it is b=1/10. In this case p1 vanishes > identically, p2 is 1/100 -a, so p1 and p2 have a common root a=1/100 > while p1 and p3 have a common root a=1. The fact that these roots are > not the same, the algorithms is not aware of. The moral of the story is > that things can degenerate in the course of affairs and don't produce > what you believe. Is it straightforward to formalize these considerations to invent a stronger function for solving equations? best Robert Dodier |