HP Forums
Analytic geometry - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Analytic geometry (/thread-12459.html)



Analytic geometry - yangyongkang - 02-18-2019 09:27 AM

Hello everyone. I recently encountered a planar geometry problem, I tried to solve it with algebraic methods.This requires me to solve a series of equations.

Code:
f := proc (alpha) options operator, arrow, function_assign; x*cos(alpha)+y*sin(alpha) end proc;l1:=solve([f(alpha) = 1, f(beta) = 1], [x, y]);l2:=solve([f(alpha) = 1, f(gamma) = 1], [x, y]);l3:=solve([f(beta) = 1, f(gamma) = 1], [x, y]);solve([(l1(1,1)-l2(1,1))^2+(l1(1,2)-l2(1,2))^2=(l1(1,1)-l3(1,1))^2+(l1(1,2)-l3(1,2))^2,(l1(1,1)-l2(1,1))^2+(l1(1,2)-l2(1,2))^2=(l3(1,1)-l2(1,1))^2+(l3(1,2)-l2(1,2))^2],[beta, alpha])


XCAS can't solve it
Wolfram Mathematica 11.3 can't solve it


Wolfram Mathematic 11.3 code
Code:
f[m_] := x*Cos[m] + y*Sin[m]; l1 := {x, y} /. 
  Solve[f[t1] == 1 && f[t2] == 1, {x, y}]; l2 := {x, y} /. 
  Solve[f[t1] == 1 && f[t3] == 1, {x, y}]; l3 := {x, y} /. 
  Solve[f[t2] == 1 && f[t3] == 1, {x, 
    y}]; Solve[(l1[[1, 1]] - l2[[1, 1]])^2 + (l1[[1, 2]] - 
       l2[[1, 2]])^2 == (l1[[1, 1]] - l3[[1, 1]])^2 + (l1[[1, 2]] - 
       l3[[1, 2]])^2 && (l3[[1, 1]] - l2[[1, 1]])^2 + (l3[[1, 2]] - 
       l2[[1, 2]])^2 == (l1[[1, 1]] - l2[[1, 1]])^2 + (l1[[1, 2]] - 
       l2[[1, 2]])^2, {t2, t1}]

But Maple2018 seems to solve
Code:
f := proc (alpha) options operator, arrow, function_assign; x*cos(alpha)+y*sin(alpha) end proc; l1 := subs(solve([f(alpha) = 1, f(beta) = 1], [x, y])[1], [x, y]); l2 := subs(solve([f(alpha) = 1, f(gamma) = 1], [x, y])[1], [x, y]); l3 := subs(solve([f(beta) = 1, f(gamma) = 1], [x, y])[1], [x, y]); allvalues(solve([(l1[1]-l2[1])^2+(l1[2]-l2[2])^2 = (l1[1]-l3[1])^2+(l1[2]-l3[2])^2, (l1[1]-l2[1])^2+(l1[2]-l2[2])^2 = (l2[1]-l3[1])^2+(l2[2]-l3[2])^2], [beta, alpha]))
Its geometric meaning is an equilateral triangle surrounded by three tangents of a circle.
The equation of the circle is
Code:
x^2+y^2=1

Randomly take three parameters and draw this image
Code:
plotimplicit(x*cos(1)+y*sin(1)=1);plotimplicit(x*cos(-8)+y*sin(-8)=1);plotimplicit(x*cos(3)+y*sin(3)=1);plotimplicit(x^2+y^2=1)

Sure enough, the three tangent lines

Sorry my poor english


RE: Analytic geometry - yangyongkang - 02-18-2019 12:09 PM

I will extend this question. Calculate the area enclosed by the three tangent lines of the circle.
Code:
(det([[l1(1,1),l1(1,2),1],[l2(1,1),l2(1,2),1],[l3(1,1),l3(1,2),1]])))

Get the answer
Code:
(-2*tan(alpha/2)^2*tan(beta/2)+2*tan(alpha/2)^2*tan(gamma/2)-2*tan(beta/2)^2*tan(gamma/2)+2*tan(alpha/2)*tan(beta/2)^2-2*tan(alpha/2)*tan(gamma/2)^2+2*tan(beta/2)*tan(gamma/2)^2)/(tan(alpha/2)*tan(beta/2)+tan(alpha/2)*tan(gamma/2)+tan(beta/2)*tan(gamma/2)+tan(alpha/2)^2*tan(beta/2)^2*tan(gamma/2)^2+tan(alpha/2)^2*tan(beta/2)*tan(gamma/2)+tan(alpha/2)*tan(beta/2)^2*tan(gamma/2)+tan(alpha/2)*tan(beta/2)*tan(gamma/2)^2+1)

