Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I'm trying show the all roots of equations using Bairstow's methodt, but only shows the roots of Quadratic Factor and don't show the others roots of the other equation. Thanks

This the code:


 

restart; Bairstow := proc (n, a, u0, v0, itmax, TOL) local u, v, b, c, j, k, DetJ, du, dv, s1, s2; u := u0; v := v0; b := Array(0 .. n); c := Array(0 .. n); b[n] := a[n]; c[n] := 0; c[n-1] := a[n]; for j to itmax do b[n-1] := a[n-1]+u*b[n]; for k from n-2 by -1 to 0 do b[k] := a[k]+u*b[k+1]+v*b[k+2]; c[k] := b[k+1]+u*c[k+1]+v*c[k+2] end do; DetJ := c[0]*c[2]+(-1)*c[1]*c[1]; du := (-b[0]*c[2]+b[1]*c[1])/DetJ; dv := (b[0]*c[1]-b[1]*c[0])/DetJ; u := u+du; v := v+dv; printf("%3d %12.7f %12.7f %12.4g %12.4g\n", j, u, v, du, dv); if max(abs(du), abs(dv)) < TOL then break end if end do; printf("\nQ(x)=(%g)x^%d", b[n], n-2); for k from n-3 by -1 to 1 do printf(" + (%g)x^%d", b[k+2], k) end do; printf(" + (%g)\n", b[2]); printf("Remainder: %g(x-(%g))+(%g)\n", b[1], u, b[0]); printf("Quadratic Factor: x^2-(%g)x-(%g)\n", u, v); s1 := evalf((1/2)*u+(1/2)*sqrt(u*u+4*v)); if u^2+4*v < 0 then printf("Zeros: %.13g +-(%.13g)i\n", Re(s1), abs(Im(s1))) else s2 := evalf((1/2)*u-(1/2)*sqrt(u*u+4*v)); printf("Zeros: %.13g, %.13g\n", s1, s2) end if end proc; P := proc (x) options operator, arrow; x^5+(-1)*3.5*x^4+2.75*x^3+2.125*x^2+(-1)*3.875*x+1.25 end proc; n := degree(P(x)); a := Array(0 .. n); a[0] := P(0); for i to n do a[i] := coeff(P(x), x^i) end do; itmax := 10; TOL := 10^(-10); r := -1; s := -1; Bairstow(n, a, r, s, itmax, TOL)

  1   -0.6441699    0.1381090       0.3558        1.138
  2   -0.5111131    0.4697336       0.1331       0.3316
  3   -0.4996865    0.5002023      0.01143      0.03047
  4   -0.5000001    0.5000000   -0.0003136   -0.0002023
  5   -0.5000000    0.5000000    6.413e-08    9.268e-09
  6   -0.5000000    0.5000000            0            0

Q(x)=(1)x^3 + (-4)x^2 + (5.25)x^1 + (-2.5)
Remainder: 0(x-(-0.5))+(0)
Quadratic Factor: x^2-(-0.5)x-(0.5)
Zeros: 0.4999999993, -0.9999999997

 

 

Only show two roots: 0.4999999993, -0.9999999997, but the other roots are missing: 2, -1, 1+0.5i, 1-0.5i approximately, any solution?

I think it's in this part, but I can't think of how to implement it to get the missing roots.

 

Download Bairstow.mw

 

I'm using the 15 day trial as a Computer Science student. For my first project, Maple worked very well. I've been using the ApproximateInt() command. This command worked in the first assignment, and so I created a new document to start on my second assignment, and suddenly:

Entering the same ApproximateInt() command in a prompt line will not execute the command. Where it should display a plot of Riemann sums, it only displays the text I had entered. If I open the first document in which it was working properly, it also breaks upon re-iterating the command lines.

Image of expected behaviour:

Image taken right after pressing enter:

Is anyone familiar with this Maple behaviour? Thank you for any help. Meanwhile, I will attempt a reinstallation. The maple file is attached, as well.

P.S: Interestingly, the plot() command does work, as well as simple commands such as 1+2 (Displays "3")

my code is 
for i from 1 to 20 do:

print("new variable" + i)

end do;

