Maple 2019 Questions and Posts

These are Posts and Questions associated with the product, Maple 2019

Hi

I'm trying to export a file using the .mw file. without a lot of success. Can someone help?

For 1 game, the output is between (8) and (9).

For 2 games. the output is after (17).

TEST.mw

 

Hey guys, 

Is there any way to remove these imaginary parts of the numbers ?

I tried using the RealDomain package in beginning of code but it starts showing some Float(undefined) numbers and I don't understand why since none of the terms inside the sqrt are negative.

Thanks in advance.

Download Reforço.mw

I'm new to Maple, and i'm learnning Maple with basic commands(the version I use is Maple2019). But after I entered some commands, the results Maple gives me is not what I expected. For example:

When i enter abs(3+5*I), I hope get a $\sqrt{34}$, but Maple gives me a complex number:

abs(3 + 5*I);
                                                         -58                                                     -59  
       1.81847767202745 10    + 7.53238114626421 10    I
sin(0);
                                                        -116                                                    -116  
      2.73949338633639 10     + 2.73949338633639 10     I
sin(pi);
                                                        -116                                                    -116  
      2.73949338633639 10     + 2.73949338633639 10     I
abs(3 + 5*I);
                                                        -58                                                      -59  
       1.81847767202745 10    + 7.53238114626421 10    I

expand(cos(4*x) + 4*cos(2*x) + 3, trig);
                                                                          -231  
                 8. - 3.75241200689042 10     I
Why???

Should I set or define something or what?

Thank you!

Hello! 

I have been using maple not so long ago and I can’t always understand for myself what is the reason for the program not working.
In this case, I need to solve a system of second-order differential equations with respect to four variables. I don’t understand what’s wrong, do not judge strictly.

// 
restart;

m1 := 50;
m2 := 70;
R1 := 0.14;
R2 := 0.17;
O1C1 := 0.3;
alpha := 0.024;
a := 0.28;
b := 0.08;
c := 0.08;
M0 := 12;
k1 := 1.7;
k2 := 0.9;
Zb := -a;
Md := M0 - k1*diff(varphi(t), t);
Mc := -k1*diff(varphi(t), t)^2;

Ixz := 0;
Iyz := m1*O1C1*(b + c) + m2*R2^2/4*alpha;
Izz := m1(R1^2/2 + O1C1^2) + m2*R2^2/4*(alpha^2 + 2);

eqMx := -M*Yc*diff(varphi(t), t $ 2) - M*Xc*diff(varphi(t), t)^2 = Xa + Xb;
eqMy := M*Xc*diff(varphi(t), t $ 2) - M*Yc*diff(varphi(t), t)^2 = Ya + Yb;
eqIy := -Ixz*diff(varphi(t), t $ 2) + Iyz*diff(varphi(t), t)^2 = Zb*Yb;
eqIx := -Iyz*diff(varphi(t), t $ 2) - Ixz*diff(varphi(t), t)^2 = Zb*Xb;
eqMz := Izz*diff(varphi(t), t $ 2) = Md + Mc;
sys := {eqIx, eqIy, eqMx, eqMy};
dsolve({sys, varphi(0) = 0}, Xa, Xb, Ya, Yb);

Error, (in dsolve) invalid arguments; expected an equation, or a set or list of them, received: { and so on }

//

I will be glad if you help me with this problem. if there are certain questions, you - ask, and I'll answer.
Here you can find the file: Курсовой_по_термеху_2.mw

I have an ordinary differential equation to be solved. when I give numeric values to B,H and L__1 (for example B=10,H=10,L__1=4), everything works fine and equations eq37a will be solved.

but when B,H and L__1 are symbolic parameters, dsolve give me this error " Error, (in dsolve) give the main variable as a second argument". and I don't know what it means.

is there any way to solve the ODE with symbolic B,H and L__1??

 

restart;

#B:=10;
#H:=10;
#L__1:=4;

