Ronan

1172 Reputation

14 Badges

12 years, 183 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are questions asked by Ronan

If if solve for two circles intersecting the general solution conteint a factor of (xc1-xc2) i.e. x co-ors of the circle centres in both numerator and denominator. So the solution fails if they are equal i.e circles vertically aligned.
I can get arount the problem using  "RealDomain" but that introduces Signum which I dont like and is much slower to solve. I substitued out substitued signum out signum(xc1-xc2)=1. Works.

Just looking for is neater solution approach.
 

restart

NULL

eq1 := (x-xc1)^2+(y-yc1)^2 = R1^2

(x-xc1)^2+(y-yc1)^2 = R1^2

(1)

eq2 := (x-xc2)^2+(y-yc2)^2 = R2^2

(x-xc2)^2+(y-yc2)^2 = R2^2

(2)

eq3 := (xc1-xc2)^2-(yc1-yc2)^2 < (R1+R2)^2

(xc1-xc2)^2-(yc1-yc2)^2 < (R1+R2)^2

(3)

Sol1 := `~`[simplify](solve({eq1, eq2}, [x, y], explicit))[]

[x = (1/2)*((-yc1+yc2)*(-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)-(xc1-xc2)*(-xc1^3+xc1^2*xc2+(R1^2-R2^2+xc2^2-yc1^2+2*yc1*yc2-yc2^2)*xc1-xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2)))/((xc1^2-2*xc1*xc2+xc2^2+(yc1-yc2)^2)*(xc1-xc2)), y = ((-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+yc1^3-yc1^2*yc2+(-R1^2+R2^2+xc1^2-2*xc1*xc2+xc2^2-yc2^2)*yc1+yc2^3+(R1^2-R2^2+xc1^2-2*xc1*xc2+xc2^2)*yc2)/(2*yc1^2-4*yc1*yc2+2*yc2^2+2*(xc1-xc2)^2)], [x = (1/2)*((yc1-yc2)*(-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)-(xc1-xc2)*(-xc1^3+xc1^2*xc2+(R1^2-R2^2+xc2^2-yc1^2+2*yc1*yc2-yc2^2)*xc1-xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2)))/((xc1^2-2*xc1*xc2+xc2^2+(yc1-yc2)^2)*(xc1-xc2)), y = (-(-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+yc1^3-yc1^2*yc2+(-R1^2+R2^2+xc1^2-2*xc1*xc2+xc2^2-yc2^2)*yc1+yc2^3+(R1^2-R2^2+xc1^2-2*xc1*xc2+xc2^2)*yc2)/(2*yc1^2-4*yc1*yc2+2*yc2^2+2*(xc1-xc2)^2)]

(4)

eval(Sol1[1], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 178.3493912, y = 165.6165872]

(5)

eval(Sol1[2], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 212.1767210, y = 117.4323513]

(6)

NULL

NULL

NULL

NULL

Sol2 := `assuming`([`~`[simplify](solve({eq1, eq2}, [x, y], explicit))[]], [eq3])