It gives the result new vaiable + 1,

how can I print out new variable 1 instead of new variable + 1

The dsolve numeric events syntax requires the use of If(a,b,c) rather than the usual if then else syntax. Also, the possible action parts of an event are truly mysterious as are discrete variables. Has anyone plaed around with this much? For example, can the If's be nested? I know I can test that in a toy situation but there are many such questions that arise and I don't want to reinvent the wheel.

Can Maple auto switch input language according to mode of editing?

I would like to:
In 2D-math mode- auto set (after pressing F5 or clicking "math" button) english language
In Text-mode- auto set (after pressing F5 or clicking "text" button) my native language

How Can I set up this option?

My colleague and I are revising a paper which contains some 3dplots generated I think originally in Maple 2015 on macos as eps converted to pdf.  Originally they were around the 100 KB size.  When I generate them again in Maple 2017 they are more like 10 MB.  He is still running Maple 2015 and get the same 100 KB size.  Any idea what is going on here ?  

Thanks Michael

EDIT:  An example is 

with(plots);
plotsetup(postscript, plotoutput = `test.eps`, plotoptions = `color,portrait,height=350,width=350`);
plot3d(x^2+y^2+1, x = -1 .. 1, y = -1 .. 1, axes = boxed, grid = [200, 200]);

I get 7.6 MB my colleague with Maple 2015 gets 56 KB.  I tried it wtih Maple 2017 on a server I have access to also 7.6 MB.

my_euler := proc (func_y, x_value, y_value, n, h) 
local point_list, d_x, true_f, true_f_v; point_list := [10^(-n), 0, n]; 
true_f := unapply(func_y, x, y); 
d_x := abs(point_list[2]-point_list[3]); 
while d_x < point_list[1] do 
    true_f_v := true_f(x_value, y_value); 
    y_value := y_value+h*true_f_v; 
    x_value := x_value+h 
end do; 
return y_value 
end proc

I am using Maple to implement Euler's method, it requires 5 parameters:

  • func_y (The general form of ODE)
  • x_value
  • y_value
  • n (The accurate digits, I do not know how to control the accurate digits)
  • h (The step size)

So, I do not how to control accurate digits (4 accurate digits), can you teach me how to finish this part?

I am using Maple to load well-behaved function data (512 points) and using ArrayInterpolation integrate it:

P:= r -> CurveFitting:-ArrayInterpolation(xydata, Array(1 .. 1, 1 .. 1, [r]), method = spline)[1];.

While the simple integral    int(P, 0 .. 100, numeric, digits = 4)    outputs a number, if I add another variable like   int(P*a, [r = 0 .. 1, a = 0 .. 1], numeric)    it just outputs      int(P*a, [r = 0 .. 1, a = 0 .. 1], numeric)  (obviously the integral is more complex but this just shows the principle).

int(P(r)*a, [r = 0 .. 1, a = 0 .. 1], numeric)  gives and error 'invalid input: coordinates of xvalues must be of type numeric'. Does anyone know the syntax to make this integral evaluate numerically?

I really wouldn't want to use   spline()  or interpolation()  because as far as I have tried they are really slow and incompatable respectively. Actual document below.


Much thanks in advance.

restart; with(LinearAlgebra); with(CurveFitting); with(Interpolation); with(plots)

NULL

NULL

data := Import("C:/Users/Ingvars/Desktop/data.csv", output = Matrix)

NULL

NULL``

P := proc (r) options operator, arrow; CurveFitting:-ArrayInterpolation(`<|>`(Column(data, 1), `~`[`^`](Column(data, 15), 2)), Array(1 .. 1, 1 .. 1, [[r]]), method = spline)[1] end proc
``

``

NULLNULL

display(plot(P, 0 .. 10), pointplot(Column(data, 1)[1 .. 450], `~`[`^`](Column(data, 15)[1 .. 450], 2), symbolsize = 2, color = red))

 

NULL

int(P, 0 .. 100, numeric, digits = 4)

1.000

(1)

NULL

"F_R(m,l,q):=2*int(P*sin(q r cos(theta))^(2)*sin(theta)*|(Y)[l]^(m)(theta,phi)|^(2),[theta=0..Pi,phi=0..2 Pi,r=0..100],numeric,digits=4):"NULL

