## How to find alpha,beta,mu,nu?...

with(PDEtools); declare(u(x, y, z, t), U(X, Y, Z, T)); interface(showassumed = 0); assume(a > 0, p > 0); W := diff_table(u(x, y, z, t)); E := 6*W[]*W[x]+W[t]+W[x, y, z] = 0; InvE := proc (PDE) local Eq1, Eq2, Eq3, Eq4, tr1, tr2, tr3, tr4, term1, term2, term3, term4, sys1; tr1 := {t = T/a^beta, x = X/a^alpha, y = Y/a^mu, z = Z/a^nu, u(x, y, z, t) = U(X, Y, Z, T)/a^zeta}; tr2 := eval(tr1, zeta = 1); Eq1 := combine(dchange(tr2, PDE, [X, Y, Z, T, U])); Eq2 := map(lhs, PDE = Eq1); term1 := select(has, select(has, select(has, rhs(Eq2), a), beta), a); term2 := expand(rhs(Eq2)/term1); term3 := select(has, select(has, term2, a), a); sys1 := {select(has, op(1, term3), a) = 1, select(has, op(2, term3), a) = 1}; tr3 := solve(sys1, {alpha, beta, mu, nu}); tr4 := subs(tr3, tr2); print(tr3, tr4); Eq3 := dchange(tr4, PDE, [X, Y, Z, T, U]); term4 := select(has, op(1, lhs(Eq3)), a); Eq4 := expand(Eq3/term4); PDE = simplify(Eq4) end proc; InvE(E)

## how i can reduce the runtime of the program ?...

hi..how i can rewrite section of this code as another form i,e ''for section''

I have a lot of line as this and runnig cise is time consuming.

is there another way to write this section in order to the runtime of the program is reduced??

thanks

 > restart;
 > with(LinearAlgebra):
 > with(VectorCalculus):
 > #Digits:=5: k:=6:
 > l:=0:
 > h:=1:
 > m:=4:
 > n:=4:
 > l1:=2*h:
 > l2:=2*h:
 > N:=0.5:
 > nu:=.3:
 > E_m:=70e9:
 > E_c:=380e9:
 > rho_m:=2702:
 > rho_c:=3800:
 > lambda_m:=nu*E_m/((1+nu)*(1-2*nu)):
 > lambda_c:=nu*E_c/((1+nu)*(1-2*nu)):
 > mu_m:=E_m/(2*(1+nu)):
 > mu_c:=E_c/(2*(1+nu)):
 > with(orthopoly):
 > for i from 0 to 5 do: L(i):=sqrt((2*i+1)/2)*P(i,z): end do:
 > Z:=rho_m+(rho_c-rho_m)*((1/2)+(z/h))^N;
 (1)
 > U:=lambda_m+(lambda_c-lambda_m)*((1/2)+(z/h))^N;
 (2)
 > S:=mu_m+(mu_c-mu_m)*((1/2)+(z/h))^N;
 (3)
 > d:=Matrix([[0,0,0,0,0,0,0,0],[sqrt(3),0,0,0,0,0,0,0],[0,sqrt(15),0,0,0,0,0,0],[sqrt(7),0,sqrt(35),0,0,0,0,0],[0,sqrt(27),0,sqrt(63),0,0,0,0],[sqrt(11),0,sqrt(55),0,sqrt(99),0,0,0],[0,sqrt(39),0,sqrt(91),0,sqrt(143),0,0],[sqrt(15),0,sqrt(75),0,sqrt(135),0,sqrt(195),0]]);
 (4)
 >

 >
 (5)

## How to program a for loop inside a procedure and m...

I'm trying to program a procedure that will return me a list of positions defining equally spaced points (planets) around a circumference, for example:
PSI := [0, Pi]; # Location of 2 planets
PSI := [0, ((2/3)*Pi) , ((4/3)*Pi) ]; # For 3 Planets
I'm new to maple so most commands are new to me, I tried building the size of the list with [0 \$ n] because I want the first position to always be at 0 degrees. The first problem is that I get this error:

 > nplanets := 2;
 (1)
 > make_PSI := proc(nplanets); local n,psin,i,PSI: n = nplanets; psin  :=(pi*2)/n; PSI := [0 \$ n]; for i from 1 to n do  angle :=(psin*i);  op(i,PSI) := angle; end do; end;
 >
 >