Defining function
Code:
f(alpha,beta,gamma):=(-2*tan(alpha/2)^2*tan(beta/2)+2*tan(alpha/2)^2*tan(gamma/2)-2*tan(beta/2)^2*tan(gamma/2)+2*tan(alpha/2)*tan(beta/2)^2-2*tan(alpha/2)*tan(gamma/2)^2+2*tan(beta/2)*tan(gamma/2)^2)/(tan(alpha/2)*tan(beta/2)+tan(alpha/2)*tan(gamma/2)+tan(beta/2)*tan(gamma/2)+tan(alpha/2)^2*tan(beta/2)^2*tan(gamma/2)^2+tan(alpha/2)^2*tan(beta/2)*tan(gamma/2)+tan(alpha/2)*tan(beta/2)^2*tan(gamma/2)+tan(alpha/2)*tan(beta/2)*tan(gamma/2)^2+1)

Deriving a trace to track its suspicious extreme point
Code:
solve([diff(f(x,y,z),x)=0,diff(f(x,y,z),y)=0,diff(f(x,y,z),z)=0],[x,y,z])

XCAS calculates the result
Code:
[[pi/3,pi/3,pi/3],[-pi/3,-pi/3,-pi/3],[2*atan(y),-2.33112237041,2*atan(y)],[2*atan(y),-1.49890655757e-26,2*atan(y)],[2*atan(y),2.33112237041,2*atan(y)],[-2.33112237041,2*atan((x-(sqrt(3)))/(sqrt(3)*x+1)),2*atan((-x-(sqrt(3)))/(sqrt(3)*x-1))],[-1.49890655757e-26,2*atan((x-(sqrt(3)))/(sqrt(3)*x+1)),2*atan((-x-(sqrt(3)))/(sqrt(3)*x-1))],[2.33112237041,2*atan((x-(sqrt(3)))/(sqrt(3)*x+1)),2*atan((-x-(sqrt(3)))/(sqrt(3)*x-1))],[-2.33112237041,2*atan((-x-(sqrt(3)))/(sqrt(3)*x-1)),2*atan((x-(sqrt(3)))/(sqrt(3)*x+1))],[-1.49890655757e-26,2*atan((-x-(sqrt(3)))/(sqrt(3)*x-1)),2*atan((x-(sqrt(3)))/(sqrt(3)*x+1))],[2.33112237041,2*atan((-x-(sqrt(3)))/(sqrt(3)*x-1)),2*atan((x-(sqrt(3)))/(sqrt(3)*x+1))]]

Is there any other good solution?
Thank you


RE: Analytic geometry - Albert Chan - 02-18-2019 03:16 PM

(02-18-2019 09:27 AM)yangyongkang Wrote:  Hello everyone. I recently encountered a planar geometry problem, I tried to solve it with algebraic methods.
This requires me to solve a series of equations ...

There is no need to solve this: see http://www.hpmuseum.org/forum/thread-12376-post-111897.html#pid111897

Any line in the form x cos(m) + y sin(m) = 1 had distance of 1 to the origin.
in other words, all these lines are tangent to the unit circle.

Quote:Its geometric meaning is an equilateral triangle surrounded by three tangents of a circle.

I think you meant a triangle (not necessarily equilateral), tangents of a unit circle.
But, if you really want a equilateral triangle, it is trivial:

line 1: whatever angle m you pick
line 2 and line 3: use angle m ± 2Pi/3


RE: Analytic geometry - Albert Chan - 02-18-2019 05:51 PM

Since we know x cos(m) + y sin(m) = 1 is just tangents to the unit circle, we can simplify:
Rotate the angles, so that t1 = 0, line 1 is now simply x*1 + y*0 = x = 1:

Intersect, x=1 and line 2: 1*cos(t2) + y*sin(t2) = 1

(1 - 2 sin(t2/2)^2) + y*sin(t2) = 1
y * (2 sin(t2/2) cos(t2/2)) = 2 sin(t2/2)^2
y = tan(t2/2)

Use symmetry, intersect of x=1 and line 3: y = tan(t3/2)

-> Triangle line 1 side length = | tan((t2-t1)/2) - tan((t3-t1)/2) |

(02-18-2019 09:27 AM)yangyongkang Wrote:  Randomly take three parameters and draw this image
Code:
plotimplicit(x*cos(1)+y*sin(1)=1);
plotimplicit(x*cos(-8)+y*sin(-8)=1);
plotimplicit(x*cos(3)+y*sin(3)=1);
plotimplicit(x^2+y^2=1)

Sure enough, the three tangent lines

Without solving for the vertice coordinates, we can get side length directly.
Example, for above plot:

+1 radian line, slope ≈ -0.642: length = | tan((-8-1)/2 - tan((3-1)/2) |  ≈ 6.1947
−8 radian line, slope ≈ -0.147: length = | tan((1+8)/2 - tan((3+8)/2) | ≈ 5.6329
+3 radian line, slope ≈ 7.015 : length = | tan((1-3)/2 - tan((-8-3)/2) |  ≈ 2.5530

Edit: you can solve the vertices thru "reverse" rotation
Example, the top vertice (line 1 and line 3 intersect):

We know rotated intersect was [1, tan((3-1)/2)], so original intersect
= [[cos(1), -sin(1)], [sin(1), cos(1)]] * [1, tan(1)]
= [cos(1) - sin(1)*tan(1), sin(1) + cos(1)*tan(1)]
= [cos(2)/cos(1), 2*sin(1)]
≈ [-0.7702, 1.6829]


RE: Analytic geometry - Albert Chan - 02-18-2019 08:48 PM

(02-18-2019 12:09 PM)yangyongkang Wrote:  I will extend this question. Calculate the area enclosed by the three tangent lines of the circle.

Area under rotated coordinate match area before rotation.
So, again assume t1=0, we already know the base, find height:

x cos(t2) + y sin(t2) = 1 ; rotated line 2
x cos(t3) + y sin(t3) = 1 ; rotated line 3

Multiply 1st eqn by sin(t3), 2nd by sin(t2), and subtract:

x (cos(t2) sin(t3) - cos(t3) sin(t2)) = sin(t3) - sin(t2)
x = (sin(t3) - sin(t2)) / sin(t3 - t2) = cos(½(t3+t2)) sec(½(t3-t2))

y value not needed here, but just in case: y = sin(½(t3+t2)) sec(½(t3-t2))

height = | 1 - x |
= | (cos(½(t3-t2)) - cos(½(t3+t2))) sec(½(t3-t2)) |
= | 2 sin(t2/2) sin(t3/2) sec(½(t3-t2)) |

base = | tan(t2/2) - tan(t3/2) |
= | (sin(t2/2) cos(t3/2) - cos(t3/2) sin(t2/2)) sec(t2/2) sec(t3/2) |
= | sec(t2/2) sec(t3/2) sin(½(t3-t2)) |

ΔArea = base*height/2, and remove the t1=0 restriction:

ΔArea = | tan(½(t2-t1)) tan(½(t3-t1)) tan(½(t3-t2)) |


RE: Analytic geometry - Albert Chan - 02-19-2019 10:23 PM

Trivia: If triangle inscribed unit circle, Δarea = Δhalf-perimeter

Prove:
Again, assume t1=0, and normalized t2, t3, such that 2Pi > t3 > t2 > 0
To have unit circle inside triangle require these conditions:

0 < t2 < Pi             ; made triangle angle Pi - t2
Pi < t3 < Pi + t2     ; made triangle angle t3 - Pi

-> tan(t2/2) > 0, tan(t3/2) < 0, tan((t3-t2)/2) > 0

a = | tan(t3/2) - tan(t2/2) |         = tan(t2/2) - tan(t3/2)
b = | tan(-t2/2) - tan(½(t3-t2)) | = tan(t2/2) + tan(½(t3-t2))
c = | tan(-t3/2) - tan(½(t2-t3)) | = -tan(t3/2) + tan(½(t3-t2))

s = ½(a + b + c)
= tan(t2/2) - tan(t3/2) + tan(½(t3-t2))
= tan(½(t3-t2)) * (1 - (1 + tan(t2/2) tan(t3/2)))
= - tan(t2/2) tan(t3/2) tan(½(t3-t2))

Add back absolute function to remove sign, and remove t1=0 restriction:

s = |tan(½(t2-t1))| + |tan(½(t3-t1))| + |tan(½(t3-t2))|
   = |tan(½(t2-t1)) tan(½(t3-t1)) tan(½(t3-t2))|


Match previously derived Δarea formula. QED

Comment: |tan(...)| peices are length of circle tangents to triangle vertice.


RE: Analytic geometry - Albert Chan - 02-20-2019 09:33 PM

Again, using assumptions from post #6, prove 3 excircle radiuses are:

r1 = | tan(½(t2-t1)) tan(½(t3-t1)) |
r2 = | tan(½(t1-t2)) tan(½(t3-t2)) |
r3 = | tan(½(t1-t3)) tan(½(t2-t3)) |

Due to symmetry, only need to prove r1 is correct.
Let t1=0, then r1 = | tan(t2/2) tan(t3/2) |, calculate actual coordinate:

Post#4 calculated leftmost vertice, with slope relative to (0,0) = tan(½(t2+t3))
Line y = tan(½(t2+t3))*x bisect the angle, thus will hit excircle center too.

To satisfy line x=1, excircle center x-value = 1 + r1 = 1 - tan(t2/2) tan(t3/2)
-> excircle center = [1 - tan(t2/2) tan(t3/2), tan(t2/2) + tan(t3/2)]

Distance from excircle center to line2
= |(1 - tan(t2/2) tan(t3/2)) cos(t2) + (tan(t2/2) + tan(t3/2)) sin(t2) - 1|
= |-tan(t2/2) tan(t3/2) cos(t2) + tan(t3/2) sin(t2)| + (cos(t2) + 2 sin(t2/2)^2 - 1) ; last term=0
= |tan(t3/2) * (sin(t2) cos(t2/2) - cos(t2) sin(t2/2)) / cos(t2)|
= |tan(t2/2) tan(t3/2)| = r1

Due to symmetry, excircle center had same distance to line3 too. QED

(02-19-2019 10:23 PM)Albert Chan Wrote:  s = |tan(½(t2-t1))| + |tan(½(t3-t1))| + |tan(½(t3-t2))|
   = |tan(½(t2-t1)) tan(½(t3-t1)) tan(½(t3-t2))|

Divide first line by second, with inscribed circle radius of r, not 1: 1/r = 1/r1 + 1/r2 + 1/r3 Smile