[x = (1/2)*((-yc1+yc2)*(-(xc1-xc2)^2*(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc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xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+(yc1+yc2)*xc1^2-2*xc2*(yc1+yc2)*xc1+(yc1+yc2)*xc2^2-(yc1-yc2)*(R1^2-R2^2-yc1^2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2)]

(8)

eval(Sol3[1], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 178.3493912, y = 165.6165871]

(9)

eval(Sol3[2], [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 212.1767209, y = 117.4323512]

(10)

Sol3a := subs(signum(xc1-xc2) = 1, Sol3[1])

[x = (-(yc1-yc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+xc1^3-xc1^2*xc2+(-R1^2+R2^2-xc2^2+yc1^2-2*yc1*yc2+yc2^2)*xc1+xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2), y = ((xc1-xc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+(yc1+yc2)*xc1^2-2*xc2*(yc1+yc2)*xc1+(yc1+yc2)*xc2^2-(yc1-yc2)*(R1^2-R2^2-yc1^2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2)]

(11)

Sol3b := subs(signum(xc1-xc2) = 1, Sol3[2])

[x = ((yc1-yc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+xc1^3-xc1^2*xc2+(-R1^2+R2^2-xc2^2+yc1^2-2*yc1*yc2+yc2^2)*xc1+xc2*(R1^2-R2^2+xc2^2+yc1^2-2*yc1*yc2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2), y = (-(xc1-xc2)*(-(-xc1^2+2*xc1*xc2-xc2^2+(R1-R2+yc1-yc2)*(R1-R2-yc1+yc2))*(-xc1^2+2*xc1*xc2-xc2^2+(R1+R2+yc1-yc2)*(R1+R2-yc1+yc2)))^(1/2)+(yc1+yc2)*xc1^2-2*xc2*(yc1+yc2)*xc1+(yc1+yc2)*xc2^2-(yc1-yc2)*(R1^2-R2^2-yc1^2+yc2^2))/(2*xc1^2-4*xc1*xc2+2*xc2^2+2*(yc1-yc2)^2)]

(12)

eval(Sol3a, [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 212.1767209, y = 117.4323512]

(13)

eval(Sol3b, [R1 = 85, R2 = 30, xc2 = 200, yc2 = 144.85, xc1 = 130, yc1 = 95.7071])

[x = 178.3493912, y = 165.6165871]

(14)

NULL


 

Download 28-10-28_Q_Circles_Intersect.mw

 

I am trying make atomic variables stand out in the document, I thought they used to automatically change to a purple type colour.

So under Format, styles , I set the style to size 14, Bold, dark green.  The font changed on the existing ones but not the colour.

On new ones no setting occours just default text. I then restored to default settings under styles and they all turned purple including the new ones.

Then I made another one but no adoption of the default style (purple) occured. 

This fiddlyness needs to be improved  

Has anyone any suggestions to make the atomic variables adope their default colour etc?

When will the PDF Maple User Manual be released for Maple 2023. Also I hope the Programming guide is updated too as it is still at 2020.

I am trying to test types inside lists on the input to a procedure. Sometimes I can get this concept to work. 

This is a sample to show the problem. I need to know if the list has [ list[ $3] , Vector[column]($3) ] , or [ Vector[row]($3] , Vector [column]($3) ]

restart

 


        test:=proc(l1::[{[algebraic $ 3],'Vector[row](3, algebraic)'},'Vector[column](3, algebraic)'],l2::[{[algebraic $ 3],'Vector[row](3, algebraic)'},'Vector[column](3,algebraic)'])
        
        print("inputs recognised");

        end proc;

        

proc (l1::[{'Vector[row](3, algebraic)', [`$`(algebraic, 3)]}, 'Vector[column](3, algebraic)'], l2::[{'Vector[row](3, algebraic)', [`$`(algebraic, 3)]}, 'Vector[column](3, algebraic)']) print("inputs recognised") end proc

 

 

#  3d lines

l1:= [<1 | 5 | 7>, <3, 7, 9>]

[Vector[row](3, {(1) = 1, (2) = 5, (3) = 7}), Vector(3, {(1) = 3, (2) = 7, (3) = 9})]

l2:=[<-4 | 2 | 1>, <3, 8, -9>]

[Vector[row](3, {(1) = -4, (2) = 2, (3) = 1}), Vector(3, {(1) = 3, (2) = 8, (3) = -9})]

test(l1,l2)

Error, invalid input: test expects its 1st argument, l1, to be of type [{'Vector[row](3,algebraic)', [algebraic $ 3]}, 'Vector[column](3,algebraic)'], but received [Vector[row](3, [1,5,7]), Vector(3, [3,7,9])]

l3:= [[1 , 5 , 7], <3, 7, 9>]

[[1, 5, 7], Vector(3, {(1) = 3, (2) = 7, (3) = 9})]

l4:=[[-4 , 2 , 1], <3, 2, -9>]

[[-4, 2, 1], Vector(3, {(1) = 3, (2) = 2, (3) = -9})]

test(l3,l4)

Error, invalid input: test expects its 1st argument, l1, to be of type [{'Vector[row](3,algebraic)', [algebraic $ 3]}, 'Vector[column](3,algebraic)'], but received [[1, 5, 7], Vector(3, [3,7,9])]

type(l3[1],[algebraic $ 3])

true

type(l1[1],[algebraic $ 3])  

false

type(l1[1],'Vector[row](3, algebraic)')

true

type(l1[2],'Vector[column](3, algebraic)')

true

 

Download Q_2023-03-06_Proc_types_in_list_inputs.mw

This a more a math question than  a maple programming question. But interesting.

I have a point P=[x,y] on a line y= 2+3x. The point maps to Pn=[f(x, y), g(x, y)]. That represents a conic.

I want to find the equation of the conic. I did it by calculating 5 points and that works fine but only because I know I'm looking for a conic. 

Can the problem by solved without having to get the five points?
I copied and pasted the equations for the lines because they were generated by commands in a pagkage I have.

restart

NULL

NULL

P := [X, Y]

[X, Y]

``

NULL

Pn := [(5*X+12*Y)*(-384+48*X+55*Y)/(225*X^2+225*Y^2-1800*X-602*Y), (2*(12*X-5*Y))*(-384+48*X+55*Y)/(225*X^2+225*Y^2-1800*X-602*Y)]

[(5*X+12*Y)*(-384+48*X+55*Y)/(225*X^2+225*Y^2-1800*X-602*Y), 2*(12*X-5*Y)*(-384+48*X+55*Y)/(225*X^2+225*Y^2-1800*X-602*Y)]

NULL

``

Y := 2+3*Xn

2+3*X

``

for i to 5 do P || i := eval(Pn, X = i) end do

[181139/51416, -19775/25708]

NULL

l12 := 153621*x*(1/68840)+169429*y*(1/27536)-15067/17210

(153621/68840)*x+(169429/27536)*y-15067/17210

NULL

l34 := -5733*x*(1/473062)+258973*y*(1/946124)+244205/946124

-(5733/473062)*x+(258973/946124)*y+244205/946124

c1 := l12*l34

((153621/68840)*x+(169429/27536)*y-15067/17210)*(-(5733/473062)*x+(258973/946124)*y+244205/946124)

NULL

l13 := 5499*x*(1/2360)+6539*y*(1/944)-793/472

(5499/2360)*x+(6539/944)*y-793/472

l24 := 596115*x*(1/6899489)+7228091*y*(1/6899489)+195364/363131

(596115/6899489)*x+(7228091/6899489)*y+195364/363131

plots:-implicitplot([l12, l34, l13, l24])

c2 := l13*l24

((5499/2360)*x+(6539/944)*y-793/472)*((596115/6899489)*x+(7228091/6899489)*y+195364/363131)

c := simplify(c2*lambda+c1)

(655607277/3256558808)*(x+(2515/846)*y-305/423)*(x+(556007/45855)*y+285532/45855)*lambda-(880709193/32565588080)*(x-(19921/882)*y-18785/882)*(x+(65165/23634)*y-4636/11817)

lambda := solve(eval(c, [x = P5[1], y = P5[2]]), lambda)

-1/4

simplify(c)

-(5039454771/65131176160)*x^2+(1/130262352320)*(-29130506847*y+40315638168)*x-(423368829/3256558808)*y^2+(111619143207/130262352320)*y

plt1 := plot(Y, X = -10 .. 10)

NULL

NULL

plt2 := plots:-implicitplot([c])

plots:-display(plt1, plt2, colour = ["Red", "Green"])

NULL

for i in [-7, 13/3, 42*(1/7)] do x := eval(Pn[1], X = i); y := eval(Pn[2], X = i); simplify(c) end do

0

NULL

Download Q_23-03-04_how_to_find_conic_from_mapping.mw

First 8 9 10 11 12 13 14 Last Page 10 of 32