"F_I(m,l,q):=int(P*sin(q r cos(theta))*sin(theta)*|(Y)[l]^(m)(theta,phi)|^(2),[theta=0..Pi,phi=0..2 Pi,r=0..100],numeric,digits=4):" 

 

"F(m,l,q):=|F_R(m,l,q)-i*F_I(m,l,q)|:"

 

 

evalf(F(1, 2, 1))

abs(-2.*(Int(Int(Int(P*sin(r*cos(theta))^2*sin(theta)*abs(SphericalY(2., 1., theta, phi))^2, theta = 0. .. 3.142), phi = 0. .. 6.284), r = 0. .. 100.))+(1.*I)*(Int(Int(Int(P*sin(r*cos(theta))*sin(theta)*abs(SphericalY(2., 1., theta, phi))^2, theta = 0. .. 3.142), phi = 0. .. 6.284), r = 0. .. 100.)))

(2)

``


 

Download Au_Scattering.mw


 

with(LinearAlgebra); S[p] := 34.722406639004; alpha[1] := 0.2e-3; mu := 0.2041e-1; tau := .33; beta := .5; eta[1] := 0.96e-1; alpha[2] := .2; sigma := .9; e[o] := .33; delta := .2115; eta[2] := 0.2485e-2; A := Matrix(6, 6, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = alpha[1]*S[p], (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = beta, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0, (5, 6) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = 0}); B := Matrix(6, 6, {(1, 1) = mu, (1, 2) = tau, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = e[o], (2, 1) = 0, (2, 2) = tau+mu, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = beta+eta[1]+sigma+mu, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = (1-delta)*alpha[2]-mu, (4, 5) = 0, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = alpha[2]*delta, (5, 5) = mu+eta[2], (5, 6) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = mu+e[o]}); 1/B; VectorMatrixMultiply(A, 1/B)

S[p] := 34.722406639004

 

alpha[1] := 0.2e-3

 

mu := 0.2041e-1

 

tau := .33

 

beta := .5

 

eta[1] := 0.96e-1

 

alpha[2] := .2

 

sigma := .9

 

e[o] := .33

 

delta := .2115

 

eta[2] := 0.2485e-2

 

A := Matrix(6, 6, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0.6944481328e-2, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = .5, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0, (5, 6) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = 0})

 

B := Matrix(6, 6, {(1, 1) = 0.2041e-1, (1, 2) = .33, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = .33, (2, 1) = 0, (2, 2) = .35041, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1.51641, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = .13729, (4, 5) = 0, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0.4230e-1, (5, 5) = 0.22895e-1, (5, 6) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = .35041})

 