eq0:=R__i=(1/2)*B+L__1;
eq01:=R__f=C+(1/2)*B+L__1;
eq02:=theta__1=arctan((H/2)/(B/2 + L__1));
eq03:=theta__2=Pi - arctan((H/2)/(B/2 - L__1));
eq43:= v__beta(r,theta,beta)= v__m(beta)*(1-(r^2/((R__max(theta,beta))^2)));
eq39:=R(beta)=R__i+2*beta*(R__f-R__i)/Pi;
eq39a:=simplify(subs([eq0,eq01], eq39));
eq38:=R__max(theta,beta)=R__max(theta,0)*(R(beta)/R__i);
eq41:=R__max(theta,0)=piecewise(theta<=rhs(eq02),(B/2+L__1)/cos(theta),theta<=rhs(eq03),(H/2)/sin(theta),rhs(eq03)<theta,(B/2-L__1)/cos(Pi-theta));
eq38a:= simplify(subs([eq41,eq39a,eq0], eq38));
eq44 := v__m(beta) = 1/(2*int((1 - r^2/R__max(theta, beta)^2)*r, [r = 0 .. R__max(theta, beta), theta = 0 .. Pi]));
eq44a:=simplify(subs(eq38a,eq44)) assuming B/L__1 >= 2 , H > 0 , B > 0 , L__1 > 0;
eq44b:= v__m(beta)= rhs(eq44a) * B * H;
eq47:=subs([eq44b,eq38a],eq43);

eq0 := R__i = (1/2)*B+L__1

 

eq01 := R__f = C+(1/2)*B+L__1

 

eq02 := `&theta;__1` = arctan(H/(2*((1/2)*B+L__1)))

 

eq03 := `&theta;__2` = Pi-arctan(H/(2*((1/2)*B-L__1)))

 

eq43 := `v__&beta;`(r, theta, beta) = v__m(beta)*(1-r^2/R__max(theta, beta)^2)

 

eq39 := R(beta) = R__i+2*beta*(R__f-R__i)/Pi

 

eq39a := R(beta) = (1/2)*B+L__1+2*beta*C/Pi

 

eq38 := R__max(theta, beta) = R__max(theta, 0)*R(beta)/R__i

 

eq41 := R__max(theta, 0) = piecewise(theta <= arctan(H/(2*((1/2)*B+L__1))), ((1/2)*B+L__1)/cos(theta), theta <= Pi-arctan(H/(2*((1/2)*B-L__1))), H/(2*sin(theta)), Pi-arctan(H/(2*((1/2)*B-L__1))) < theta, -((1/2)*B-L__1)/cos(theta))

 

eq38a := R__max(theta, beta) = (Pi*(B+2*L__1)+4*beta*C)*piecewise(theta <= arctan(H/(B+2*L__1)), (B+2*L__1)/cos(theta), theta <= Pi-arctan(H/(B-2*L__1)), H/sin(theta), Pi-arctan(H/(B-2*L__1)) < theta, (-B+2*L__1)/cos(theta))/(2*Pi*(B+2*L__1))

 

eq44 := v__m(beta) = 2/(int(R__max(theta, beta)^2, theta = 0 .. Pi))

 

eq44a := v__m(beta) = 2*Pi^2*(B+2*L__1)^2/(H*(B*Pi+4*C*beta+2*L__1*Pi)^2*B)

 

eq44b := v__m(beta) = 2*Pi^2*(B+2*L__1)^2/(B*Pi+4*C*beta+2*L__1*Pi)^2

 

v__beta(r, theta, beta) = 2*Pi^2*(B+2*L__1)^2*(1-4*r^2*Pi^2*(B+2*L__1)^2/((Pi*(B+2*L__1)+4*beta*C)^2*piecewise(theta <= arctan(H/(B+2*L__1)), (B+2*L__1)/cos(theta), theta <= Pi-arctan(H/(B-2*L__1)), H/sin(theta), Pi-arctan(H/(B-2*L__1)) < theta, (-B+2*L__1)/cos(theta))^2))/(B*Pi+4*C*beta+2*L__1*Pi)^2

(1)