## Trajectory algorithm only working for first step?...

I'm trying to calculate the trajectory of a 3-particle system. I defined my parameters. Wrote a do loop. Got the number of iterations I expected. But when I look at the tables of position for each particle after I run the loop, the trajectory only changes for the first iteration, then it stays the same. In other words, it shows that the particle moved slightly after the first increment of time, but thereafter it doesn't move.

 (5)

## Maple cause error but doesn't show the reason...

I am coding a big module to solving my project : analyze function in math, but when I compile my module maple return "Error," but it doesn't tell me what error happened.

I check the maple help and it said:" If no msgString is given, error raises the most recently occurring exception" but I have no exception before.

This is the pic of that error.

## Code Correction...

Please I am having problem with this code particularly the last subroutine

#subroutine 1

restart;
Digits:=30:

f:=proc(n)
-25*y[n]+12*cos(x[n]):
end proc:

#subroutine 2

e1:=y[n+4] = -y[n]+2*y[n+2]+((1/15)*h^2+(2/945)*h^2*u^2+(1/56700)*h^2*u^4-(1/415800)*h^2*u^6-(167/833976000)*h^2*u^8-(2633/245188944000)*h^2*u^10-(2671/5557616064000)*h^2*u^12-(257857/13304932857216000)*h^2*u^14-(3073333/4215002729166028800)*h^2*u^16)*f(n)+((16/15)*h^2-(8/945)*h^2*u^2-(1/14175)*h^2*u^4+(1/103950)*h^2*u^6+(167/208494000)*h^2*u^8+(2633/61297236000)*h^2*u^10+(2671/1389404016000)*h^2*u^12+(257857/3326233214304000)*h^2*u^14+(3073333/1053750682291507200)*h^2*u^16)*f(n+1)+((26/15)*h^2+(4/315)*h^2*u^2+(1/9450)*h^2*u^4-(1/69300)*h^2*u^6-(167/138996000)*h^2*u^8-(2633/40864824000)*h^2*u^10-(2671/926269344000)*h^2*u^12-(257857/2217488809536000)*h^2*u^14-(3073333/702500454861004800)*h^2*u^16)*f(n+2)+((16/15)*h^2-(8/945)*h^2*u^2-(1/14175)*h^2*u^4+(1/103950)*h^2*u^6+(167/208494000)*h^2*u^8+(2633/61297236000)*h^2*u^10+(2671/1389404016000)*h^2*u^12+(257857/3326233214304000)*h^2*u^14+(3073333/1053750682291507200)*h^2*u^16)*f(n+3)+((1/15)*h^2+(2/945)*h^2*u^2+(1/56700)*h^2*u^4-(1/415800)*h^2*u^6-(167/833976000)*h^2*u^8-(2633/245188944000)*h^2*u^10-(2671/5557616064000)*h^2*u^12-(257857/13304932857216000)*h^2*u^14-(3073333/4215002729166028800)*h^2*u^16)*f(n+4):

e2:=y[n+3] = -y[n+1]+2*y[n+2]+(-(1/240)*h^2-(31/60480)*h^2*u^2-(67/1814400)*h^2*u^4-(109/53222400)*h^2*u^6-(18127/186810624000)*h^2*u^8-(64931/15692092416000)*h^2*u^10-(9701/59281238016000)*h^2*u^12-(20832397/3406062811447296000)*h^2*u^14-(11349439/51876956666658816000)*h^2*u^16)*f(n)+((1/10)*h^2+(31/15120)*h^2*u^2+(67/453600)*h^2*u^4+(109/13305600)*h^2*u^6+(18127/46702656000)*h^2*u^8+(64931/3923023104000)*h^2*u^10+(9701/14820309504000)*h^2*u^12+(20832397/851515702861824000)*h^2*u^14+(11349439/12969239166664704000)*h^2*u^16)*f(n+1)+((97/120)*h^2-(31/10080)*h^2*u^2-(67/302400)*h^2*u^4-(109/8870400)*h^2*u^6-(18127/31135104000)*h^2*u^8-(64931/2615348736000)*h^2*u^10-(9701/9880206336000)*h^2*u^12-(20832397/567677135241216000)*h^2*u^14-(11349439/8646159444443136000)*h^2*u^16)*f(n+2)+((1/10)*h^2+(31/15120)*h^2*u^2+(67/453600)*h^2*u^4+(109/13305600)*h^2*u^6+(18127/46702656000)*h^2*u^8+(64931/3923023104000)*h^2*u^10+(9701/14820309504000)*h^2*u^12+(20832397/851515702861824000)*h^2*u^14+(11349439/12969239166664704000)*h^2*u^16)*f(n+3)+(-(1/240)*h^2-(31/60480)*h^2*u^2-(67/1814400)*h^2*u^4-(109/53222400)*h^2*u^6-(18127/186810624000)*h^2*u^8-(64931/15692092416000)*h^2*u^10-(9701/59281238016000)*h^2*u^12-(20832397/3406062811447296000)*h^2*u^14-(11349439/51876956666658816000)*h^2*u^16)*f(n+4):

