MaplePrimes Questions

Is there any easy way to do subs([a,b,c]=x, [2,4,5,1,a,4,5,a,b,434,a,b,c,5,5,5,1]) = [2,4,5,1,a,4,5,a,b,434,x,5,5,5,1]

and another way to get [2,4,5,1,a,4,5,a,b,434,x,b,c,5,5,5,1]

The first subsitutes the entire match and the second substitutes when matches but only for first element.

I know I can write routines to do this and will after posting this but is there a native way that is simple?

Hi,

I try to enrich the layout of my documents by tables like that of trigonometric numbers. Is there a way to make it simpler? without going through the encoding of all values.Thanks

TableauTest.mw

The worksheet below displays a sphere with a surface patch defined by the arcs of three intersecting circles on the sphere's surface.

How can the patch be colored differently from the non-patch sphere's surface?

Patch_on_a_Sphere.mw

I am looping over a list of functions to calculate various properties of the said functions. some of these calculations take too long. I was wondering if there was a way to skip to the next element of the loop if a calculation takes more than a specific time.

 I looking to contact a maple sales representative. I am from india I am not getting any contact number. Can anyone help.

Kind help anyone if possible. I do research in mathematics  field but at a personal level. I need help on which product to buy and a sales represitive number or someone to contact me so that i can first understand certain doubts from my personal end then I can opt for.

 

``

NULL

U(t, r, theta, phi) = _F1(r, theta, a^2*phi+phi*r^2-a*t)