eq37:=diff(v__r(r, theta, beta),r)*r*(R__f-r*cos(theta))+v__r(r,theta,beta)*(R__f-2*r*cos(theta))+r*diff(v__beta(r,theta,beta),beta)=0;
eq37a:=simplify(expand(subs(eq47, eq37)));

eq37 := (diff(v__r(r, theta, beta), r))*r*(R__f-r*cos(theta))+v__r(r, theta, beta)*(R__f-2*r*cos(theta))+r*(diff(`v__&beta;`(r, theta, beta), beta)) = 0

 

(-2*(Pi*(B+2*L__1)+4*beta*C)^2*((1/2)*(Pi*(B+2*L__1)+4*beta*C)^3*(r*cos(theta)-R__f)*r*(diff(v__r(r, theta, beta), r))+(Pi*(B+2*L__1)+4*beta*C)^3*(r*cos(theta)-(1/2)*R__f)*v__r(r, theta, beta)+8*C*r*Pi^2*(B+2*L__1)^2)*piecewise(theta <= arctan(H/(B+2*L__1)), (B+2*L__1)/cos(theta), theta <= Pi-arctan(H/(B-2*L__1)), H/sin(theta), Pi-arctan(H/(B-2*L__1)) < theta, (-B+2*L__1)/cos(theta))^2+128*C*r^3*Pi^4*(B+2*L__1)^4)/((Pi*(B+2*L__1)+4*beta*C)^5*piecewise(theta <= arctan(H/(B+2*L__1)), (B+2*L__1)/cos(theta), theta <= Pi-arctan(H/(B-2*L__1)), H/sin(theta), Pi-arctan(H/(B-2*L__1)) < theta, (-B+2*L__1)/cos(theta))^2) = 0

(2)

bc:=v__r(rhs(eq38a),theta,beta)=0;

bc := v__r((Pi*(B+2*L__1)+4*beta*C)*piecewise(theta <= arctan(H/(B+2*L__1)), (B+2*L__1)/cos(theta), theta <= Pi-arctan(H/(B-2*L__1)), H/sin(theta), Pi-arctan(H/(B-2*L__1)) < theta, (-B+2*L__1)/cos(theta))/(2*Pi*(B+2*L__1)), theta, beta) = 0

(3)

sol3:=simplify(dsolve([eq37a,bc], v__r(r, theta,beta)));

Error, (in dsolve) give the main variable as a second argument

 

NULL


 

Download Mechrect.mw

How I can apply the condition or assuming (a>0) in ?

I want to have a plot according to the attached figure.

restart; A5 := 2.4821; A3 := .8417; A4 := -.1384; K := 0.3e-2; `&sigma;&sigma;` := (9*A3*A5*a^2-10*A4^2*a^2)/(24*A3^(3/2))+K/(2*a*A3^(1/2))

2.4821

 

.8417

 

-.1384

 

1.004210973*a^2+0.1634980569e-2/a

(1)

NULL

solve(sigma = 1.004210973*a^2+0.1634980569e-2/a, a)

solve(sigma = 1.004210973*a^2-0.1634980569e-2/a, a)

plot({1.079801433*10^(-25)*(-6.465854665*10^71+1.058832302*10^46*sqrt(-2.057991547*10^56*sigma^3+3.729044048*10^51))^(1/3)+3.074042610*10^24*sigma/(-6.465854665*10^71+1.058832302*10^46*sqrt(-2.057991547*10^56*sigma^3+3.729044048*10^51))^(1/3), 1.079801433*10^(-25)*(6.465854665*10^71+1.058832302*10^46*sqrt(-2.057991547*10^56*sigma^3+3.729044048*10^51))^(1/3)+3.074042610*10^24*sigma/(6.465854665*10^71+1.058832302*10^46*sqrt(-2.057991547*10^56*sigma^3+3.729044048*10^51))^(1/3)}, sigma = -.2 .. .2)

 

``


 

Download plot 

I was writing in a maple document when suddently all the text and equations collapsed into a single line at the top, making it unreadable and unusuable. I was not able to restore a previous backup of the file, however i did manage to salvage a smaller part of the document. Both files are included. 
corrupted.mw 
what_i_managed_to_save.mw