e3:=h*delta[n] = (-149/42-(16/245)*u^2-(1324/169785)*u^4-(559246/695269575)*u^6-(14310311/175207932900)*u^8-(170868550903/20641246574949000)*u^10)*y[n]+(128/21+(32/245)*u^2+(2648/169785)*u^4+(1118492/695269575)*u^6+(14310311/87603966450)*u^8+(170868550903/10320623287474500)*u^10)*y[n+1]+(-107/42-(16/245)*u^2-(1324/169785)*u^4-(559246/695269575)*u^6-(14310311/175207932900)*u^8-(170868550903/20641246574949000)*u^10)*y[n+2]+(-(67/1260)*h^2+(1241/198450)*h^2*u^2+(277961/366735600)*h^2*u^4+(26460409/333729396000)*h^2*u^6+(1363374533/168199615584000)*h^2*u^8+(16323847966961/19815596711951040000)*h^2*u^10)*f(n)+((188/105)*h^2+(5078/99225)*h^2*u^2+(556159/91683900)*h^2*u^4+(51834031/83432349000)*h^2*u^6+(67782373/1078202664000)*h^2*u^8+(1854079193287/291405833999280000)*h^2*u^10)*f(n+1)+((31/90)*h^2+(341/33075)*h^2*u^2+(79361/61122600)*h^2*u^4+(23456627/166864698000)*h^2*u^6+(1228061399/84099807792000)*h^2*u^8+(14797833720283/9907798355975520000)*h^2*u^10)*f(n+2)+(-(4/105)*h^2-(46/14175)*h^2*u^2-(809/1871100)*h^2*u^4-(27827/567567000)*h^2*u^6-(637171/122594472000)*h^2*u^8-(33500737/62523180720000)*h^2*u^10)*f(n+3)+((1/252)*h^2+(23/28350)*h^2*u^2+(809/7484400)*h^2*u^4+(27827/2270268000)*h^2*u^6+(637171/490377888000)*h^2*u^8+(33500737/250092722880000)*h^2*u^10)*f(n+4):

e4:=y[3] = -y[1]+2*y[2]+(-(1/240)*h^2-(31/60480)*h^2*u^2-(67/1814400)*h^2*u^4-(109/53222400)*h^2*u^6-(18127/186810624000)*h^2*u^8-(64931/15692092416000)*h^2*u^10-(9701/59281238016000)*h^2*u^12-(20832397/3406062811447296000)*h^2*u^14-(11349439/51876956666658816000)*h^2*u^16)*f(0)+((1/10)*h^2+(31/15120)*h^2*u^2+(67/453600)*h^2*u^4+(109/13305600)*h^2*u^6+(18127/46702656000)*h^2*u^8+(64931/3923023104000)*h^2*u^10+(9701/14820309504000)*h^2*u^12+(20832397/851515702861824000)*h^2*u^14+(11349439/12969239166664704000)*h^2*u^16)*f(1)+((97/120)*h^2-(31/10080)*h^2*u^2-(67/302400)*h^2*u^4-(109/8870400)*h^2*u^6-(18127/31135104000)*h^2*u^8-(64931/2615348736000)*h^2*u^10-(9701/9880206336000)*h^2*u^12-(20832397/567677135241216000)*h^2*u^14-(11349439/8646159444443136000)*h^2*u^16)*f(2)+((1/10)*h^2+(31/15120)*h^2*u^2+(67/453600)*h^2*u^4+(109/13305600)*h^2*u^6+(18127/46702656000)*h^2*u^8+(64931/3923023104000)*h^2*u^10+(9701/14820309504000)*h^2*u^12+(20832397/851515702861824000)*h^2*u^14+(11349439/12969239166664704000)*h^2*u^16)*f(3)+(-(1/240)*h^2-(31/60480)*h^2*u^2-(67/1814400)*h^2*u^4-(109/53222400)*h^2*u^6-(18127/186810624000)*h^2*u^8-(64931/15692092416000)*h^2*u^10-(9701/59281238016000)*h^2*u^12-(20832397/3406062811447296000)*h^2*u^14-(11349439/51876956666658816000)*h^2*u^16)*f(4):

