Ronan

827 Reputation

14 Badges

11 years, 208 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are answers submitted by Ronan

Long handed way of solving the problem
 

restart

See https://en.wikipedia.org/wiki/Parabola

 

with(plots)

NULL

``

NULLNULLParabola := proc (x, y) options operator, arrow; a*x^2+2*b*x*y+c*y^2+d*x+e*y+g end proc

proc (x, y) options operator, arrow; a*x^2+2*b*x*y+c*y^2+d*x+e*y+g end proc

(1)

cond := a*c-b^2 = 0

a*c-b^2 = 0

(2)

c := solve(cond, c)

b^2/a

(3)

Parabola(x, y)

a*x^2+2*b*x*y+b^2*y^2/a+d*x+e*y+g

(4)

``

``

A parabola can be written in terms of the distance from directrix=distance from focus

``

Par1 := sort(numer(expand((A*x+B*y+C)^2/(A^2+B^2)-(x-f[1])^2-(y-f[2])^2)), [x, y])

-B^2*x^2+2*A*B*x*y-A^2*y^2+2*A^2*f[1]*x+2*B^2*f[1]*x+2*A*C*x+2*A^2*f[2]*y+2*B^2*f[2]*y+2*B*C*y-A^2*f[1]^2-A^2*f[2]^2-B^2*f[1]^2-B^2*f[2]^2+C^2

(5)

Equate the coefficients of Parabola and Par1

eq1 := coeff(Par1, x, 2) = coeff(Parabola(x, y), x, 2)

-B^2 = a

(6)

eq2 := coeff(coeff(Par1, x, 1), y, 1) = coeff(coeff(Parabola(x, y), x, 1), y, 1)

2*A*B = 2*b

(7)

NULL

eq3 := coeff(Par1, x, 1) = coeff(Parabola(x, y), x, 1)

2*A^2*f[1]+2*A*B*y+2*B^2*f[1]+2*A*C = 2*b*y+d

(8)

eq4 := coeff(Par1, y, 1) = coeff(Parabola(x, y), y, 1)

2*A^2*f[2]+2*A*B*x+2*B^2*f[2]+2*B*C = 2*b*x+e

(9)

eq5 := coeff(coeff(Par1, x, 0), y, 0) = coeff(coeff(Parabola(x, y), x, 0), y, 0)

-A^2*f[1]^2-A^2*f[2]^2-B^2*f[1]^2-B^2*f[2]^2+C^2 = g

(10)

sol := solve({eq1, eq2, eq3, eq4, eq5}, [A, B, C, f[1], f[2]], explicit)

[[A = -b*(-a)^(1/2)/a, B = (-a)^(1/2), C = (1/4)*(4*a^2*g-a*d^2-a*e^2+4*b^2*g)*(-a)^(1/2)/(a*(a*e-b*d)), f[1] = (1/4)*(4*a^2*b*g-2*a^2*d*e+a*b*d^2-a*b*e^2+4*b^3*g)/((a^2+b^2)*(a*e-b*d)), f[2] = -(1/4)*a*(4*a^2*g-a*d^2+a*e^2+4*b^2*g-2*b*d*e)/(a^3*e-a^2*b*d+a*b^2*e-b^3*d)], [A = b*(-a)^(1/2)/a, B = -(-a)^(1/2), C = -(1/4)*(4*a^2*g-a*d^2-a*e^2+4*b^2*g)*(-a)^(1/2)/(a*(a*e-b*d)), f[1] = (1/4)*(4*a^2*b*g-2*a^2*d*e+a*b*d^2-a*b*e^2+4*b^3*g)/((a^2+b^2)*(a*e-b*d)), f[2] = -(1/4)*a*(4*a^2*g-a*d^2+a*e^2+4*b^2*g-2*b*d*e)/(a^3*e-a^2*b*d+a*b^2*e-b^3*d)]]

(11)

assign(sol[1])

directrix := A*x+B*y+C

-b*(-a)^(1/2)*x/a+(-a)^(1/2)*y+(1/4)*(4*a^2*g-a*d^2-a*e^2+4*b^2*g)*(-a)^(1/2)/(a*(a*e-b*d))

(12)

[f[1], f[2]]

