Ronan

1072 Reputation

14 Badges

12 years, 76 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are questions asked by Ronan

I have a set of points. I only want to plot ones with x and y less that 5 units from [0,0]. I can do it with for do loop. Can't get it to work with seq. Ideally I don't want to create another list.

restart

NULL

points := [[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], [8.963609684, 7.419424024], [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]

``

" points2:= [seq('if'(" abs"(points[i,1])<5 and abs(points[i,2])<5, points[i] ,0)  ,i=1..10)] "

[[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], `if`(false, [8.963609684, 7.419424024]), [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]

(1)

``

redp := plots:-pointplot(points, colour = red, symbolsize = 4, symbol = solidcircle)

 

plots:-pointplot(points2, colour = red, symbolsize = 4, symbol = solidcircle)

Error, invalid input: `if` expects 3 arguments, but received 2

 

NULL

NULL

Download 13-3-22_remove_points_plotting.mw

I simplified a vector column using side relations. Then I wanted to evaluate using

eval( equation,  [x1=3,  x2=5......})

But side relations uses the reverse order i.e. after evaluation

[3=x1, 5=x2......]

So then the internals of the list need to be swaped tto work with eval.That is easy. I am just wondering is there a neater way to achieve this?

restart

NULL

P1 := Vector(3, {(1) = -(y[1]-y[3])*(y[2]-y[3])*((x[2]^2-x[2]*x[3]+x[3]^2)*x[1]^2-x[2]*x[3]*(x[2]+x[3])*x[1]+x[2]^2*x[3]^2)*(y[1]-y[2]), (2) = -(x[1]-x[3])*(x[2]-x[3])*(x[1]-x[2])*((y[2]^2-y[2]*y[3]+y[3]^2)*y[1]^2-y[2]*y[3]*(y[2]+y[3])*y[1]+y[2]^2*y[3]^2), (3) = ((-y[1]^2*y[2]+(3*y[2]*y[3]-y[3]^2)*y[1]-y[2]^2*y[3])*x[2]+x[3]*(y[1]^2*y[3]+y[2]*(y[2]-3*y[3])*y[1]+y[2]*y[3]^2))*x[1]^2+((y[1]^2*y[3]+y[2]*(y[2]-3*y[3])*y[1]+y[2]*y[3]^2)*x[2]^2+3*x[3]*(y[2]-y[3])*(y[1]-y[3])*(y[1]-y[2])*x[2]-x[3]^2*(y[1]^2*y[2]+(-3*y[2]*y[3]+y[3]^2)*y[1]+y[2]^2*y[3]))*x[1]-x[3]*((y[1]^2*y[2]+(-3*y[2]*y[3]+y[3]^2)*y[1]+y[2]^2*y[3])*x[2]-x[3]*(y[1]^2*y[3]+y[2]*(y[2]-3*y[3])*y[1]+y[2]*y[3]^2))*x[2]})

eqns := {(x[1]-x[2])*(x[2]-x[3])*(x[3]-x[1]) = R, (y[1]-y[2])*(y[2]-y[3])*(y[3]-y[1]) = S, x[1]^2*x[2]^2-x[1]^2*x[2]*x[3]+x[1]^2*x[3]^2-x[1]*x[2]^2*x[3]-x[1]*x[2]*x[3]^2+x[2]^2*x[3]^2 = Y, y[1]^2*y[2]^2-y[1]^2*y[2]*y[3]+y[1]^2*y[3]^2-y[1]*y[2]^2*y[3]-y[1]*y[2]*y[3]^2+y[2]^2*y[3]^2 = X, x[1]^2*x[2]+x[1]^2*x[3]+x[1]*x[2]^2-6*x[1]*x[2]*x[3]+x[1]*x[3]^2+x[2]^2*x[3]+x[2]*x[3]^2 = Z, y[1]^2*y[2]+y[1]^2*y[3]+y[1]*y[2]^2-6*y[1]*y[2]*y[3]+y[1]*y[3]^2+y[2]^2*y[3]+y[2]*y[3]^2 = W}

P1new := simplify(P1, eqns)

Vector[column](%id = 36893490132854572084)

(1)

values := {x[1] = 3, x[2] = 5, x[3] = 7, y[1] = 2, y[2] = -11, y[3] = 13}

{x[1] = 3, x[2] = 5, x[3] = 7, y[1] = 2, y[2] = -11, y[3] = 13}

(2)

vals1 := eval(eqns, values)

{-3432 = S, 16 = R, 120 = Z, 316 = Y, 2018 = W, 22753 = X}

(3)

eval(P1new, vals1)

Vector[column](%id = 36893490132854572084)

(4)

vals1swap := [seq(rhs(vals1[i]) = lhs(vals1[i]), i = 1 .. nops(vals1))]

[S = -3432, R = 16, Z = 120, Y = 316, W = 2018, X = 22753]

(5)

eval(P1new, vals1swap)

Vector[column](%id = 36893490132849052116)

(6)

eval(P1, values)

Vector[column](%id = 36893490132871267020)

(7)

``

NULL

``

Download Q_6-03-2022_side_rels_and_eval.mw

 I have two personal packages I wrote for Maple a few years age. I use them regurlary. They are stored in two differant locations.  Is there of interogerating Maple to find out where they are and some details obout them? What I load is

with(RationalTrigonometry) and with(RonanRoutines)

I finally found them again.

One in C\usersIRonan\Maple\persona\lib\RatTrig.mla

Other in (basically in) My documents\Maple\.A library\RonanRoutines1.mla

So the package load name and the .mla file name are different. I would like to know where the packages are being loaded from and under what name they are saved as.

 

I am trying to compute the determinant of a 3 x 3 matrix. It has very involved symbolic entries.

The cpu goes to 100% and after about a minute I get BSOD on windows 10. Using a 4 core i7 64 gig of ram.

Can I stop Maple using all the cores to see if this helps the BSOD.?

I would like to open a specially formatted document from start/new document. I set  up one with a fixed width table to make it easy to print to A4. I find the very useful for taking notes.

Currently I just save it as  a usual document. The attached shows the basic setup I use. Contents arn't too relivant.

restart

``

 

 

 

"R(m2,m3,m4,...)&equiv;((2 m2+3 m3+4 m4+...)!)/((1+m2+2 m3+3 m4+...)!m2!m3!m4!...)"

 

 

  

Xterm := factorial(2*m+3*n+4*p+5*q)*c[2]^m*c[3]^n*c[4]^p*c[5]^q/(factorial(1+m+2*n+3*p+4*q)*factorial(m)*factorial(n)*factorial(p)*factorial(q))

factorial(2*m+3*n+4*p+5*q)*c[2]^m*c[3]^n*c[4]^p*c[5]^q/(factorial(1+m+2*n+3*p+4*q)*factorial(m)*factorial(n)*factorial(p)*factorial(q))

(1)

k := 5

5

(2)

x := add(add(add(add(Xterm, q = 0 .. 4*k), p = 0 .. 3*k), n = 0 .. 2*k), m = 0 .. k)

nops(x)

22176

(3)

NULL

nops(TestPoly)

1

(4)

ldegree(TestPoly)

1

(5)

NULL

NULL

NULL
NULL

mtaylor(TestPoly, [c[2], c[3], c[4], c[5]], k+2)

TestPoly

(6)

C1 := 1; C2 := -2; C3 := 3; C4 := -4; C5 := 5

5

(7)

Poly1 := expand((y+C1)*(y+C2)*(y+C3)*(y+C4)*(y+C5))

y^5+3*y^4-23*y^3-51*y^2+94*y+120

(8)

NULL

Poly1 := Poly1/coeff(Poly1, y, 0)

(1/120)*y^5+(1/40)*y^4-(23/120)*y^3-(17/40)*y^2+(47/60)*y+1

(9)

NULL

Poly1 := expand((y+C1)*(y+C2)*(y+C3)*(y+C4)*(y+C5))

y^5+3*y^4-23*y^3-51*y^2+94*y+120

(10)

NULL

Poly1 := Poly1/coeff(Poly1, y, 0)

(1/120)*y^5+(1/40)*y^4-(23/120)*y^3-(17/40)*y^2+(47/60)*y+1

(11)

fsolve(Poly1, y)

-5., -3., -1., 2., 4.

(12)

coeff(Poly1, y, 1)

47/60

(13)

Poly2 := algsubs(y = -z/coeff(Poly1, y, 1), Poly1)

-(6480000/229345007)*z^5+(324000/4879681)*z^4+(41400/103823)*z^3-(1530/2209)*z^2-z+1

(14)

"(->)"

-0.28254e-1*z^5+0.66398e-1*z^4+.39876*z^3-.69262*z^2-1.*z+1.

(15)

"(->)"

 

solve(Poly2, z)

-47/30, -47/15, 47/12, 47/20, 47/60

(16)

-%/coeff(Poly1, y, 1)

2, 4, -5, -3, -1

(17)

NULL

 

 

``

``

NULL

Download A4_format.mw

First 9 10 11 12 13 14 15 Last Page 11 of 28