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$>
References: <k4ib2c$eel$> <k4l3c0$2ed$> <k4n7o4$1hf$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1349646909 1932 (7 Oct 2012 21:55:09 GMT)
NNTP-Posting-Date: Sun, 7 Oct 2012 21:55:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:780082

"Daniel" wrote in message <k4n7o4$1hf$>...
> ...... 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:

% Second set of six:

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

Roger Stafford