Cursor jumping to end of sheet/page when pressing enter (calculating).

How do I change the settings in maple 2019 so that the cursor doesnt jump to the end of the page/document everytime I make a calculation. 

Thanks!

Jeppe
 

Maple can't solve the following symbolic integration for me and it remains in the state of evaluating when I use simplify and nothing happens after hours.. any solution? 

I was thinking maybe there is something wrong with my maple !!?

 

eq0:=R__i=(1/2)*d+L__1;
eq00:=R__f=c+(1/2)*d+L__1;
eq39:=R(beta)=R__i+2*beta*(R__f-R__i)/Pi;
eq39a:=simplify(subs([eq0,eq00], eq39));
eq38:=R__max(theta,beta)=R__max(theta,0)*(R(beta)/R__i);
eq41:=R__max(theta,0)=((2*L__1*cos(theta)) + sqrt(d^2 - 2*(L__1)^2 + 2*(L__1)^2*cos(2*theta)))/2;
eq38a:= simplify(subs([eq41,eq39a,eq0], eq38));

R__i = L__1+(1/2)*d

 

R__f = c+(1/2)*d+L__1

 

R(beta) = R__i+2*beta*(R__f-R__i)/Pi

 

R(beta) = L__1+(1/2)*d+2*beta*c/Pi

 

R__max(theta, beta) = R__max(theta, 0)*R(beta)/R__i

 

R__max(theta, 0) = L__1*cos(theta)+(1/2)*(d^2-2*L__1^2+2*L__1^2*cos(2*theta))^(1/2)

 

R__max(theta, beta) = (1/2)*(2*L__1*cos(theta)+(d^2-2*L__1^2+2*L__1^2*cos(2*theta))^(1/2))*(2*L__1*Pi+Pi*d+4*beta*c)/(Pi*(2*L__1+d))

(1)

eq44 := v__m(beta) = 1/int((1 - r^2/R__max(theta, beta)^2)*r, [r = 0 .. R__max(theta, beta), theta = 0 .. 2*Pi]);

v__m(beta) = 4/(int(R__max(theta, beta)^2, theta = 0 .. 2*Pi))

(2)

eq44a:=simplify(subs(eq38a,eq44));

``


Download int.mw

 

linkedlist.zip

I am having a problem understanding how to pretty print the results of a procedure incorporated into a module installed as a package using the maple workbook(.maple).  In an effort to understand how this should be done, I installed the LinkedListPackage from the example code using a maple workbook to see if the package works as shown in the help files. The results from this exercise confirmed the problem I am having with a module I am creating. Specifically, as shown in the help file, I assigned the exported name “nil” to L; ie. L := nil; Note that the result is L:= linkedlist:-nil not L:= nil.  Furthermore when I create a linked list the results are as shown below:  

L := ``(1, linkedlist:-nil)
L := ``(2, ``(1, linkedlist:-nil))
L := ``(3, ``(2, ``(1, linkedlist:-nil)))
L := ``(4, ``(3, ``(2, ``(1, linkedlist:-nil))))
L := ``(5, ``(4, ``(3, ``(2, ``(1, linkedlist:-nil)))))
L := ``(6, ``(5, ``(4, ``(3, ``(2, ``(1, linkedlist:-nil))))))
L := ``(7, ``(6, ``(5, ``(4, ``(3, ``(2, ``(1, linkedlist:-nil)))))))
L := ``(8, ``(7, ``(6, ``(5, ``(4, ``(3, ``(2, ``(1, linkedlist:-nil))))))))
L := ``(9, ``(8, ``(7, ``(6, ``(5, ``(4, ``(3, ``(2, ``(1, linkedlist:-nil)))))))))
L := ``(10, ``(9, ``(8, ``(7, ``(6, ``(5, ``(4, ``(3, ``(2, ``(1, linkedlist:-nil))))))))))

