Ronan

1022 Reputation

14 Badges

13 years, 109 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are answers submitted by Ronan

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

This will plot the half circle.


 

restart

NULL

eq := x^2+y^2 = 4

x^2+y^2 = 4

(1)

plots:-implicitplot(eq, x = -2 .. 2, y = 0 .. 2, scaling = constrained)

 

NULL


 

Download Half_Circle.mw

Set e to be local is one way to suppress the warning.

local e
                            

a := e^5;
 


e := 2;
                        

a;
                               32

 

This is not as efficient as the other solutions. It just shows more of the steps involved.
 

restart

with(plots)

NULL

P := [6, -3]

[6, -3]

(1)

line := x+2*y-1

x+2*y-1

(2)

lineperp := 2*x-y+c

2*x-y+c

(3)

NULL

c := solve(eval(lineperp, [x = 6, y = -3]), c)

-15

(4)

lineperp

2*x-y-15

(5)

display(implicitplot([line, lineperp], x = -5 .. 8, y = -8 .. 5), pointplot(P, colour = red), scaling = constrained)

 

Pint := eval([x, y], solve({line, lineperp}))

[31/5, -13/5]

(6)

Focus := P+(P-Pint)

[29/5, -17/5]

(7)

display(implicitplot([line, lineperp], x = 0 .. 10, y = -5 .. 5), pointplot([P, Pint, Focus], colour = [red, green, blue]), scaling = constrained)

 

``

distptl := proc (a, b, c) options operator, arrow; (a*x+b*y+c)/sqrt(a^2+b^2) end proc

proc (a, b, c) options operator, arrow; (a*x+b*y+c)/sqrt(b^2+a^2) end proc

(8)

Parb := (x-Focus[1])^2+(y-Focus[2])^2 = distptl(1, 2, -1)^2

(x-29/5)^2+(y+17/5)^2 = (1/5)*(x+2*y-1)^2

(9)

"(->)"

4*x^2+(-4*y-56)*x+y^2+38*y+225 = 0

(10)

``````

display(implicitplot([Parb, line, lineperp], x = 3 .. 10, y = -6 .. 1, colour = [pink, yellow, purple]), pointplot([P, Pint, Focus], colour = [red, green, blue]), scaling = constrained)

 

NULL


 

Download Parabola_from_vertex_and_line.mw

I deleted my original answer to correct my solution. This is not as efficient as @Rouben Rostamian . It just expands out the steps involved.


 

restart

NULL

f := proc (x) options operator, arrow; (x^3+9*x^2-9*x-1)/(x^4+1) end proc

proc (x) options operator, arrow; (x^3+9*x^2-9*x-1)/(x^4+1) end proc

(1)

fsolve(f(x), x)

-.1010205144

(2)

slopef := unapply(diff(f(x), x), x)

proc (x) options operator, arrow; (3*x^2+18*x-9)/(x^4+1)-4*(x^3+9*x^2-9*x-1)*x^3/(x^4+1)^2 end proc

(3)

sol1 := [solve(slopef(x) = .5, x)]

[.4396034712, 1.545359967, 1.135924545+3.219224078*I, 0.7028667536e-1+.8729569266*I, -.8928416048, -3.504544275, 0.7028667536e-1-.8729569266*I, 1.135924545-3.219224078*I]

(4)

NULL

graphs := plot([f(x), slopef(x)], x = -10 .. 4, colour = [red, blue])

 

Eqline := proc (x, y, m, c) options operator, arrow; m*x+c = y end proc

proc (x, y, m, c) options operator, arrow; m*x+c = y end proc

(5)

P1y := f(sol1[1])

-3.019451886

(6)

m := .5

.5

(7)

line1 := Eqline(sol1[1], P1y, m, c1)

.2198017356+c1 = -3.019451886

(8)

c1 := solve(line1, c1)

-3.239253622

(9)

line1 := Eqline(x, y, m, c1)

.5*x-3.239253622 = y

(10)

NULL

P2y := f(sol1[2])

1.532928834

(11)

``

line2 := Eqline(sol1[2], P2y, m, c2)

.7726799835+c2 = 1.532928834

(12)

c2 := solve(line2, c2)

.7602488505

(13)

line2 := Eqline(x, y, m, c2)

.5*x+.7602488505 = y

(14)

NULL

P3y := f(sol1[5])

8.253465266

(15)

``

line3 := Eqline(sol1[5], P3y, m, c3)

-.4464208024+c3 = 8.253465266

(16)

c3 := solve(line3, c3)

8.699886068

(17)

line3 := Eqline(x, y, m, c3)

.5*x+8.699886068 = y

(18)

NULL

P4y := f(sol1[6])

.6456334552

(19)

``

line4 := Eqline(sol1[6], P4y, m, c4)

-1.752272138+c4 = .6456334552

(20)

c4 := solve(line4, c4)

2.397905593

(21)

line4 := Eqline(x, y, m, c4)

.5*x+2.397905593 = y

(22)

NULL

graphslines := plot([lhs(line1), lhs(line2), lhs(line3), lhs(line4)], x = -10 .. 4)

plots:-display(graphs, graphslines)

 

NULL


 

Download equations_of_4_lines.mw

1 2 3 4 5 6 Page 3 of 6