Matrix(6, 6, {(1, 1) = 48.9955903968643, (1, 2) = -46.1417905623847, (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (1, 6) = -46.1417905623847, (2, 1) = 0., (2, 2) = 2.85379983447961, (2, 3) = 0., (2, 4) = 0., (2, 5) = 0., (2, 6) = -0., (3, 1) = 0., (3, 2) = 0., (3, 3) = .659452258953713, (3, 4) = 0., (3, 5) = 0., (3, 6) = -0., (4, 1) = 0., (4, 2) = 0., (4, 3) = 0., (4, 4) = 7.28385170077937, (4, 5) = 0., (4, 6) = -0., (5, 1) = 0., (5, 2) = 0., (5, 3) = 0., (5, 4) = -13.4573892528049, (5, 5) = 43.6776588774842, (5, 6) = -0., (6, 1) = 0., (6, 2) = 0., (6, 3) = 0., (6, 4) = 0., (6, 5) = 0., (6, 6) = 2.85379983447961})

 

Matrix(6, 6, {(1, 1) = 0., (1, 2) = 0., (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (1, 6) = -0., (2, 1) = 0., (2, 2) = 0., (2, 3) = 0., (2, 4) = 0., (2, 5) = 0., (2, 6) = -0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 0.457955389901148e-2, (3, 4) = 0., (3, 5) = 0., (3, 6) = -0., (4, 1) = 0., (4, 2) = 0., (4, 3) = .329726129476857, (4, 4) = 0., (4, 5) = 0., (4, 6) = -0., (5, 1) = 0., (5, 2) = 0., (5, 3) = 0., (5, 4) = 0., (5, 5) = 0., (5, 6) = -0., (6, 1) = 0., (6, 2) = 0., (6, 3) = 0., (6, 4) = 0., (6, 5) = 0., (6, 6) = -0.})

(1)

LinearAlgebra:-Eigenvalues( (1) );

Vector(6, {(1) = 0.+0.*I, (2) = 0.+0.*I, (3) = 0.+0.*I, (4) = 0.457955389901148e-2+0.*I, (5) = 0.+0.*I, (6) = -0.+0.*I})

(2)


 

Download AB.mw

hello everyone, I had mistake from maple plot.

Can someone help me with animation my plot


restart;
with(plots);

with(plottools);

K := 48;
R1 := 30; R2 := 20; OA := R1+R2;
Vodilo := PLOT3D(cuboid([-3, -3, 0], [OA+4, 4, 2]));

Koleso1 := PLOT3D(cylinder([0, 0, 5], R1, 18), cylinder([0, 0, -2], 1, 16));
Koleso2 := PLOT3D(cylinder([0, 0, 7], R2, 6), cylinder([0, 0, -2], 1, 16));
for i from 0 to K do  end do;

Amplituda := .3;
phi := sin(6.28*i/K)*Amplituda;

phi1 := phi*(R1+R2)/R2;

P1 := rotate(Koleso2, 0, 0, -phi1);


P2 := rotate(Vodilo, 0, 0, -phi);

x := OA*cos(phi); y := OA*sin(phi);

P[i] := display(Koleso1, translate(P1, x, y, 0), P2);


display(seq(P[i], i = 0 .. K), orientation = [55, 101], insequence = true, scaling = constrained, axes = normal);
Error, (in plots:-display) expecting plot structure but received: P[0]

 

I don't understand why maple is ignoring my predicate in this worksheet



Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/Task_List_Win10.mw .
 

Download Task_List_Win10.mw

Dear all

I hope to find the maximum of a given function or show that the maximum is negative.

 

negative_maximum.mw

 

many thanks for your help

Why is it that maple produces an incorrect answer in this command:

`assuming`([RealDomain[solve](sec(x) = sqrt(2), {x}, useassumptions)], [x > 3*Pi*(1/2) and x < 2*Pi])

 

and no answers in this command:

RealDomain[solve]({x > 3*Pi*(1/2), sec(x) = sqrt(2), x < 2*Pi}, {x})

 

???  Please help???

I'm trying to solve a linear first order PDE with polynomial coeffients in Maple. I need to find homogeneous polynomial solutions for the PDE. Although there is PolynomialSolutions option in PDEtools, the polynomial solution obtained from this method is not homogeneous. I want the polynomial solutions to be homogeneous because, for higher degree polynomial solution the calculations are very slow. By the solutions being homogeneous, I can cut down all the unnecessary calculations of finding the lower order terms. So, how do I do this?

Since maple doesn't have mp3 support, the best we can do is just convert to a supported file type and go from there.  We can actually use maple's system command to work within maple to accomplish this and other tasks.  Actually someone using Matlab created an FFmpeg tool package - something similar could also be done with Maple.

So first you need to load the free open source FFmpeg software into your machine.  I'm using windows so Unzip into a folder then into right click on mycomputer go into properties advanced and add a new environment variable.

However I'm having a problem using the ssystem command.  The system command actually works fine, so I don't know if it's an issue with my format of the command or maybe it's a bug within the Maple 18 that I'm currently working in (perhaps it works on the newer versions) so here's the script

system("ffmpeg -i c:/test/test.mp3") #works fine outputed in a new window displays info about specified file

ssystem("ffmpeg -i c:/test/test.mp3") #maple is busy sitting executing with nothing happening

However this works,

ssystem("ffmpeg -version") #does output into Maple just information of the ffmpeg software version

so I suspect something to do with the file formatting??  Any ideas why ssystem doesn't output into maple using a file location?

 

1 2 3 4 5 6 7 Last Page 1 of 1652