[(1/4)*(4*a^2*b*g-2*a^2*d*e+a*b*d^2-a*b*e^2+4*b^3*g)/((a^2+b^2)*(a*e-b*d)), -(1/4)*a*(4*a^2*g-a*d^2+a*e^2+4*b^2*g-2*b*d*e)/(a^3*e-a^2*b*d+a*b^2*e-b^3*d)]

(13)

axis := simplify(B*(x-f[1])-A*(y-f[2]))

-(2*a^3*x+2*a^2*b*y+2*a*b^2*x+2*b^3*y+a^2*d+a*b*e)/((-a)^(1/2)*(2*a^2+2*b^2))

(14)

parameters := [a = 1, b = 2, d = 3, e = -1, g = 4]

[a = 1, b = 2, d = 3, e = -1, g = 4]

(15)

display(implicitplot([eval(Parabola(x, y), parameters), eval(directrix, parameters), eval(axis, parameters)], x = -7 .. 1, y = -1 .. 5, colour = [red, green, blue]), pointplot([eval(f[1], parameters), eval(f[2], parameters)]))

 

NULL


 

Download 13-2-22_Parabola_axis_focus.mw

My variant on solving it. 

@vv  why did you define two parabolas? I see it gives more different solutions.

Edit:- corrected cond to b^2-a c=0


restart

with(plots)

CircleParm := proc (t) options operator, arrow; [(-t^2+1)/(t^2+1), 2*t/(t^2+1)] end proc

proc (t) options operator, arrow; [(-t^2+1)/(t^2+1), 2*t/(t^2+1)] end proc

(1)

P1 := CircleParm(1/4)

[15/17, 8/17]

(2)

P2 := CircleParm(5)

[-12/13, 5/13]

(3)

P3 := CircleParm(-1/10)

[99/101, -20/101]

(4)

P4 := CircleParm(-3/2)

[-5/13, -12/13]

(5)

Pts := [P1, P2, P3, P4]

[[15/17, 8/17], [-12/13, 5/13], [99/101, -20/101], [-5/13, -12/13]]

(6)

para := proc (x, y) options operator, arrow; a*x^2+c*y^2+2*b*x*y+e*x+f*y+1 end proc

proc (x, y) options operator, arrow; a*x^2+c*y^2+2*b*x*y+e*x+f*y+1 end proc

(7)

cond := -a*c+b^2 = 0

-a*c+b^2 = 0

(8)

``

NULL

NULL

sys1 := [seq(para(op(Pts[i])), i = 1 .. 4), cond]

[(225/289)*a+(64/289)*c+(240/289)*b+(15/17)*e+(8/17)*f+1, (144/169)*a+(25/169)*c-(120/169)*b-(12/13)*e+(5/13)*f+1, (9801/10201)*a+(400/10201)*c-(3960/10201)*b+(99/101)*e-(20/101)*f+1, (25/169)*a+(144/169)*c+(120/169)*b-(5/13)*e-(12/13)*f+1, -a*c+b^2 = 0]

(9)

sol := solve(sys1, explicit)

{a = -400221/504721-(4940/504721)*3434^(1/2), b = 106975/504721-(5057/504721)*3434^(1/2), c = -760471/504721+(12090/504721)*3434^(1/2), e = -71500/504721+(3380/504721)*3434^(1/2), f = -107250/504721+(5070/504721)*3434^(1/2)}, {a = -400221/504721+(4940/504721)*3434^(1/2), b = 106975/504721+(5057/504721)*3434^(1/2), c = -760471/504721-(12090/504721)*3434^(1/2), e = -71500/504721-(3380/504721)*3434^(1/2), f = -107250/504721-(5070/504721)*3434^(1/2)}

(10)

Parab1 := eval(para(x, y), sol[1])

(-400221/504721-(4940/504721)*3434^(1/2))*x^2+2*(106975/504721-(5057/504721)*3434^(1/2))*x*y+(-760471/504721+(12090/504721)*3434^(1/2))*y^2+(-71500/504721+(3380/504721)*3434^(1/2))*x+(-107250/504721+(5070/504721)*3434^(1/2))*y+1

(11)

NULL

Parab2 := eval(para(x, y), sol[2])