eq1 := a*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(cos(theta)-1)*(cos(theta)+1)*(r^2+a^2*cos(theta)^2)^2*(diff(U(t, r, theta, phi), t, t))-a*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(cos(theta)-1)*(cos(theta)+1)*(r^2+a^2*cos(theta)^2)*(diff(U(t, r, theta, phi), theta, theta))-(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(r^2+a^2*cos(theta)^2)^2*(diff(U(t, r, theta, phi), phi, t))+a*U(t, r, theta, phi)*(cos(theta)-1)*(cos(theta)+1)*(r^2+a^2*cos(theta)^2)*(diff(U(t, r, theta, phi), theta))^2-a*cos(theta)*sin(theta)*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(a^2*cos(theta)^2-2*a^2-r^2)*(diff(U(t, r, theta, phi), theta))-(diff(U(t, r, theta, phi), t))*((a*cos(theta)^2-a)*(diff(U(t, r, theta, phi), t))-(diff(U(t, r, theta, phi), phi)))*U(t, r, theta, phi)*(r^2+a^2*cos(theta)^2)^2

a*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(cos(theta)-1)*(cos(theta)+1)*(r^2+a^2*cos(theta)^2)^2*(diff(diff(U(t, r, theta, phi), t), t))-a*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(cos(theta)-1)*(cos(theta)+1)*(r^2+a^2*cos(theta)^2)*(diff(diff(U(t, r, theta, phi), theta), theta))-(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(r^2+a^2*cos(theta)^2)^2*(diff(diff(U(t, r, theta, phi), phi), t))+a*U(t, r, theta, phi)*(cos(theta)-1)*(cos(theta)+1)*(r^2+a^2*cos(theta)^2)*(diff(U(t, r, theta, phi), theta))^2-a*cos(theta)*sin(theta)*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(a^2*cos(theta)^2-2*a^2-r^2)*(diff(U(t, r, theta, phi), theta))-(diff(U(t, r, theta, phi), t))*((a*cos(theta)^2-a)*(diff(U(t, r, theta, phi), t))-(diff(U(t, r, theta, phi), phi)))*U(t, r, theta, phi)*(r^2+a^2*cos(theta)^2)^2

(1)

eq2 := -a*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(cos(theta)-1)*(cos(theta)+1)*(diff(U(t, r, theta, phi), r, t))+(U(t, r, theta, phi)^2-1)*(diff(U(t, r, theta, phi), phi, r))+(diff(U(t, r, theta, phi), r))*((a*cos(theta)^2-a)*(diff(U(t, r, theta, phi), t))-(diff(U(t, r, theta, phi), phi)))

-a*(U(t, r, theta, phi)-1)*(U(t, r, theta, phi)+1)*(cos(theta)-1)*(cos(theta)+1)*(diff(diff(U(t, r, theta, phi), r), t))+(U(t, r, theta, phi)^2-1)*(diff(diff(U(t, r, theta, phi), phi), r))+(diff(U(t, r, theta, phi), r))*((a*cos(theta)^2-a)*(diff(U(t, r, theta, phi), t))-(diff(U(t, r, theta, phi), phi)))

(2)

NULL

Download probfile.mw

I need to solve a system of coupled partial differential equations. I would like to search for a function of 4 variables but such that two of the variables only appear in a particular combination.

F(theta,r, phi*(a^2+r^2)-at).

Is there a way to enforce this?

I may have asked this before, but if so lost answer.

I'm trying to put a relatively elaborate peace of code in a loop, but can't figure out how to have multiple lines. Each command separated by ';' is awkward and seems to cause me to make even more typos then normal and it's hard to read the code.

Is there a way to have command on separate lines with in a loop?

-Arthur 

I used Maple to factor (using ifactor) the number 10^128 + 1.  Maple produced the factors in a matter of seconds.

One of the factors had 116 digits.  I then restarted Maple and executed the command ifactor(X) where X was the

factor with 116 digits.  Maple found the number was prime instantly.  I do not understand how one can determine

that a number  with 116 digits is prime in less than a second.  My guess is that Maple has stored some large primes.

Also I used  Maple to factor (10^128+3) and I turned the program off because it was taking forever.

The matrix data[gridji,4] in my code has float undefined. Please, how do I handle it?

In part of my program, I have a loop that the iterative calculations are performed there. During running the program when it comes to the loop the memory usage become full in a short period of time and I face the memory shortage. Since my program is so long and huge, I only can show the loop part of it here, you may look at where is the problem of high memory usage in loop and how to deal with it. Any comment will be appreciated.

I again note that, this segment can not be run independently since it is a part of big program. I put it just to see and mmake comment if any.

M := 3; Nm := 1

w0 := Matrix(M+Nm, 1)

wd0 := Matrix(M+Nm, 1)

taim := 1

F0 := convert([seq(Quadrature(Quadrature(simplify(add(add(W[i, j, 4, r]*LegendreP(i, 1)*LegendreP(j, 0), i = 0 .. II), j = 0 .. JJ)), `ζ__1` = -1 .. 1, method = romberg[3]), `η__1` = -1 .. 1, method = romberg[3]), r = 1 .. M), seq(0, n = 1 .. Nm)], Matrix)

T := 1/(2*Pi*`ω__km`[M][2])

dt := (1/10)*T

0.1123479896110e-4

(1)

for i to M do tau[i](t) := tau[i] end do

for i to Nm do p[i](t) := p[i] end do

`α__N` := .5; `β__N` := .25; a__0 := 1/(`β__N`*dt^2); a__1 := `α__N`/(`β__N`*dt); a__2 := 1/(`β__N`*dt); a__3 := 1/(2*`β__N`)-1; a__4 := `α__N`/`β__N`-1; a__5 := dt*(`α__N`/(2*`β__N`)-1); a__6 := dt*(1-`α__N`); a__7 := `α__N`*dt

q := Matrix(1 .. M+Nm, 1 .. floor(taim/dt)+1)

dq := Matrix(1 .. M+Nm, 1 .. floor(taim/dt)+1)

ddq := Matrix(1 .. M+Nm, 1 .. floor(taim/dt)+1)

q(1 .. M+Nm, 1) := w0

dq(1 .. M+Nm, 1) := wd0

for i to M do tau[i] := q(i, 1) end do

for i to Nm do p[i] := q(M+i, 1) end do

ddq(1 .. M+Nm, 1) := 1/ML.(diff((diff(sin(`ω__b`*t__0), t__0))*LinearAlgebra:-Transpose(F0), t__0)-CL.dq(1 .. M+Nm, 1 .. 1)-KL.q(1 .. M+Nm, 1 .. 1)-eqMNL)

t__0 := dt

V := LinearAlgebra:-Transpose(convert([seq(Tau[i], i = 1 .. M), seq(P[i], i = 1 .. Nm)], Matrix))

Qn__2 := LinearAlgebra:-Transpose(Matrix(1, M+Nm))

Qn__3 := LinearAlgebra:-Transpose(Matrix(1, M+Nm))

External force

 

`ω__b` := 25

``

F := diff((diff(sin(`ω__b`*t), t))*LinearAlgebra:-Transpose(convert(F0, Matrix)), t)

``

s := 1

k__d := 100000

with(Student[NumericalAnalysis]); dt

``

Loop

 

for t from t__0 by dt to taim do EQ := KL.V+a__0*ML.V+a__1*CL.V-ML.(a__0*q(1 .. M+Nm, s .. s)+a__2*dq(1 .. M+Nm, s .. s)+a__3*ddq(1 .. M+Nm, s .. s))-CL.(a__1*q(1 .. M+Nm, s .. s)+a__4*dq(1 .. M+Nm, s .. s)+a__5*ddq(1 .. M+Nm, s .. s))-F-Qn__2-Qn__3; G := Matrix(M+Nm, proc (i, j) options operator, arrow; (diff(EQ[i], V[j, 1]))[1] end proc); G1 := 1/G; if t = t__0 then X[1] := 1/(CL*a__1+ML*a__0+KL).(F+ML.(a__0*q(1 .. M+Nm, s .. s)+a__2*dq(1 .. M+Nm, s .. s)+a__3*ddq(1 .. M+Nm, s .. s))+CL.(a__1*q(1 .. M+Nm, s .. s)+a__4*dq(1 .. M+Nm, s .. s)+a__5*ddq(1 .. M+Nm, s .. s))) else X[1] := q(1 .. M+Nm, s .. s) end if; for k to 11 do X[k+1] := eval(V-G1.EQ, Equate(V, X[k])) end do; q(1 .. M+Nm, s+1 .. s+1) := X[k]; ddq(1 .. M+Nm, s+1 .. s+1) := a__0*(q(1 .. M+Nm, s+1 .. s+1)-q(1 .. M+Nm, s .. s))-a__2*dq(1 .. M+Nm, s .. s)-a__3*ddq(1 .. M+Nm, s .. s); dq(1 .. M+Nm, s+1 .. s+1) := dq(1 .. M+Nm, s .. s)+a__6*ddq(1 .. M+Nm, s .. s)+a__7*ddq(1 .. M+Nm, s+1 .. s+1); Wxy2 := add(add(add(h*W[i, j, 2, o]*LegendreP(i, `&zeta;__2`)*LegendreP(j, `&eta;__2`)*q[o, s+1], i = 0 .. II), j = 0 .. JJ), o = 1 .. M); Wxy3 := add(add(add(h*W[i, j, 3, o]*LegendreP(i, `&zeta;__2`)*LegendreP(j, `&eta;__2`)*q[o, s+1], i = 0 .. II), j = 0 .. JJ), o = 1 .. M); Plt := plots:-implicitplot(Wxy2-Wxy3, `&zeta;__2` = -1 .. 1, `&eta;__2` = -1 .. 1, color = red, thickness = 2, gridrefine = 3); j := 111111; Hvs2 := 1; for i while i <= j do Pnt[i] := op([1, i], Plt); if Wxy2-Wxy3 = 0 then j := 0 elif convert(Pnt[i], string)[1] = "C" then j := 0 else a__e[i] := (1/2)*abs(max(Column(Pnt[i], 1))-min(Column(Pnt[i], 1))); if a__e[i] = 0 then a__e[i] = 0.1e-5 end if; b__e[i] := (1/2)*abs(max(Column(Pnt[i], 2))-min(Column(Pnt[i], 2))); if b__e[i] = 0 then b__e[i] = 0.1e-5 end if; xc[i] := (max(Column(Pnt[i], 1))+min(Column(Pnt[i], 1)))*(1/2); yc[i] := (max(Column(Pnt[i], 2))+min(Column(Pnt[i], 2)))*(1/2); Hv2[i] := ((`&zeta;__2`-xc[i])/a__e[i])^2+((`&eta;__2`-yc[i])/b__e[i])^2-1; Hvs2 := Hv2[i]*Hvs2 end if end do; Qn__2 := LinearAlgebra:-Transpose(convert([(1/2)*k__d*Grid:-Seq(Quadrature(Quadrature(Heaviside(-Hvs2)*abs(Wxy2-Wxy3)*add(add(W[i, j, 2, r]*LegendreP(i, `&zeta;__2`)*LegendreP(j, `&eta;__2`), i = 0 .. II), j = 0 .. JJ), `&zeta;__2` = -1 .. 1, method = romberg[5]), `&eta;__2` = -1 .. 1, method = romberg[5]), r = 1 .. M), seq(0, n = 1 .. Nm)], Matrix)); Qn__3 := -Qn__2; s := s+1 end do

``

Download HighMemUseProb.mw

Hello everyone,

I want to use "proc" in a program. Although the original code is good for me, I modify it by "proc" to be convenient. Thank you very much!

With regards


clearall;
restart;
Digits := 15;
## Initial polygon
x[1] := [-1, 1/2, 1, 0, -sqrt(2)/2, -1, 1/2, 1, 0, -sqrt(2)/2, -1, 1/2, 1, 0, -sqrt(2)/2];
y[1] := [0, sqrt(3)/2, 0, -1, -sqrt(2)/2, 0, sqrt(3)/2, 0, -1, -sqrt(2)/2, 0, sqrt(3)/2, 0, -1, -sqrt(2)/2];
s2 := [-1, 1/2, 1, 0, -sqrt(2)/2, -1];
t2 := [0, sqrt(3)/2, 0, -1, -sqrt(2)/2, 0];
assign(a[-6] = 13/1296, a[-5] = -11/648, a[-4] = -1/16, a[-3] = -107/1296, a[-2] = 179/1296, a[-1] = 9/16, a[0] = 137/144, a[1] = 137/144, a[2] = 9/16, a[3] = 179/1296, a[4] = -107/1296, a[5] = -1/16, a[6] = -11/648, a[7] = 13/1296);

L := 3;
N := numelems(x[1]);
## Perform k-1 iterative steps
# L--the number of iterations; nk--the number of refined points after k steps;
for k to L do
    nk := 3^(k - 1)*(N - 6) + 6;
    for i from 3 to nk - 2 do
        x[k + 1][3*i - 8] := a[-6]*x[k][i + 2] + a[-3]*x[k][i + 1] + a[0]*x[k][i] + a[3]*x[k][i - 1] + a[6]*x[k][i - 2];
        y[k + 1][3*i - 8] := a[-6]*y[k][i + 2] + a[-3]*y[k][i + 1] + a[0]*y[k][i] + a[3]*y[k][i - 1] + a[6]*y[k][i - 2];
        x[k + 1][3*i - 7] := a[-5]*x[k][i + 2] + a[-2]*x[k][i + 1] + a[1]*x[k][i] + a[4]*x[k][i - 1] + a[7]*x[k][i - 2];
        y[k + 1][3*i - 7] := a[-5]*y[k][i + 2] + a[-2]*y[k][i + 1] + a[1]*y[k][i] + a[4]*y[k][i - 1] + a[7]*y[k][i - 2];
        x[k + 1][3*i - 6] := a[-4]*x[k][i + 2] + a[-1]*x[k][i + 1] + a[2]*x[k][i] + a[5]*x[k][i - 1];
        y[k + 1][3*i - 6] := a[-4]*y[k][i + 2] + a[-1]*y[k][i + 1] + a[2]*y[k][i] + a[5]*y[k][i - 1];
    end do;
end do;
## Plot the result
s1 := evalf(simplify(convert(x[L+1], list))):t1 := evalf(simplify(convert(y[L+1], list))):
f1 := <<s1> | <t1>>: f2 := <<s2> | <t2>>:
plot([f1, f2], linestyle = [1, 3], color = [black, red]);

T5Scheme:=proc(x[1],y[1],L)          
local i,k,nk,result,N,a[-1],a[7],a[6],a[5],a[4],a[3],a[2],a[1],a[0],a[-2],a[-3],a[-4],a[-5];          N:=numelems(x[1]):         
   for k from 1 to L do              
 nk := 3^(k - 1)*(N - 6) + 6;         
     for i from 3 to nk - 2 do            
      x[k + 1][3*i - 8] := a[-6]*x[k][i + 2] + a[-3]*x[k][i + 1] + a[0]*x[k][i] + a[3]*x[k][i - 1] + a[6]*x[k][i - 2];                       y[k + 1][3*i - 8] := a[-6]*y[k][i + 2] + a[-3]*y[k][i + 1] + a[0]*y[k][i] + a[3]*y[k][i - 1] + a[6]*y[k][i - 2];                  x[k + 1][3*i - 7] := a[-5]*x[k][i + 2] + a[-2]*x[k][i + 1] + a[1]*x[k][i] + a[4]*x[k][i - 1] + a[7]*x[k][i - 2];                  y[k + 1][3*i - 7] := a[-5]*y[k][i + 2] + a[-2]*y[k][i + 1] + a[1]*y[k][i] + a[4]*y[k][i - 1] + a[7]*y[k][i - 2];                   x[k + 1][3*i - 6] := a[-4]*x[k][i + 2] + a[-1]*x[k][i + 1] + a[2]*x[k][i] + a[5]*x[k][i - 1];               
    y[k + 1][3*i - 6] := a[-4]*y[k][i + 2] + a[-1]*y[k][i + 1] + a[2]*y[k][i] + a[5]*y[k][i - 1];                   result[1]:=x[L+1]:           result[2]:=y[L+1]            
  end do;          
     end do;  
     return result  
  end proc:

I would like to insert a hyperling to a geogebra document but the hyperlink box deosn't appear to allow general files. Can this be done?

It may seem like a stupid question, but why is the first answer not complete, but the second imput is the same as what the book states?

I know you dont need to be able to read Dutch to understand that A = amplitude (amplitude), Omega = Hoekfrequentie (Angular frequency), and Varphi= Fasehoek (phase angle). 

They state that fc(0)= A*e^i*varpi, but it clearly shows that the equation on the left of the equal sign gives a "2" and on the right it gives "2+ 2*i*sqrt3".

Why is this so? It does not make things more easy if you can make "mistakes" like that by just asking the answer, but maple spits out half an answer... 

He thanks a lot guys!

Greetings,

The Function 

p.s.
I scanned my math books, i like it, i can search in the book now with the "ctrl+f" function in Adobe reader. Get a scanner. Mine is a Canon Lide 400. Not regretting it.. :) 
Download Mapleprimes_Book_2_Question_3.6.mw
 

omega := 5

5

(1)

`&varphi;` := (1/3)*Pi

(1/3)*Pi

(2)

A := 4

4

(3)

"f(t):=A*cos(omega*t+`&varphi;`)""+A*I*sin(omega*t+`&varphi;`)"
 

proc (t) options operator, arrow, function_assign; A*cos(omega*t+varphi) end proc

 

(4*I)*sin((1/3)*Pi+5*t)

(4)

f(0)

2

(5)

A*exp(I*`&varphi;`)

2+(2*I)*3^(1/2)

(6)

NULL

``

Download Mapleprimes_Book_2_Question_3.6.mw

eq1 := f(r)*((diff(g(t, phi, r), t))*a^2+(diff(g(t, phi, r), t))*r^2+a*(diff(g(t, phi, r), phi)))/(sqrt(-g(t, phi, r)^2*f(r)^2+1)*sqrt(-(r^2+a^2*cos(theta)^2)*(2*M*r-a^2-r^2)))

f(r)*((diff(g(t, phi, r), t))*a^2+(diff(g(t, phi, r), t))*r^2+a*(diff(g(t, phi, r), phi)))/((-g(t, phi, r)^2*f(r)^2+1)^(1/2)*(-(r^2+a^2*cos(theta)^2)*(2*M*r-a^2-r^2))^(1/2))

(1)

eq2 := (((-a*cos(theta)^2+a)*f(r)^2*g(t, phi, r)^2+a*cos(theta)^2-a)*(diff(g(t, phi, r), phi, t))+(g(t, phi, r)^2*f(r)^2-1)*(diff(g(t, phi, r), phi, phi))+(-(diff(g(t, phi, r), phi))+(diff(g(t, phi, r), t))*a*(cos(theta)-1)*(cos(theta)+1))*(diff(g(t, phi, r), phi))*f(r)^2*g(t, phi, r))*f(r)/((-g(t, phi, r)^2*f(r)^2+1)^(3/2)*sin(theta))

(((-a*cos(theta)^2+a)*f(r)^2*g(t, phi, r)^2+a*cos(theta)^2-a)*(diff(diff(g(t, phi, r), phi), t))+(g(t, phi, r)^2*f(r)^2-1)*(diff(diff(g(t, phi, r), phi), phi))+(-(diff(g(t, phi, r), phi))+(diff(g(t, phi, r), t))*a*(cos(theta)-1)*(cos(theta)+1))*(diff(g(t, phi, r), phi))*f(r)^2*g(t, phi, r))*f(r)/((-g(t, phi, r)^2*f(r)^2+1)^(3/2)*sin(theta))

(2)

pdsolve([eq1, eq2])

Error, (in pdsolve/sys) found the element '_F4' repeated in the indication of blocks variables

 

``

Download problemfile.mw

I am trying to solve these two coupled PDE and am getting this error. Does anyone know what this mean?

First 64 65 66 67 68 69 70 Last Page 66 of 2211