Ronan

1207 Reputation

14 Badges

12 years, 211 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are questions asked by Ronan

How do i check if an equation or function does not contain an '=' sign, to convert it?

if eq:= a+b=c

If it has an  '=' I can use eq1:=lhs(eq)-rhs(eq).

If eq=d+e+f there is no lhs/rhs and checking produces an error.

eq := a*x^2 + b*x = v;
                               2          
                      eq := a x  + b x = v

eq1 := lhs(eq) - rhs(eq);
                            2          
                         a x  + b x - v

eq2 := a*x^2 + b*x - v;
                               2          
                     eq1 := a x  + b x - v

lhs(eq1);
Error, invalid input: lhs received a*x^2+b*x-v, which is not valid for its 1st argument, expr
NULL;
has(eq,'=');
Error, invalid uneval
        Typesetting:-mambiguous(hasApplyFunction(eqcomma

          Typesetting:-mambiguous((equals), 

          Typesetting:-merror("invalid uneval"))))


has(eq2, rhs(eq2));
Error, invalid input: rhs received eq2, which is not valid for its 1st argument, expr
NULL;

 

I have done a complete clean reinstall of windows 10 and all programs on my pc.

In worksheet mode new files do not have the "default" red/brown text coluor ond the font is different. 

Might not be a problem but thought that was the default?

What have I changed or have Maple defaults changed?

restart

``

2+2

4

(1)

NULL

eq := x^3+x-7

x^3+x-7

(2)

NULL

Download 23-11-23_Q_inputs_to_worksheet_not_brown_red_colour.mw

I am asking this beacuse I am rusty on using animate in plots. Just trying to show the line segment moving.

restart

with(plottools); with(plots)

Trvl := Matrix(5, 18, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 2, (1, 4) = 3, (1, 5) = 4, (1, 6) = 5, (1, 7) = 6, (1, 8) = 7, (1, 9) = 8, (1, 10) = 9, (1, 11) = 10, (1, 12) = 11, (1, 13) = 12, (1, 14) = 13, (1, 15) = 14, (1, 16) = 15, (1, 17) = 16, (1, 18) = 17, (2, 1) = 25.00000000, (2, 2) = 25.62348980, (2, 3) = 26.24697960, (2, 4) = 26.87046941, (2, 5) = 27.49395921, (2, 6) = 28.11744901, (2, 7) = 28.81795052, (2, 8) = 29.70796779, (2, 9) = 30.69482490, (2, 10) = 31.66997559, (2, 11) = 32.64189447, (2, 12) = 33.63901734, (2, 13) = 34.59934793, (2, 14) = 35.46317753, (2, 15) = 36.17679740, (2, 16) = 36.69583812, (2, 17) = 36.98802824, (2, 18) = 37.03520080, (3, 1) = 9.50000000, (3, 2) = 10.28183148, (3, 3) = 11.06366296, (3, 4) = 11.84549445, (3, 5) = 12.62732593, (3, 6) = 13.40915741, (3, 7) = 14.11748988, (3, 8) = 14.56318511, (3, 9) = 14.69313898, (3, 10) = 14.49329251, (3, 11) = 14.26929209, (3, 12) = 14.29271187, (3, 13) = 14.56209574, (3, 14) = 15.06069470, (3, 15) = 15.75750830, (3, 16) = 16.60921202, (3, 17) = 17.56285107, (3, 18) = 18.55913279, (4, 1) = 26.55872458, (4, 2) = 27.18221431, (4, 3) = 27.80570411, (4, 4) = 28.44091912, (4, 5) = 29.26771501, (4, 6) = 30.27132826, (4, 7) = 31.26754127, (4, 8) = 32.19797655, (4, 9) = 33.15526524, (4, 10) = 34.16855668, (4, 11) = 35.08363639, (4, 12) = 35.87210441, (4, 13) = 36.48493760, (4, 14) = 36.88403298, (4, 15) = 37.04457671, (4, 16) = 36.95658698, (4, 17) = 36.62553455, (4, 18) = 36.06730316, (5, 1) = 11.45457880, (5, 2) = 12.23641019, (5, 3) = 13.01824167, (5, 4) = 13.79066482, (5, 5) = 14.38908368, (5, 6) = 14.67833203, (5, 7) = 14.61699479, (5, 8) = 14.33989949, (5, 9) = 14.25015666, (5, 10) = 14.40907532, (5, 11) = 14.80585186, (5, 12) = 15.41668792, (5, 13) = 16.20360467, (5, 14) = 17.11767545, (5, 15) = 18.10206776, (5, 16) = 19.09557685, (5, 17) = 20.03643114, (5, 18) = 20.86416514})

_rtable[36893489645234278260]

(1)

display(seq(line([Trvl[2, i], Trvl[3, i]], [Trvl[4, i], Trvl[5, i]], color = green), i = 1 .. 18))

 

animate(line([Trvl[2, i], Trvl[3, i]], [Trvl[4, i], Trvl[5, i]], color = green), i = 1 .. 18)

Error, bad index into Matrix

 

NULL

Download 23-11-03_Q_Animate_a_line.mw

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-yc2)*(R1+R2-yc1+yc2)))^(1/2)-(x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+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?

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