(-400221/504721+(4940/504721)*3434^(1/2))*x^2+2*(106975/504721+(5057/504721)*3434^(1/2))*x*y+(-760471/504721-(12090/504721)*3434^(1/2))*y^2+(-71500/504721-(3380/504721)*3434^(1/2))*x+(-107250/504721-(5070/504721)*3434^(1/2))*y+1

(12)

display(implicitplot([Parab1, Parab2, x^2+y^2-1], x = -2 .. 2, y = -4 .. 2, colour = [red, green, blue], scaling = constrained), pointplot(Pts, symbolsize = 16))

 

NULL


Download Parabolas_CoCyclic_Points.mw

Just in the spirit of another way to find a tangent without differentiation,

restart

with(plots)

conic := proc (x, y) options operator, arrow; 7*x^2-7*y^2-12*x+9*y+2.25-2*x*y end proc

proc (x, y) options operator, arrow; 7*x^2-7*y^2-12*x+9*y+2.25-2*y*x end proc

(1)

x0, y0 := .504244923, .3781836925

.504244923, .3781836925

(2)

display(implicitplot(conic(x, y), x = -1 .. 2, y = -2 .. 2), pointplot([x0, y0]))

 

x0, y0 := .504244923, .3781836925

.504244923, .3781836925

(3)

conic(x0, y0)

0.22e-8

(4)

Translate the conic at point [x0,y0] to the origin

 

conic1 := expand(conic(x+x0, y+y0))

7*x^2-5.696938463*x+0.22e-8-7*y^2+2.696938459*y-2*y*x

(5)

NULL````````

implicitplot(conic1, x = -1 .. 1, y = -2 .. 2)

 

Truncate the conic to 1st order. this gives the tangent line to this conic at the origin

tanline1 := mtaylor(conic1, [x, y], 2)

0.22e-8-5.696938463*x+2.696938459*y

(6)

implicitplot([conic1, tanline1], x = -1 .. 1, y = -1 .. 1, colour = [red, green])

 

Translate the line to [x0,y0]. This gives the tangent line to the original conic

 

tanline := eval(tanline1, [x = x-x0, y = y-y0])

1.852714154-5.696938463*x+2.696938459*y

(7)

eval(tanline, [x = x0, y = y0])

0.2e-8

(8)

display(implicitplot([conic(x, y), tanline], x = 0 .. 2, y = -1 .. 1, colour = [red, blue]), pointplot([x0, y0]))

 

NULL

Download Tangent_to_Conic.mw

complex_log_plot.mw

Is this what you want?

I could not get the document to upload.

NULL;

z := x + y*I;

Plts := seq(plot3d([Re(k*log(z)), Im(k*log(z))], x = -3 .. 3, y = -3 .. 3, labels = ["Re(z)", "Im(z)", " ln(z)"], size = [800, 800]), k = [1, 2, 4, 6]);

NULL;
Plts[1];
Plts[2];
Plts[3];
Plts[4];
plots:-display(Plts);
NULL;

I came up with this earlier in the year. Don't know how well it works for you graphics.

At the time I was taking notes from you tube that were formated in Scientific Workplace.

Basically I put a fixed sized table into the document constrained to A4 width. It is not perfect

but can be useful.

restart

 

 

 

 

 

 

NULL

 

Download A4_format.mw

I was typing my answer while @Kitonum answered. I had to work around the i2(x,y)  as shown. Using Maple 2021.2

restart

NULL

i2 := proc (x, y) options operator, arrow; -((1/2)*I)*(exp(I*x)*sin(x)/x-exp(I*y)*sin(y)/y)/(x-y) end proc

proc (x, y) options operator, arrow; -((1/2)*I)*(exp(I*x)*sin(x)/x-exp(I*y)*sin(y)/y)/(x-y) end proc

(1)

``

i2a := i2(y, z)

-((1/2)*I)*(exp(I*y)*sin(y)/y-exp(I*z)*sin(z)/z)/(y-z)

(2)

i2b := i2(y, x)

-((1/2)*I)*(exp(I*y)*sin(y)/y-exp(I*x)*sin(x)/x)/(y-x)

(3)

i3_r := -(1/2*I)*(i2a-i2b)/(z-x)

-((1/2)*I)*(-((1/2)*I)*(exp(I*y)*sin(y)/y-exp(I*z)*sin(z)/z)/(y-z)+((1/2)*I)*(exp(I*y)*sin(y)/y-exp(I*x)*sin(x)/x)/(y-x))/(z-x)