I realized that nil is an exported local variable which is being reflected in how it presents in the worksheet, but in an expression of any complexity presenting exported local names in this way makes the expression unreadable. I have been combing help looking for a clue as to how the results from the package can be pretty-printed without a fully-qualified name. Can you suggest how I should proceed.

My other question concerns the macro command which is used in the example code to format the pairs.  As written in the help file, the macro command is intended to replace the name _PAIR with a space.  However, it seems that the macro facility now replaces _PAIR with name quotes instead of a space. Has the macro facility changed since the example was written?

Hey,

Is anyone of you capable of simplifying this expression

f1:=(-3*sin(8*x) + 3*sin(8*x + 2*y) - 3*sin(8*x + 6*y) + 3*sin(8*y + 8*x) + 3*sin(8*y + 6*x) + 3*sin(8*y) - 18*sin(8*y + 4*x) + 3*sin(8*y + 2*x) - 45*sin(6*y + 6*x) + 87*sin(4*y + 6*x) - 3*sin(6*x - 2*y) - 87*sin(6*x + 2*y) + 18*sin(4*x - 4*y) - 93*sin(4*x + 4*y) + 93*sin(4*x + 6*y) - 51*sin(2*x - 4*y) - 342*sin(2*x + 4*y) - 3*sin(-6*y + 2*x) + 51*sin(6*y + 2*x) - 93*sin(-2*y + 4*x) + 342*sin(-2*y + 2*x) + 639*sin(2*x + 2*y) - 639*sin(2*x) + 45*sin(6*x) + 93*sin(4*x) + 231*sin(4*y) - 225*sin(2*y) - 63*sin(6*y) - 57*sqrt(3)*cos(2*x) - 375*sqrt(3)*cos(2*y) + sqrt(3)*cos(8*y + 8*x) - 5*sqrt(3)*cos(8*x + 6*y) - 7*sqrt(3)*cos(8*y + 6*x) + sqrt(3)*cos(8*x) + 192*sqrt(3)*cos(2*y + 4*x) + 43*sqrt(3)*cos(-2*y + 4*x) - 7*sqrt(3)*cos(6*x + 2*y) + 7*sqrt(3)*cos(-6*y + 2*x) - 5*sqrt(3)*cos(6*y) - 149*sqrt(3)*cos(4*x + 4*y) - 149*sqrt(3)*cos(4*x) - 65*sqrt(3)*cos(6*y + 2*x) + 126*sqrt(3)*cos(2*x + 4*y) - 65*sqrt(3)*cos(2*x - 4*y) - 5*sqrt(3)*cos(8*x + 2*y) - sqrt(3)*cos(8*y) + 7*sqrt(3)*cos(8*y + 2*x) + 6*sqrt(3)*cos(8*x + 4*y) - 57*sqrt(3)*cos(2*x + 2*y) + 125*sqrt(3)*cos(4*y) + 126*sqrt(3)*cos(-2*y + 2*x) - 7*sqrt(3)*cos(6*x - 2*y) + 19*sqrt(3)*cos(6*x) + 43*sqrt(3)*cos(4*x + 6*y) + 19*sqrt(3)*cos(6*y + 6*x) - 7*sqrt(3)*cos(4*y + 6*x) + 246*sqrt(3))/(2*(-261*sin(4*x + y) - 297*sin(2*x + 3*y) - 48*sin(5*y + 6*x) + 126*sin(5*y + 2*x) + 9*sin(5*y + 8*x) + 12*sin(7*y + 6*x) - 9*sin(7*y + 4*x) - 36*sin(5*y + 4*x) + 261*sin(3*y + 4*x) + 9*sin(-3*y + 4*x) + 297*sin(-y + 2*x) - 135*sin(3*y) - 21*sin(5*y) - 147*cos(y)*sqrt(3) - 9*sqrt(3)*cos(7*y + 4*x) - 3*sqrt(3)*cos(5*y + 8*x) - 3*sqrt(3)*cos(3*y + 8*x) + 54*sqrt(3)*cos(6*x + 3*y) + 5*sqrt(3)*cos(-5*y + 2*x) + 5*sqrt(3)*cos(7*y + 2*x) - 2*sqrt(3)*cos(6*x - y) - 20*sqrt(3)*cos(6*x + y) - 69*sqrt(3)*cos(4*x + y) + 68*sqrt(3)*cos(4*x - y) + 2*sqrt(3)*cos(8*x + y) + 2*sqrt(3)*cos(7*y + 8*x) - 20*sqrt(3)*cos(5*y + 6*x) - 2*sqrt(3)*cos(7*y + 6*x) + 68*sqrt(3)*cos(5*y + 4*x) - 9*sqrt(3)*cos(-3*y + 4*x) - 69*sqrt(3)*cos(3*y + 4*x) - 171*sqrt(3)*cos(2*x + 3*y) - 35*sqrt(3)*cos(5*y) + 171*sqrt(3)*cos(3*y) - 171*sqrt(3)*cos(-y + 2*x) + 354*sqrt(3)*cos(2*x + y) + sqrt(3)*cos(7*y) + 639*sin(y) - 9*sin(3*y + 8*x) - 12*sin(6*x - y) + 3*sin(7*y) - 9*sin(7*y + 2*x) + 9*sin(-5*y + 2*x) + 48*sin(6*x + y) + 36*sin(4*x - y) - 126*sin(2*x - 3*y)))

 

