Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: solving a system of multi-variable polynomial equations in mupad
Date: Sun, 7 Oct 2012 21:55:09 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 59
Message-ID: <k4stnt$1sc$1@newscl01ah.mathworks.com>
References: <k4ib2c$eel$1@newscl01ah.mathworks.com> <k4l3c0$2ed$1@newscl01ah.mathworks.com> <k4n7o4$1hf$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1349646909 1932 172.30.248.47 (7 Oct 2012 21:55:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 7 Oct 2012 21:55:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:780082

"Daniel" wrote in message <k4n7o4$1hf$1@newscl01ah.mathworks.com>...
> ...... Unfortunatley my geometry ability is almost as bad as my equation solving ability, and so I was wondering if you would be kind enough to offer a little clarification on some of your points?   
- - - - - - - - - - - -
  Daniel, in case it might help you to understand your problem better, I have written some matlab code that generates a random A, B, and C set of coefficients with B^2>A*C (with F understood to be zero,) and then finds three random points on each of its two lines: (x1,y1), (x2,y2), (x3,y3) and (x4,y4), (x5,y5), (x6,y6).  It then shows how 12 of your 24 equations are satisfied by these six points which verifies the claim I made about them.

  The points are found by first solving for angles a and b such that

 K*(x*sin(a)-y*cos(a))*(x*sin(b)-y*cos(b)) = A*x^2+2*B*x*y+C*y^2

is identically true for all x and y, the two lines then being defined by

 x*sin(a)-y*cos(a) = 0 and x*sin(b)-y*cos(b) = 0.

  In this example with both lines occupied, the second set of 12 equations of your 24 would necessarily have to involve the same two lines and its associated A, B, C coefficients would consequently have to be proportional to those above.  On the other hand, if these six points are all located on the same line, then the second set of A, B, C coefficients would share just that one line with the first set, with the other line being arbitrary.

  The matlab code:

% Generate random A, B, & C such that B^2 >= A*C
A = randn; C = randn;
B = (2*round(rand)-1)*sqrt(randn^2+max(A*C,0));

% Solve for a & b in K*(x*sin(a)-y*cos(a))*(x*sin(b)-y*cos(b)) =
% A*x^2+2*B*x*y+C*y^2 assuming K is some constant > 0.
t1 = atan2(-2*B,C-A); t2 = atan2(2*sqrt(B^2-A*C),A+C);
a = (t1+t2)/2; b = (t1-t2)/2;
sa = sin(a); ca = cos(a); sb = sin(b); cb = cos(b);

% Generate three random points along one line and three
% along the other line.
r1 = randn; x1 = r1*ca; y1 = r1*sa;
r2 = randn; x2 = r2*ca; y2 = r2*sa;
r3 = randn; x3 = r3*ca; y3 = r3*sa;
r4 = randn; x4 = r4*cb; y4 = r4*sb;
r5 = randn; x5 = r5*cb; y5 = r5*sb;
r6 = randn; x6 = r6*cb; y6 = r6*sb;

% Test 12 equalities
format long

% First set of six:
[A*x1^2+2*B*x1*y1+C*y1^2;
 A*x2^2+2*B*x2*y2+C*y2^2;
 A*x3^2+2*B*x3*y3+C*y3^2;
 A*x2*x3+B*(x2*y3+x3*y2)+C*y2*y3;
 A*x3*x1+B*(x3*y1+x1*y3)+C*y3*y1;
 A*x1*x2+B*(x1*y2+x2*y1)+C*y1*y2]

% Second set of six:
[A*x4^2+2*B*x4*y4+C*y4^2;
 A*x5^2+2*B*x5*y5+C*y5^2;
 A*x6^2+2*B*x6*y6+C*y6^2;
 A*x5*x6+B*(x5*y6+x6*y5)+C*y5*y6;
 A*x6*x4+B*(x6*y4+x4*y6)+C*y6*y4;
 A*x4*x5+B*(x4*y5+x5*y4)+C*y4*y5]

% These should all differ from zero by no more than very
% small rounding errors.

Roger Stafford