(4)

``

mtaylor(i3_r, [x,y,z], 10);

1/6+((1/1260)*I)*(x^5+x^4*y+x^4*z+x^3*y^2+x^3*y*z+x^3*z^2+x^2*y^3+x^2*y^2*z+x^2*y*z^2+x^2*z^3+x*y^4+x*y^3*z+x*y^2*z^2+x*y*z^3+x*z^4+y^5+y^4*z+y^3*z^2+y^2*z^3+y*z^4+z^5)-((1/90)*I)*(x^3+x^2*y+x^2*z+x*y^2+x*y*z+x*z^2+y^3+y^2*z+y*z^2+z^3)-(1/5670)*x^4*y*z-(1/5670)*x^3*y^2*z-(1/5670)*x^3*y*z^2-(1/5670)*x^2*y^3*z-(1/5670)*x^2*y^2*z^2-(1/5670)*x^2*y*z^3-(1/5670)*x*y^4*z-(1/5670)*x*y^3*z^2-(1/5670)*x*y^2*z^3-(1/5670)*x*y*z^4+(1/315)*x^2*y*z+(1/315)*x*y^2*z+(1/315)*x*y*z^2+((1/12)*I)*(x+y+z)-(1/5670)*x^4*z^2-(1/5670)*x^3*z^3-(1/5670)*x^2*z^4+(1/315)*x^2*z^2-(1/5670)*x*z^5-(1/5670)*x^5*z-(1/30)*x^2+(1/315)*x^4-(1/5670)*x^6-(1/30)*z^2+(1/315)*z^4-(1/5670)*z^6+(1/315)*x*z^3+(1/315)*x^3*z-(1/30)*z*x+(1/315)*y*x^3+(1/315)*y^2*x^2+(1/315)*y^3*x-(1/5670)*y*x^5-(1/5670)*y^2*x^4-(1/5670)*y^3*x^3-(1/5670)*y^4*x^2-(1/5670)*y^5*x-(1/30)*y*x-(1/5670)*z*y^5-(1/5670)*z^2*y^4-(1/5670)*z^3*y^3-(1/5670)*z^4*y^2-(1/5670)*z^5*y-(1/30)*z*y+(1/315)*z*y^3+(1/315)*z^2*y^2+(1/315)*z^3*y-(1/30)*y^2+(1/315)*y^4-(1/5670)*y^6

(5)

eval( (5), [x = 0, y = 0, z = 0]);

1/6

(6)

Download series_expansion.mw

Interesting question. This link may help you.

how to copy a plot into zoomed plot - MaplePrimes

Edit:- Another possible useful link

Plot inside one more plot - MaplePrimes

7 nines as in your question
is(257^(1/2) <= 79999999/10000000);
                             false

8 nines
is(257^(1/2) <= 799999999/10000000);
                              true

 

restart;
test := proc(x) local a; a := x^2; end proc;
test(5);
                               25

test(N*M);
                              2  2
                             N  M 

I presume this is what you are trying to achieve.

This shows how to get the answer.

Download Min_Length.mw

RMB on the plot and in the list of oprions at the bottom is export. Click and export as GIF. Then put the GIF file in powerpoint.

Powerpoint_GIF.pptx

I came across this approach a couple of years ago for testing if a point is inside or oudside a polyogon.

The theory is given here Topology, Winding Numbers and Signed Area | Algebraic Calculus One | Wild Egg - YouTube

Basically you need to setup a garunteed exterior point to test with. Then ckeck is the segment from thr exterior point to the point of interest crosses any edges of the polyogon. The crossing number can be -1, 0, 1.   Sum the crossing numbers for all edges. If 0 then the point is on the outside else non zero means the point is on inside. The can handle non convex polygons.

restart

"This method  of determining inside  or outside is based on Crossing Number . If two edges cross the number  is either 1 or -1 else the number is 0  "

NULL

NULLNULL

Q is a random exterior point . P is the point of interest to check whether inside or outside.

"By summing the Crossing Number of PQ an every edge of the polyogon  inside outside is determined by   S=0 then outside  S<>0 then inside"

with(plots); with(plottools)

NULL

_local(D)

Warning, A new binding for the name `D` has been created. The global instance of this name is still accessible using the :- prefix, :-`D`.  See ?protect for details.

 