into

 

cos(y-Pi/3).

 

PS: Actually I managed by expanding the thing out and converting to exp then expanding again and using radnormal. In essence I leave the question, because maybe somebody can explain to me why radnormal seems to be superior (sometimes) to simplify which I thought of as the USEALL choice. Thanks

from help, it says about option of 'spacestep'=numeric to pdsolve numerical solver the following

Specifies the spacing of the spatial points on the discrete mesh on which the solution 
is computed, and defaults to 1/20th of the spatial range of the problem, 
r-L, where L is the left boundary, and r is the right. Note: The spacing must 
be small enough that a sufficient number of points are in the spatial domain 
for the given method, boundary conditions, and spatial interpolation (see below). 
If the given value of spacestep does not fit into the input domain an integral 
number of times, the closest smaller step size that does is used. For problems 
using error estimates, or an adaptive approach, the total number of spatial 
points must be odd, so again, if this is not the case for the specified 
spacestep, then it is reduced to satisfy this requirement.

In this problem, the domain is [-1,1]. So the default is 1/20 of this which is 1/10.  Why is it when using spacestep smaller than 1/11, the animator generated from the solution does not work right?  i.e. playing the animate does not produce correct result as the case when using spacestep=1/11 or spacestep=1/10?   

When using spacestep=1/16 or 1/15 or 1/14 or 1/13 or 1/12, it all produce bad animation.  I do not see why that is. 

Any ideas?  Am I doing something wrong?
 

pde := diff(u(x,t),t$2)=diff(u(x,t),x$2):
bc  := u(-1,t)=u(1,t),D[1](u)(-1,t)=D[1](u)(1,t):
f:=x->piecewise(-1/2<x and x<0,x+1/2,0<x and x<1/2,1/2-x,true,0):
plot(f(x),x=-1..1):
ic  := u(x,0)=f(x),D[2](u)(x,0)=0:
sol:=pdsolve(pde,{bc,ic},u(x,t),numeric,time=t,range=-1..1,  timestep=1/16,spacestep=1/16)

_m1793827573184

sol:-animate(t=1,frames=50,title="time = %f");

sol:=pdsolve(pde,{bc,ic},u(x,t),numeric,time=t,range=-1..1,  timestep=1/16,spacestep=1/12):
sol:-animate(t=1,frames=50,title="time = %f");

sol:=pdsolve(pde,{bc,ic},u(x,t),numeric,time=t,range=-1..1,  timestep=1/16,spacestep=1/11):
sol:-animate(t=1,frames=50,title="time = %f");

 

 

Download solving_wave_pde_2.mw

 

 

When solving this 1D wave PDE numerically, if the range used is -Pi..Pi then I get this error