e5:=h*delta[0] = (-149/42-(16/245)*u^2-(1324/169785)*u^4-(559246/695269575)*u^6-(14310311/175207932900)*u^8-(170868550903/20641246574949000)*u^10)*y[0]+(128/21+(32/245)*u^2+(2648/169785)*u^4+(1118492/695269575)*u^6+(14310311/87603966450)*u^8+(170868550903/10320623287474500)*u^10)*y[1]+(-107/42-(16/245)*u^2-(1324/169785)*u^4-(559246/695269575)*u^6-(14310311/175207932900)*u^8-(170868550903/20641246574949000)*u^10)*y[2]+(-(67/1260)*h^2+(1241/198450)*h^2*u^2+(277961/366735600)*h^2*u^4+(26460409/333729396000)*h^2*u^6+(1363374533/168199615584000)*h^2*u^8+(16323847966961/19815596711951040000)*h^2*u^10)*f(0)+((188/105)*h^2+(5078/99225)*h^2*u^2+(556159/91683900)*h^2*u^4+(51834031/83432349000)*h^2*u^6+(67782373/1078202664000)*h^2*u^8+(1854079193287/291405833999280000)*h^2*u^10)*f(1)+((31/90)*h^2+(341/33075)*h^2*u^2+(79361/61122600)*h^2*u^4+(23456627/166864698000)*h^2*u^6+(1228061399/84099807792000)*h^2*u^8+(14797833720283/9907798355975520000)*h^2*u^10)*f(2)+(-(4/105)*h^2-(46/14175)*h^2*u^2-(809/1871100)*h^2*u^4-(27827/567567000)*h^2*u^6-(637171/122594472000)*h^2*u^8-(33500737/62523180720000)*h^2*u^10)*f(3)+((1/252)*h^2+(23/28350)*h^2*u^2+(809/7484400)*h^2*u^4+(27827/2270268000)*h^2*u^6+(637171/490377888000)*h^2*u^8+(33500737/250092722880000)*h^2*u^10)*f(4):

#subroutine 3

inx:=0:
ind:=0:
iny:=1:
h:=Pi/4.0:
n:=0:
omega:=5:
u:=omega*h:
N:=solve(h*p = 500*Pi/2, p):

c:=1:
for j from 0 to 5 do
t[j]:=inx+j*h:
end do:
#e||(1..6);
vars:=y[n+1],y[n+2],y[n+3],delta[n],y[n+4]:

printf("%6s%15s%15s%15s\n",
"h","Num.y","Ex.y","Error y");
for k from 1 to N do

par1:=x[0]=t[0],x[1]=t[1],x[2]=t[2],x[3]=t[3],x[4]=t[4],x[5]=t[5]:
par2:=y[n]=iny,delta[n]=ind:

res:=eval(<vars>, fsolve(eval({e||(1..5)},[par1,par2]), {vars}));

for i from 1 to 5 do
exy:=eval(0.5*cos(5*c*h)+0.5*cos(c*h)):
printf("%6.5f%17.9f%15.9f%13.5g\n",
h*c,res[i],exy,abs(res[i]-exy)):

c:=c+1:
end do:
iny:=res[5]:
inx:=t[5]:
for j from 0 to 5 do
t[j]:=inx + j*h:
end do:
end do:

## View/modify the coding of worksheets and applicati...

Hi,

I am new in Maple and I would like to create some worksheets and applications based on ones found already on the Maple sites. Is there any way to see how they have been created? To see and modify the coding where necessary? Your help would be highly appreciated. Thank you for your support.

## out of bound cases...

