| |
 |
|
|
Science Forum Index » Math - Symbolic Forum » Is this a Maxima bug or is it just me, again?...
Page 1 of 1
|
| Author |
Message |
| pnachtwey... |
Posted: Fri Jul 25, 2008 8:15 am |
|
|
|
Guest
|
s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
doesn't solve. I have a MacPro and this still takes many seconds to
come up with this answer, []. My Mathcad can do this almost
instantly running on VMware's Fusion. The answer is not simple but I
have seem Maxima solve symbolic problems that look much more
difficult.
Is there a math technique that Maxima doesn't have that it should or
is this a bug or did I enter the equation incorrectly or must I use
some math technique?
Peter Nachtwey |
|
|
| Back to top |
|
| ... |
Posted: Sat Jul 26, 2008 7:12 pm |
|
|
|
Guest
|
pnachtwey schrieb:
Quote: s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
doesn't solve. I have a MacPro and this still takes many seconds to
come up with this answer, []. My Mathcad can do this almost
instantly running on VMware's Fusion. The answer is not simple but I
have seem Maxima solve symbolic problems that look much more
difficult.
Is there a math technique that Maxima doesn't have that it should or
is this a bug or did I enter the equation incorrectly or must I use
some math technique?
Speed aside, whether Maxima can solve it or not should not depend on
the computer. Yours is a polynomial system, and many computer algebra
systems solve those by calculating a Groebner basis (via the
Buchberger algorithm, dating from about 1970). You can verify the
correct syntax by feeding Maxima a linear system first. Perhaps there
is a Groebner Basis library that you need to load? Derive 6.10 can
solve your system right away:
SOLVE([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y])
[x=((y0-y1)*SQRT(4*r^2-x0^2+2*x0*x1-x1^2-y0^2+2*y0*y1-y1^2)*SIGN~
(x0-x1)+(x0+x1)*SQRT(x0^2-2*x0*x1+x1^2+y0^2-2*y0*y1+y1^2))/(2*SQ~
RT(x0^2-2*x0*x1+x1^2+y0^2-2*y0*y1+y1^2)) AND y=(SQRT(x0^2-2*x0*x~
1+x1^2+y0^2-2*y0*y1+y1^2)*(y0+y1)-SQRT(4*r^2-x0^2+2*x0*x1-x1^2-y~
0^2+2*y0*y1-y1^2)*ABS(x0-x1))/(2*SQRT(x0^2-2*x0*x1+x1^2+y0^2-2*y~
0*y1+y1^2)),x=((x0+x1)*SQRT(x0^2-2*x0*x1+x1^2+y0^2-2*y0*y1+y1^2)~
-(y0-y1)*SQRT(4*r^2-x0^2+2*x0*x1-x1^2-y0^2+2*y0*y1-y1^2)*SIGN(x0~
-x1))/(2*SQRT(x0^2-2*x0*x1+x1^2+y0^2-2*y0*y1+y1^2)) AND y=(SQRT(~
4*r^2-x0^2+2*x0*x1-x1^2-y0^2+2*y0*y1-y1^2)*ABS(x0-x1)+SQRT(x0^2-~
2*x0*x1+x1^2+y0^2-2*y0*y1+y1^2)*(y0+y1))/(2*SQRT(x0^2-2*x0*x1+x1~
^2+y0^2-2*y0*y1+y1^2))]
The Groebner basis (note that I have written the equations as
polynomials) for variable order [x,y] is:
GROEBNER_BASIS([(x-x0)^2+(y-y0)^2-r^2,(x-x1)^2+(y-y1)^2-r^2],[x,y])
[y^2*(4*x0^2-8*x0*x1+4*x1^2+4*y0^2-8*y0*y1+4*y1^2)-y*(x0^2*(4*y0~
+4*y1)-x0*x1*(8*y0+8*y1)+x1^2*(4*y0+4*y1)+4*y0^3-4*y0^2*y1-4*y0*~
y1^2+4*y1^3)-r^2*(4*x0^2-8*x0*x1+4*x1^2)+x0^4-4*x0^3*x1+x0^2*(6*~
x1^2+2*y0^2+2*y1^2)-x0*(4*x1^3+x1*(4*y0^2+4*y1^2))+x1^4+x1^2*(2*~
y0^2+2*y1^2)+y0^4-2*y0^2*y1^2+y1^4,x*(2*x0-2*x1)+y*(2*y0-2*y1)-x~
0^2+x1^2-y0^2+y1^2,x*(y*(4*y0-4*y1)-2*y0^2+2*y1^2)+y^2*(4*x1-4*x~
0)+y*(x0*(2*y0+6*y1)-x1*(6*y0+2*y1))+r^2*(4*x0-4*x1)-x0^3+3*x0^2~
*x1-x0*(3*x1^2+y0^2+3*y1^2)+x1^3+x1*(3*y0^2+y1^2),x^2-2*x1*x+y^2~
-2*y1*y-r^2+x1^2+y1^2]
Here the first polynomial depends on y only; you can now solve this
system for zero right-hand sides instead of the original system.
Martin. |
|
|
| Back to top |
|
| rjf... |
Posted: Sun Jul 27, 2008 3:13 am |
|
|
|
Guest
|
On Jul 26, 10:12 pm, cliclic... at (no spam) freenet.de wrote:
Quote: pnachtwey schrieb:
s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
....
try s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y,r]);
which takes 0.3 seconds on my system. |
|
|
| Back to top |
|
| none... |
Posted: Mon Jul 28, 2008 5:05 pm |
|
|
|
Guest
|
On Sun, 27 Jul 2008 06:13:53 -0700, rjf wrote:
Quote: On Jul 26, 10:12 pm, cliclic... at (no spam) freenet.de wrote:
pnachtwey schrieb:
s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
...
try s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y,r]);
which takes 0.3 seconds on my system.
I tried this and it 'works', but ...
[1] Why do we have two equations solved in three unknowns? When I've done
this before - in error - I've had a reasonable prompt from Maxima that the
system cannot be solved. Under what conditions if Maxima returns an empty
list should I try and request *additional* unknowns to be solved?
[2] The analytical result seemed way too complex to be useable ... is this
just my ignorance? Could it have been simplified? I've used Maxima before
to generate analytical results in projects to demonstrate why a numerical
solution, despite possibly being slower, makes for better maintenance as
it keeps the solution easier to understand for the future.
My background is an engineer using Maxima to assist in solving equations,
rather than a mathematician versed in CAS. |
|
|
| Back to top |
|
| ... |
Posted: Mon Jul 28, 2008 7:15 pm |
|
|
|
Guest
|
none schrieb:
Quote: On Sun, 27 Jul 2008 06:13:53 -0700, rjf wrote:
On Jul 26, 10:12 pm, cliclic... at (no spam) freenet.de wrote:
pnachtwey schrieb:
s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
...
try s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y,r]);
which takes 0.3 seconds on my system.
I tried this and it 'works', but ...
[1] Why do we have two equations solved in three unknowns? When I've done
this before - in error - I've had a reasonable prompt from Maxima that the
system cannot be solved. Under what conditions if Maxima returns an empty
list should I try and request *additional* unknowns to be solved?
[2] The analytical result seemed way too complex to be useable ... is this
just my ignorance? Could it have been simplified? I've used Maxima before
to generate analytical results in projects to demonstrate why a numerical
solution, despite possibly being slower, makes for better maintenance as
it keeps the solution easier to understand for the future.
My background is an engineer using Maxima to assist in solving equations,
rather than a mathematician versed in CAS.
If Maxima is meant to be able to deal with polynomial systems of
equations (by calculating Groebner bases, say), its empty response []
to SOLVE([(x-x0)^2 + (y-y0)^2 = r^2, (x-x1)^2 + (y-y1)^2 = r^2], [x,
y]) has to be considered a bug, no doubt.
The introduction of the additional variable r was not meant as a cure
in cases where an algebra system returns an empty set of solutions. It
serves to demonstrate, however, that Maxima is not always helpless
when faced with a polynomial system of equations. And if the solution
itself is correct, the behavior is indeed what one should expect.
Compare Derive 6.10 for a case of intersecting straight lines:
SOLVE([x+y = a, x-y = 0], [x, y])
[x = a/2 AND y = a/2]
SOLVE([x+y = a, x-y = 0], [x, y, a])
[x-a/2 = 0 AND y-a/2 = 0]
Can you post Maxima's answer to SOLVE([..., ...], [x, y, r]) for us to
see if it is correct and perhaps unnecessarily complicated? Even a
complicated symbolic solution may be quicker to evaluate for specific
parameters values than a new numerical one can be calculated. And
there is the complicated issue of multiplicity; in the present case of
intersecting circles there will be two solutions in general.
Martin. |
|
|
| Back to top |
|
| Robert H. Lewis... |
Posted: Tue Jul 29, 2008 1:53 am |
|
|
|
Guest
|
Quote: On Sun, 27 Jul 2008 06:13:53 -0700, rjf wrote:
On Jul 26, 10:12 pm, cliclic... at (no spam) freenet.de wrote:
pnachtwey schrieb:
I tried this and it 'works', but ...
.....
[2] The analytical result seemed way too complex to
be useable ... is this
just my ignorance? Could it have been simplified?
I've used Maxima before
to generate analytical results in projects to
demonstrate why a numerical
solution, despite possibly being slower, makes for
better maintenance as
it keeps the solution easier to understand for the
future.
My background is an engineer using Maxima to assist
in solving equations,
rather than a mathematician versed in CAS.
This analytical result seems to be quite modest to me. I routinely solve systems of polynomial equations symbolically, yielding a polynomial in easily ten parameters with > 10000 terms. Piece of cake.
There is great value to having a symbolic solution. Not only can you check for multiple roots, you can take partial derivatives with respect to any parameter. There are more sophisticated reasons too in some cases.
Robert H. Lewis
Fordham University
New York
http://home.bway.net/lewis/ |
|
|
| Back to top |
|
| G. A. Edgar... |
Posted: Tue Jul 29, 2008 7:13 am |
|
|
|
Guest
|
In article <pan.2008.07.28.22.05.14.44000 at (no spam) none.net>, none
<none at (no spam) none.net> wrote:
Quote: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
I tried it with Maple, I get the result below. You solve a quadratic
equation, the coefficients are given in terms of the parameters of the
problem.
y =
RootOf((-8*x1*x0-8*y0*y1+4*y0^2+4*y1^2+4*x0^2+4*x1^2)*_Z^2+(-4*x0^2*y0-4
*x0^2*y1-4*y0*x1^2+4*y0^2*y1+4*y0*y1^2+8*x1*x0*y0-4*y1^3-4*x1^2*y1-4*y0^
3+8*x1*x0*y1)*_Z+(2*x0^2*y0^2-4*x1*x0*y1^2+2*x0^2*y1^2+2*y0^2*x1^2-4*x1*
x0*y0^2+2*x1^2*y1^2-4*x1*x0^3-4*x1^3*x0+x0^4-4*r^2*x0^2-4*r^2*x1^2+y1^4+
8*r^2*x0*x1-2*y0^2*y1^2+6*x0^2*x1^2+x1^4+y0^4))
x = -(1/2)*(2*y*y0-2*y*y1-x0^2-y0^2+x1^2+y1^2)/(x0-x1)
--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/ |
|
|
| Back to top |
|
| Axel Vogt... |
Posted: Tue Jul 29, 2008 10:03 am |
|
|
|
Guest
|
G. A. Edgar wrote:
Quote: In article <pan.2008.07.28.22.05.14.44000 at (no spam) none.net>, none
none at (no spam) none.net> wrote:
solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
I tried it with Maple, I get the result below. You solve a quadratic
equation, the coefficients are given in terms of the parameters of the
problem.
y =
RootOf((-8*x1*x0-8*y0*y1+4*y0^2+4*y1^2+4*x0^2+4*x1^2)*_Z^2+(-4*x0^2*y0-4
*x0^2*y1-4*y0*x1^2+4*y0^2*y1+4*y0*y1^2+8*x1*x0*y0-4*y1^3-4*x1^2*y1-4*y0^
3+8*x1*x0*y1)*_Z+(2*x0^2*y0^2-4*x1*x0*y1^2+2*x0^2*y1^2+2*y0^2*x1^2-4*x1*
x0*y0^2+2*x1^2*y1^2-4*x1*x0^3-4*x1^3*x0+x0^4-4*r^2*x0^2-4*r^2*x1^2+y1^4+
8*r^2*x0*x1-2*y0^2*y1^2+6*x0^2*x1^2+x1^4+y0^4))
x = -(1/2)*(2*y*y0-2*y*y1-x0^2-y0^2+x1^2+y1^2)/(x0-x1)
.... where 'RootOf' stands for the solution of the quadratic equation |
|
|
| Back to top |
|
| pnachtwey... |
Posted: Tue Jul 29, 2008 10:30 am |
|
|
|
Guest
|
On Jul 29, 8:03 am, Axel Vogt <&nore... at (no spam) axelvogt.de> wrote:
Quote: G. A. Edgar wrote:
In article <pan.2008.07.28.22.05.14.44... at (no spam) none.net>, none
n... at (no spam) none.net> wrote:
solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
I tried it with Maple, I get the result below. You solve a quadratic
equation, the coefficients are given in terms of the parameters of the
problem.
y > > RootOf((-8*x1*x0-8*y0*y1+4*y0^2+4*y1^2+4*x0^2+4*x1^2)*_Z^2+(-4*x0^2*y0-4
*x0^2*y1-4*y0*x1^2+4*y0^2*y1+4*y0*y1^2+8*x1*x0*y0-4*y1^3-4*x1^2*y1-4*y0^
3+8*x1*x0*y1)*_Z+(2*x0^2*y0^2-4*x1*x0*y1^2+2*x0^2*y1^2+2*y0^2*x1^2-4*x1*
x0*y0^2+2*x1^2*y1^2-4*x1*x0^3-4*x1^3*x0+x0^4-4*r^2*x0^2-4*r^2*x1^2+y1^4+
8*r^2*x0*x1-2*y0^2*y1^2+6*x0^2*x1^2+x1^4+y0^4))
x = -(1/2)*(2*y*y0-2*y*y1-x0^2-y0^2+x1^2+y1^2)/(x0-x1)
... where 'RootOf' stands for the solution of the quadratic equation
I thought I had responded to this thread but I guess not. Yes, this
should be a simple problem. This is just one of many Mathcad
worksheets I was converting to Maxima when I came across this simple
example. I agree with none in the previous thread. This is an
engineering problem for a CNC machine or some other form of motion
planner. I can see that the term 'grobner basis' keeps popping up. I
looks like I will need to learn what it is all about. I tried to
follow Martin's example above but when I load(affine) and
load(grobner) to I get errors and warnings during the load. |
|
|
| Back to top |
|
| none... |
Posted: Tue Jul 29, 2008 4:31 pm |
|
|
|
Guest
|
On Mon, 28 Jul 2008 22:15:51 -0700, clicliclic wrote:
Quote:
none schrieb:
On Sun, 27 Jul 2008 06:13:53 -0700, rjf wrote:
On Jul 26, 10:12 pm, cliclic... at (no spam) freenet.de wrote:
pnachtwey schrieb:
s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y]);
...
try s: solve([(x-x0)^2+(y-y0)^2=r^2,(x-x1)^2+(y-y1)^2=r^2],[x,y,r]);
which takes 0.3 seconds on my system.
I tried this and it 'works', but ...
[1] Why do we have two equations solved in three unknowns? When I've done
this before - in error - I've had a reasonable prompt from Maxima that the
system cannot be solved. Under what conditions if Maxima returns an empty
list should I try and request *additional* unknowns to be solved?
[2] The analytical result seemed way too complex to be useable ... is this
just my ignorance? Could it have been simplified? I've used Maxima before
to generate analytical results in projects to demonstrate why a numerical
solution, despite possibly being slower, makes for better maintenance as
it keeps the solution easier to understand for the future.
My background is an engineer using Maxima to assist in solving equations,
rather than a mathematician versed in CAS.
If Maxima is meant to be able to deal with polynomial systems of
equations (by calculating Groebner bases, say), its empty response []
to SOLVE([(x-x0)^2 + (y-y0)^2 = r^2, (x-x1)^2 + (y-y1)^2 = r^2], [x,
y]) has to be considered a bug, no doubt.
The introduction of the additional variable r was not meant as a cure
in cases where an algebra system returns an empty set of solutions. It
serves to demonstrate, however, that Maxima is not always helpless
when faced with a polynomial system of equations. And if the solution
itself is correct, the behavior is indeed what one should expect.
Compare Derive 6.10 for a case of intersecting straight lines:
SOLVE([x+y = a, x-y = 0], [x, y])
[x = a/2 AND y = a/2]
SOLVE([x+y = a, x-y = 0], [x, y, a])
[x-a/2 = 0 AND y-a/2 = 0]
Can you post Maxima's answer to SOLVE([..., ...], [x, y, r]) for us to
see if it is correct and perhaps unnecessarily complicated? Even a
complicated symbolic solution may be quicker to evaluate for specific
parameters values than a new numerical one can be calculated. And
there is the complicated issue of multiplicity; in the present case of
intersecting circles there will be two solutions in general.
Martin.
Maxima 5.15.0
(%i1) (x-x0)^2+(y-y0)^2=r^2;
(%i2) (x-x1)^2+(y-y1)^2=r^2;
(%i3) solve([%o1,%o2],[x,y,r]);
[
[x=%r1,
y=(y1^2-y0^2+x1^2-2*%r1*x1-x0^2+2*%r1*x0)/(2*y1-2*y0),
r=-(sqrt(y1^4-4*y0*y1^3+6*y0^2*y1^2+2*x1^2*y1^2-4*%r1*x1*y1^2+2*x0^2*y1^2-4*%r1*x0*y1^2+4*%r1^2*y1^2-4*y0^3*y1-4*x1^2*y0*y1+8*%r1*x1*y0*y1-4*x0^2*y0*y1+8*%r1*x0*y0*y1-8*%r1^2*y0*y1+y0^4+2*x1^2*y0^2-4*%r1*x1*y0^2+2*x0^2*y0^2-4*%r1*x0*y0^2+4*%r1^2*y0^2+x1^4-4*%r1*x1^3-2*x0^2*x1^2+4*%r1*x0*x1^2+4*%r1^2*x1^2+4*%r1*x0^2*x1-8*%r1^2*x0*x1+x0^4-4*%r1*x0^3+4*%r1^2*x0^2))/(2*y1-2*y0)
],
[x=%r2,
y=(y1^2-y0^2+x1^2-2*%r2*x1-x0^2+2*%r2*x0)/(2*y1-2*y0),
r=(sqrt(y1^4-4*y0*y1^3+6*y0^2*y1^2+2*x1^2*y1^2-4*%r2*x1*y1^2+2*x0^2*y1^2-4*%r2*x0*y1^2+4*%r2^2*y1^2-4*y0^3*y1-4*x1^2*y0*y1+8*%r2*x1*y0*y1-4*x0^2*y0*y1+8*%r2*x0*y0*y1-8*%r2^2*y0*y1+y0^4+2*x1^2*y0^2-4*%r2*x1*y0^2+2*x0^2*y0^2-4*%r2*x0*y0^2+4*%r2^2*y0^2+x1^4-4*%r2*x1^3-2*x0^2*x1^2+4*%r2*x0*x1^2+4*%r2^2*x1^2+4*%r2*x0^2*x1-8*%r2^2*x0*x1+x0^4-4*%r2*x0^3+4*%r2^2*x0^2))/(2*y1-2*y0)
]
]
So:
1. It did produce two solutions.
2. It brought out that r is not a free parameter if the two
circles must intersect
3. I am confused as to the meaning of x = %r1 and x = %r2 as solutions,
unless it is further indicating that %r1/%r2 are the true degrees of
freedom for an intersection.
4. I would hate to code up the expressions for r and have them maintained
by succeeding generations. I know that another posted spoke of 1000-term
equations as being easy for him to cope with. I deal with people who
regard dy/dx = y as having no analytic solution, and solve everything
using the Euler method - then embed the knowledge of the Euler steplength
into heuristics to the equation to promote stability.
I fully appreciate that an analytic solution can reveal more, and can be
faster - it can also be slower, where the iterative solution converges
rapidly and is being solved as a sequence of small perturbations from the
previous solution. I did have the 'joy' of an equation in my industry
(water) which has been regarded as having one (simple) solution being
revealed by Maxima as having c. 27 solutions, all but one complex &
(comparatively) ugly. However, complex solutions to the surface area of a
tank are difficult to visualise. |
|
|
| Back to top |
|
| ... |
Posted: Tue Jul 29, 2008 9:34 pm |
|
|
|
Guest
|
none schrieb:
Quote:
On Mon, 28 Jul 2008 22:15:51 -0700, clicliclic wrote:
Can you post Maxima's answer to SOLVE([..., ...], [x, y, r]) for us to
see if it is correct and perhaps unnecessarily complicated? Even a
complicated symbolic solution may be quicker to evaluate for specific
parameters values than a new numerical one can be calculated. And
there is the complicated issue of multiplicity; in the present case of
intersecting circles there will be two solutions in general.
Maxima 5.15.0
(%i1) (x-x0)^2+(y-y0)^2=r^2;
(%i2) (x-x1)^2+(y-y1)^2=r^2;
(%i3) solve([%o1,%o2],[x,y,r]);
[
[x=%r1,
y=(y1^2-y0^2+x1^2-2*%r1*x1-x0^2+2*%r1*x0)/(2*y1-2*y0),
r=-(sqrt(y1^4-4*y0*y1^3+6*y0^2*y1^2+2*x1^2*y1^2-4*%r1*x1*y1^2+2*x0^2*y1^2-4*%r1*x0*y1^2+4*%r1^2*y1^2-4*y0^3*y1-4*x1^2*y0*y1+8*%r1*x1*y0*y1-4*x0^2*y0*y1+8*%r1*x0*y0*y1-8*%r1^2*y0*y1+y0^4+2*x1^2*y0^2-4*%r1*x1*y0^2+2*x0^2*y0^2-4*%r1*x0*y0^2+4*%r1^2*y0^2+x1^4-4*%r1*x1^3-2*x0^2*x1^2+4*%r1*x0*x1^2+4*%r1^2*x1^2+4*%r1*x0^2*x1-8*%r1^2*x0*x1+x0^4-4*%r1*x0^3+4*%r1^2*x0^2))/(2*y1-2*y0)
],
[x=%r2,
y=(y1^2-y0^2+x1^2-2*%r2*x1-x0^2+2*%r2*x0)/(2*y1-2*y0),
r=(sqrt(y1^4-4*y0*y1^3+6*y0^2*y1^2+2*x1^2*y1^2-4*%r2*x1*y1^2+2*x0^2*y1^2-4*%r2*x0*y1^2+4*%r2^2*y1^2-4*y0^3*y1-4*x1^2*y0*y1+8*%r2*x1*y0*y1-4*x0^2*y0*y1+8*%r2*x0*y0*y1-8*%r2^2*y0*y1+y0^4+2*x1^2*y0^2-4*%r2*x1*y0^2+2*x0^2*y0^2-4*%r2*x0*y0^2+4*%r2^2*y0^2+x1^4-4*%r2*x1^3-2*x0^2*x1^2+4*%r2*x0*x1^2+4*%r2^2*x1^2+4*%r2*x0^2*x1-8*%r2^2*x0*x1+x0^4-4*%r2*x0^3+4*%r2^2*x0^2))/(2*y1-2*y0)
]
]
Yes, this is equivalent (in duplicate) to the Maple answer given
earlier in this thread - and it is likewise not a explicit solution
(compare the Derive result for this).
If you read %r1 and %r2 as x, the second equation of either Maxima
solution gives y in terms of x, and the third equation after squaring
is a quadratic in x with coefficients depending on r^2, x0, y0, x1, y1
only. By squaring the third equation, the Maxima pair of solutions
collapses into one, but now the quadratic will have two solutions for
x, each of them having a corresponding y.
Special attention has to be paid to the case y1=y0 where the
denominators vanish.
Martin. |
|
|
| Back to top |
|
| pnachtwey... |
Posted: Thu Jul 31, 2008 2:16 pm |
|
|
|
Guest
|
On Jul 30, 12:34 am, cliclic... at (no spam) freenet.de wrote:
Quote: none schrieb:
On Mon, 28 Jul 2008 22:15:51 -0700, clicliclic wrote:
Can you post Maxima's answer to SOLVE([..., ...], [x, y, r]) for us to
see if it is correct and perhaps unnecessarily complicated? Even a
complicated symbolic solution may be quicker to evaluate for specific
parameters values than a new numerical one can be calculated. And
there is the complicated issue of multiplicity; in the present case of
intersecting circles there will be two solutions in general.
Maxima 5.15.0
(%i1) (x-x0)^2+(y-y0)^2=r^2;
(%i2) (x-x1)^2+(y-y1)^2=r^2;
(%i3) solve([%o1,%o2],[x,y,r]);
[
[x=%r1,
y=(y1^2-y0^2+x1^2-2*%r1*x1-x0^2+2*%r1*x0)/(2*y1-2*y0),
r=-(sqrt(y1^4-4*y0*y1^3+6*y0^2*y1^2+2*x1^2*y1^2-4*%r1*x1*y1^2+2*x0^2*y1^2-4*%r1*x0*y1^2+4*%r1^2*y1^2-4*y0^3*y1-4*x1^2*y0*y1+8*%r1*x1*y0*y1-4*x0^2*y0*y1+8*%r1*x0*y0*y1-8*%r1^2*y0*y1+y0^4+2*x1^2*y0^2-4*%r1*x1*y0^2+2*x0^2*y0^2-4*%r1*x0*y0^2+4*%r1^2*y0^2+x1^4-4*%r1*x1^3-2*x0^2*x1^2+4*%r1*x0*x1^2+4*%r1^2*x1^2+4*%r1*x0^2*x1-8*%r1^2*x0*x1+x0^4-4*%r1*x0^3+4*%r1^2*x0^2))/(2*y1-2*y0)
],
[x=%r2,
y=(y1^2-y0^2+x1^2-2*%r2*x1-x0^2+2*%r2*x0)/(2*y1-2*y0),
r=(sqrt(y1^4-4*y0*y1^3+6*y0^2*y1^2+2*x1^2*y1^2-4*%r2*x1*y1^2+2*x0^2*y1^2-4*%r2*x0*y1^2+4*%r2^2*y1^2-4*y0^3*y1-4*x1^2*y0*y1+8*%r2*x1*y0*y1-4*x0^2*y0*y1+8*%r2*x0*y0*y1-8*%r2^2*y0*y1+y0^4+2*x1^2*y0^2-4*%r2*x1*y0^2+2*x0^2*y0^2-4*%r2*x0*y0^2+4*%r2^2*y0^2+x1^4-4*%r2*x1^3-2*x0^2*x1^2+4*%r2*x0*x1^2+4*%r2^2*x1^2+4*%r2*x0^2*x1-8*%r2^2*x0*x1+x0^4-4*%r2*x0^3+4*%r2^2*x0^2))/(2*y1-2*y0)
]
]
Yes, this is equivalent (in duplicate) to the Maple answer given
earlier in this thread - and it is likewise not a explicit solution
(compare the Derive result for this).
If you read %r1 and %r2 as x, the second equation of either Maxima
solution gives y in terms of x, and the third equation after squaring
is a quadratic in x with coefficients depending on r^2, x0, y0, x1, y1
only. By squaring the third equation, the Maxima pair of solutions
collapses into one, but now the quadratic will have two solutions for
x, each of them having a corresponding y.
This is what I have using Mathcad
ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20CenterOfCircleCalculations.pdf
I wish these math packages could combine common terms. I end up doing
it manually.
Quote: Special attention has to be paid to the case y1=y0 where the
denominators vanish.
Martin.
Not a problem. An engineer would switch the x and y coordinates based
on which is greater between |x0-x1| or |y0-y1| and then switch them
back. Comparing y1=y0 will still allow overflow errors if y1 and y0
are relatively close.
Peter Nachtwey |
|
|
| Back to top |
|
| |
|
Page 1 of 1
All times are GMT - 5 Hours
The time now is Fri Jan 09, 2009 9:56 pm
|
|