sol:-plot(t=0,numpoints=100);
Error, (in Vector) unable to store '-Pi' when datatype=float[8]

When trying to plot the solution. Changing the range to -1..1 the error goes away.

I would expect the numerical solver to handle these things automatically? 

Please see attached worksheet.   How to work around this if one wants to use range from -Pi..Pi?

 

#wave PDE with periodic BC.
restart;

pde := diff(u(x,t),t$2)=diff(u(x,t),x$2);
bc  := u(-Pi,t)=u(Pi,t),D[1](u)(-Pi,t)=D[1](u)(Pi,t);
f:=x->piecewise(-Pi/2<x and x<Pi/2,1,true,0);
plot(f(x),x=-Pi..Pi);
ic  := u(x,0)=f(x),D[2](u)(x,0)=0;
sol:=pdsolve(pde,{bc,ic},u(x,t),numeric,time=t,range=-Pi..Pi)

pde := diff(u(x, t), t, t) = diff(u(x, t), x, x)

bc := u(-Pi, t) = u(Pi, t), (D[1](u))(-Pi, t) = (D[1](u))(Pi, t)

f := proc (x) options operator, arrow; piecewise(-(1/2)*Pi < x and x < (1/2)*Pi, 1, true, 0) end proc

u(x, 0) = piecewise(-(1/2)*Pi < x and x < (1/2)*Pi, 1, 0), (D[2](u))(x, 0) = 0

_m1174810042944

sol:-plot(t=0,numpoints=100);

Error, (in Vector) unable to store '-Pi' when datatype=float[8]

pde := diff(u(x,t),t$2)=diff(u(x,t),x$2);
bc  := u(-1,t)=u(1,t),D[1](u)(-1,t)=D[1](u)(1,t);
f:=x->piecewise(-1/2<x and x<1/2,1,true,0);
plot(f(x),x=-1..1);
ic  := u(x,0)=f(x),D[2](u)(x,0)=0;
sol:=pdsolve(pde,{bc,ic},u(x,t),numeric,time=t,range=-1..1)

pde := diff(u(x, t), t, t) = diff(u(x, t), x, x)

bc := u(-1, t) = u(1, t), (D[1](u))(-1, t) = (D[1](u))(1, t)

f := proc (x) options operator, arrow; piecewise(-1/2 < x and x < 1/2, 1, true, 0) end proc

u(x, 0) = piecewise(-1/2 < x and x < 1/2, 1, 0), (D[2](u))(x, 0) = 0

_m1174805392512

sol:-plot(t=0,numpoints=100);

 


 

Download solving_wave_pde.mw

The problem is to find a100 for a sequence defined as follows.


https://snipboard.io/AdZKX5.jpg I tried the following command for a recursive sequence.
(I used 10 instead of 100 to test run it).

a||1:=1;
for n from 2 to 10 do a||n:=2*sum( a||i ,i=1..n)^2/(2*sum( a||i ,i=1..n)-1); od;

This approach did not work. It says "error recursive assignment"

Any ideas how to get a(100), also if its possible how to solve the recursive sequence explicitly.

I tried rsolve :

rsolve({ f(n)=(2*sum(f(i),i=1..n)^2/(2*sum(f(i),i=1..n)-1)),f(1)=1},f(n))
rsolve({ f(n)=(2*sum(f(i),i=1..n)^2/(2*sum(f(i),i=1..n)-1)),f(1)=1},f(n))

It just returned back the expression inertly.

 

I expect the output for the following code to be a Matrix containing 720 and a Matrix containing 21. What I get is a Matrix containing x^6 and one containing 21, which shows an unexpected difference between the parameter evaluation rule for Matrix products and that for Matrix sums. Is there a good reason for this, or is it a bug? Do any other binary operators between rtables also show this weirdness? 

proc(n::nonnegint) 
local x, q, v:= <<x>>, s:= <<0>>, p:= <<1>>; 
   for x to n do p:= p.v; s:= s+v od; 
   p, s 
end proc(6);

 

5 6 7 8 9 10 11 Last Page 7 of 21