i got some trouble when i tried to build large matrix. in my case, notification error out of bound appear when looping stop at 9 from 24 repeatation.

and this is my looping command:

the result of the script was:

## Why my function not work?...

I want write function get value a1, a2, ..., an to b1, b2, ..., bn.

Example get 1, 3, -9, 5 to a, b, c, d. This is my code

`myfunc := proc(oldVars,newVars)`

`    local i;`

`    if nops(oldVars) = nops(newVars) then`

`        for i from 1 to nops(newVars) do`

`            newVars[i] := oldVars[i];`

`        end;`

`    fi;`

`end proc:`

But not work! Can someone help me. Thank you very much

## how to write better for passing parameter which is...

for example

func1 := proc(system1)

for i from 1 to 100 do

solve([system1[1], system1[2]],[x,y]);

od:

end proc:

func1([diff(y,t) = data[i+t+1], diff(x,t) = data[i+t+1]])

i is depend on the for loop inside a function, but woud like to pass this system into a function with i

this will cause error

how to write better for passing a system as parameter using variable inside a function?

## Improved Josephus Algorithm in Maple. Need help....

Hello, everyone. I have a group project where we have to explain the Josephus problem and use Maple to solve the problem. I am trying to solve the problem in multiple ways (because why not), but I am struggling with my third procedure. I understand the logic behind it and how its supposed to achieve O(k*logn), but the code that I wrote for it doesn't seem to produce the correct result.

```JosephusImproved := proc (n, k)
local count, result:
if n = 1 then
return 0:
elif 1 < n < k then
return JosephusImproved(n - 1, k) + k + 1 mod n:
else
count := floor(n / k):
result := JosephusImproved(n - count, k):
result := result - n mod k:
if result < 0 then
result := result + n
else
result := floor(result /(k - 1)):
return result:
end if:
end if:
end proc:```

Note: The regular recursive expression [Josephus(n - 1, k) + k + 1 mod n] has a "+ 1" since that was the only way I could make Maple do the calculation correctly. Proven with a Cyclic procedure I already made.
Note 2: I am using Maple 2016 and 2D Math.

I would like some insight as to how I could fix this so that it works, just like the regular recursive procedure and cyclic list that I have.

Cheers.

## How can I make a procedure control the font of the...

I want to make the blue output my procedure spits out a another color, and align it to the right, is this even possible? Or something like it?

## Is it possible to have a procedure write to execut...

I basically want to make a Maple procedure that does certain calculations and writes the explanation for each calculation. I do however want Maple to write these explanations as a text field like in a normal Maple worksheet, instead of the blue output in the middle. Is this possible? Or is there any alternative ideas you have that I could try? Would really appreciate any kind of help, thanks.

## Float Infinity instead of integer...

Hi I have this code

``` psi:=proc(n,x);
(1/sqrt(sqrt(pi)*2^n*factorial(n))*exp(-x^2/2)*HermiteH(n,x))
end proc;
psi := proc(n, x) exp(-1/2*x^2)*HermiteH(n, x)/sqrt(sqrt(pi)*2^n*n!) end proc

psi2=proc(a,x);
psi(a,x):=(1/sqrt(sqrt(pi)*2^a*factorial(a))*exp(-x^2/2)*HermiteH(a,x))
end proc;
psi2 = (proc(a, x)
psi(a, x) := exp(-1/2*x^2)*HermiteH(a, x)/sqrt(sqrt(pi)*2^a*a!)

end proc)
for n from 0 to 2 do;
for a from 0 to 2 do;
result=proc(n,a);
result(n,a)=psi*psi2
end proc;
print(evalf(int(result(n,a),x=0..infinity)));
od;
od;```

it returns

Float(infinity) signum(result(0, 0))

Float(infinity) signum(result(0, 1))

Float(infinity) signum(result(0, 2))

Float(infinity) signum(result(1, 0))

Float(infinity) signum(result(1, 1))

Float(infinity) signum(result(1, 2))

Float(infinity) signum(result(2, 0))

Float(infinity) signum(result(2, 1))

Float(infinity) signum(result(2, 2))

I know the results for (0,0), (1,1) and (2,2) should be 1 and the rest should be 0.

Can anybody help fix this please

 1 2 3 4 5 6 7 Last Page 1 of 11
﻿