``

SignedArea := proc (a::{Vector, list}, b::{Vector, list}, c::{Vector, list, null} := null) local M, A; if c = null then A := (1/2)*a[1]*b[2]-(1/2)*a[2]*b[1] else A := ((1/2)*b[2]-(1/2)*c[2])*a[1]+(-(1/2)*b[1]+(1/2)*c[1])*a[2]+(1/2)*c[2]*b[1]-(1/2)*c[1]*b[2] end if; return A end proc

NULL

"CrossingNumber := proc(A::list, B::list, C::list, E::list)  local s1, s2, s3, s4;        s1 := SignedArea(A,B,C);       s2 := SignedArea(A,B,E);        s3 := SignedArea(C,E,B);        s4 := SignedArea(C,E,A);        if s1 = 0 and s2 = 0 and s3 = 0 and s4 = 0 then            'undefined'         elif 0 <= signum(s1) and signum(s2) <= 0 then            if 0 <= signum(s3) and signum(s4) <= 0 then                -1             end if         elif signum(s1) <= 0 and 0 <= signum(s2) then            if signum(s3) <= 0 and 0 <= signum(s4) then               1             end if         else         0         end if;  end proc:"

NULL

Polygon Vertices

A := [0, 0]; B := [200, 0]; C := [200, 300]; D := [250, 400]; E := [500, 300]; F := [500, 500]; G := [0, 500]

COPS := [A, B, C, D, E, F, G, A]

[[0, 0], [200, 0], [200, 300], [250, 400], [500, 300], [500, 500], [0, 500], [0, 0]]

(1)

Points for checking

K := [275, 365]; L := [105, 100]; M := [400, 400]; RoP := [472.991, 557.13]; Points := [K, L, M]

display(polygon(COPS, colour = yellow), point(Points, color = red, symbol = cross, symbolsize = 50), point([RoP], color = blue, symbol = circle, symbolsize = 25))

 

``

for p to nops(Points) do S := 0; for e to nops(COPS)-1 do S := S+CrossingNumber(COPS[e], COPS[e+1], Points[p], RoP); print(CrossingNumber(COPS[e], COPS[e+1], Points[p], RoP)) end do; if S = 0 then print("S=", S, " point of interest is outside") else print("S=", S, "  point of interest is inside") end if end do

"S=", 0, " point of interest is outside"

(2)

NULL

``

Download Inside_or_Outside.mw

You should read the help on taylor and % as I have used that too
 

restart

NULL

t1 := taylor(sin(x), x = 0, 10)

series(x-(1/6)*x^3+(1/120)*x^5-(1/5040)*x^7+(1/362880)*x^9+O(x^11),x,11)

(1)

t2 := taylor(sin(x)*cos(x), x = 0, 10)

series(x-(2/3)*x^3+(2/15)*x^5-(4/315)*x^7+(2/2835)*x^9+O(x^11),x,11)

(2)

coeff(t1, x, 3)

-1/6

(3)

coeff(t2, x, 3)

-2/3

(4)

`%%`/%

1/4

(5)

NULL

coeff(t1, x, 5)

1/120

(6)

coeff(t2, x, 5)

2/15

(7)

`%%`/%

1/16

(8)

NULL

coeff(t1, x, 7)

-1/5040

(9)

coeff(t2, x, 7)

-4/315

(10)

`%%`/%

1/64

(11)

NULL

coeff(t1, x, 9)

1/362880

(12)

coeff(t2, x, 9)

2/2835

(13)

`%%`/%

1/256

(14)

NULL

The pattern is a geometric series based on 1/4


 

Download taylor-1.mw


 

restart

NULL

A := Vector[row]([a1, a2, a3, a4])

Vector[row](%id = 36893489805968615532)

(1)

B := Vector[row]([b1, b2, b3, b4])

Vector[row](%id = 36893489805968735636)

(2)

M := Matrix(4, 8)

Matrix(%id = 36893489805983850972)

(3)

``

for i to 4 do M[i, 2*i-1] := A[i]; M[i, 2*i] := B[i] end do

b4

(4)

M

Matrix(%id = 36893489805983850972)

(5)

NULL


 

Download Build_Matrix_from_Vectors.mw

1 2 3 4 5 Page 2 of 5