MaplePrimes Questions

restart;

eq1 := xdot = (xk - xk1)/dt;
eq2 := xdot2 = (xk - 2*xk1 + xk2)/dt^2;
eq3 := c*xdot + k*xk + m*xdot2 = F;
sol := solve({eq1, eq2, eq3}, xk);

What am I missing here? Ty 
 

How to change the distance (spacing) between 2D Input cells and 2D Output cells so that this procedure can be inserted into a style sheet and thus applied to multiple documents?

Regards

Oliveira

Would you tel me why this code doesn't work : the  lenghts of BC and BD are not constant. Thank you very much.
restart;
with(plots);
with(plottools);
AB := 39;
BC := 140;
BD := 140;
local(D);
Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc;
dist := proc(M, N) sqrt(Vdot(expand(M - N), expand(M - N))); end proc;
Fig := proc(alpha)
local cir, R, BC, BD, AC, AD, lAC, A, lBC, lAB, lBD, beta, B, C, Cc, Dd, D, Aa, Bb, F1, F2, d, k, h, i, Pb, Ph, pb1, ph1, Qb, Qh, qh1, qb1, p1, P1, p2, P2, p3, P3, p4, P4, q1, Q1, q2, Q2, q3, Q3, q4, Q4, cy1, cy2, cy3, cy4, tA, tB, tC, tD;
A := [0, 0]; R := 39; d := 83; BC := 140; BD := 140;
B := [R*cos(alpha), R*sin(alpha)];
k := BC/R; h := 1/2*sqrt(2);
Ph := [h*(R + BC), h*(R + BC)];
Pb := [h*(-R + BC), h*(-R + BC)];
Qh := [-h*(R + BC), h*(R + BC)];
Qb := [-h*(-R + BC), h*(-R + BC)];
P1 := [Ph[1] - 1/2*d*h, Ph[2] + 1/2*d*h];
P2 := [Ph[1] + 1/2*d*h, Ph[2] - 1/2*d*h];
P3 := [Pb[1] - 1/2*d*h, Pb[2] + 1/2*d*h];
P4 := [Pb[1] + 1/2*d*h, Pb[2] - 1/2*d*h];
Q1 := [Qh[1] + 1/2*d*h, Qh[2] + 1/2*d*h];
Q2 := [Qh[1] - 1/2*d*h, Qh[2] - 1/2*d*h];
Q3 := [Qb[1] + 1/2*d*h, Qb[2] + 1/2*d*h];
Q4 := [Qb[1] - 1/2*d*h, Qb[2] - 1/2*d*h];
cir := circle(A, R, color = black, linestyle = longdash);
F1 := plot(x, x = -R .. R + BC, color = black, linestyle = longdash);
F2 := plot(-x, x = -R - BC .. R, color = black, linestyle = longdash);
AC := R*(cos(alpha) + sqrt(k^2 - sin(alpha)^2));
C := [h . AC, h . AC];
AD := R*(cos(Pi - alpha) + sqrt(k^2 - sin(Pi - alpha)^2));
D := [-h*AD, h*AD]; lBC := plot([B, C], color = red, thickness = 4);
lAB := plot([A, B], color = red, thickness = 4); print(evalf(dist(B, C)), evalf(dist(B, D)));
lBD := plot([B, D], color = red, thickness = 4);
pb1 := pointplot(Pb, symbol = solidcircle, symbolsize = 5, color = black);
ph1 := pointplot(Ph, symbol = solidcircle, symbolsize = 5, color = black);
qb1 := pointplot(Qb, symbol = solidcircle, symbolsize = 5, color = black);
qh1 := pointplot(Qh, symbol = solidcircle, symbolsize = 5, color = black);
p1 := pointplot(P1, symbol = solidcircle, symbolsize = 10, color = black);
p2 := pointplot(P2, symbol = solidcircle, symbolsize = 10, color = black);
p3 := pointplot(P3, symbol = solidcircle, symbolsize = 10, color = black);
p4 := pointplot(P4, symbol = solidcircle, symbolsize = 10, color = black);
q1 := pointplot(Q1, symbol = solidcircle, symbolsize = 10, color = black);
q2 := pointplot(Q2, symbol = solidcircle, symbolsize = 10, color = black);
q3 := pointplot(Q3, symbol = solidcircle, symbolsize = 10, color = black);
q4 := pointplot(Q4, symbol = solidcircle, symbolsize = 10, color = black);
Aa := pointplot(A, symbol = solidcircle, symbolsize = 12, color = blue);
Bb := pointplot(B, symbol = solidcircle, symbolsize = 12, color = blue);
Cc := pointplot(C, symbol = solidcircle, symbolsize = 12, color = blue);
Dd := pointplot(D, symbol = solidcircle, symbolsize = 12, color = blue);
cy1 := plot([P1, P3], color = black, thickness = 8); cy2 := plot([P2, P4], color = black, thickness = 8);
cy3 := plot([Q1, Q3], color = black, thickness = 8); cy4 := plot([Q2, Q4], color = black, thickness = 8);
tA := textplot([0, 0, "A"], 'align' = {'above', 'right'});
tB := textplot([B[1], B[2], "B"], 'align' = {'above', 'right'});
tC := textplot([C[1], C[2], "C"], 'align' = {'above', 'right'});
tD := textplot([D[1], D[2], "D"], 'align' = {'above', 'right'});
display([cir, F1, F2, pb1, ph1, qb1, qh1, p1, p2, p3, p4, q1, q2, q3, q4, Aa, Bb, Cc, Dd, lAB, lBC, lBD, cy1, cy2, cy3, cy4, tA, tB, tC, tD], scaling = constrained); end proc;
Fig(Pi/3);
display([seq(Fig((2*alpha*Pi)/50), alpha = 0 .. 50)], insequence = true, axes = none);

I'm trying to solve nonlinear system of equations via homotopy perturbation method. Please help with ideas to develop the code.

 

 

restart;

de1 := (1 - p)*(diff(x(t), t $ 1) - r*x) + p*(diff(x(t), t $ 1) - r*(1 - (x + y)/K) + al*x*v);

de2 := (1 - p)*(diff(y(t), t $ 1) + m*y+u*y) + p*(diff(y(t), t $ 1) - al*x*v + m*y+u*y);

de3 := (1 - p)*(diff(v(t), t $ 1) + eta*v) + p*(diff(v(t), t $ 1) - B*y + eta*v);

ibvc := x(0) = 0.005, y(0) = 0.0007;

v(0) = 2;

r:=0.005; al:=0.002; m:=0.0001; K:=0.0138; B:=0.2; eta:=0.006; u:=0.0001;

n := 4;

X := unapply(add(g[k](t)*p^k, k = 0 .. n), x);

Y := unapply(add(h[k](t)*p^k, k = 0 .. n), x);

V := unapply(add(i[k](t)*p^k, k = 0 .. n), x);

DE1 := series(eval(de1, x = X), p = 0, n + 1);

DE2 := series(eval(de2, y = Y), p = 0, n + 1);

DE3 := series(eval(de3, v = V), p = 0, n + 1);

C1 := map(coeffs, eval([ibvc], x = X), p);

C2 := map(coeffs, eval([ibvc], y = Y), p);

C3 := map(coeffs, eval([ibvc], v = V), p);

for k from 0 to n do

    IBVC1 := select(has, C1, g[k]);

    IBVC2 := select(has, C2, h[k]);

    IBVC3 := select(has, C3, i[k]);

    s1 := dsolve({coeff(DE1, p, k), op(IBVC1)});

    s2 := dsolve({coeff(DE2, p, k), op(IBVC2)});

    s3 := dsolve({coeff(DE3, p, k), op(IBVC3)});

    h[k] := unapply(rhs(s1), t);

h[k] := unapply(rhs(s2), t);

i[k] := unapply(rhs(s3), t);

end do;

'X(t)' = X(t) + O(p^(n + 1));

'Y(t)' = Y(t) + O(p^(n + 1));

'V(t)' = V(t) + O(p^(n + 1));

 

How to make changes in the code?

 

in my program, I need to generate plot of solution. I only know where the initial condition x value is. So I give to plot the x range as some value around that initial condition location. But this is not perfect, since the command line script will fail if Y value happend to be too large somewhere in this range due to singularity. (This fails only in the command line print driver, not in the worksheet GUI).

I can ofcource limit the y range also, using view=[....] but I do not know how to pick best Y range  automatically in the program to show what is interesting in the plot without doing lots of analysis on the expression.

There is something called smartview which is supposed to be active by default. But it does not seem to be working too well.

Here is an example. This function blows up at value near x=Pi  due to singularity. and I want the plot to automatically limit the Y range without having to specify manually the y view.

restart;
sol:=exp(-3^(1/2)*(cos(x)-1)/sin(x)):
plot(sol,x=0..2*Pi);

So clearly "smartview" did not do it or I am not using it correctly. But it is supposed to be "active"? 

Compare the same thing with Mathematica Plot where this  is handled automatically by Plot

sol = Exp[-3^(1/2)*(Cos[x] - 1)/Sin[x]];
Plot[sol, {x, 0, 2*Pi}]

Again, I know I can do the following in Maple

plot(sol,x=0..2*Pi,view=[default,-1..20]);

The problem is that I am doing this in a program, which only gets an expression as function of x to plot, around some x location. So hard to decide what the right Y range is. It will best if Plot can determine the best view automatically.

How to use smartview to handle this? Or are there other alternative plot options for such cases?

Is there a build-in package for Maple where I can do binomial test ? single tail and two tailed? If n and p are known?

The command line print driver is still broken in Maple.  Same code works OK in the worksheet, but gives error in command line.

restart;
p:=plot(sin(x),x=0..3,axesfont=[12,12]);
full_file_name:=cat("C:\\TMP\\tmp.ps");
plotsetup(ps,plotoutput=full_file_name);
print(p);   
plotsetup(default):

No problem in the worksheet.  When putting the above code in file t.mpl and running it from DOS command line, it gives this error

>"C:\Program Files\Maple 2021\bin.X86_64_WINDOWS\cmaple.exe"  t.mpl

    |\^/|     Maple 2021 (X86 64 WINDOWS)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2021
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> p:=plot(sin(x),x=0..3,axesfont=[12,12]):
> full_file_name:=cat("C:\\TMP\\tmp.ps");
> plotsetup(ps,plotoutput=full_file_name);
> print(p);

Error, invalid FONT specification

> plotsetup(default):
> quit

The fix is to remove axesfont=[12,12] from the plot command.

Is this known bug in Maple 2021.1 on windows 10?

ans:=6 *a[0]+2 *k^2 *b[1]*x^2 *y+k^2 *b[1] *y *lambda+6* k^2 *b[2]* x^3 *y-c *b[1] *x* y-2* c* b[2] *x^2 *y-c *b[2] *y *lambda+(6 *b[2]^2 *x^4 *lambda)/(lambda^2 *sigma+mu^2)+(6 *b[2]^2 *x^2 *lambda^2)/(lambda^2 *sigma+mu^2)+(6 *b[1]^2 *lambda* x^2)/(lambda^2 *sigma+mu^2)-12 *a[0] *b[2] *x *y-12* (a[1] . x)* b[2] *x* y-12* (a[2] . (x^2)) *b[2] *x* y+(6 *b[1]^2 *lambda^2)/(lambda^2 *sigma+mu^2)+k^2 *(a[1] . (-2 *x* (mu* y-x^2-lambda)-mu *x* y))+2 *k^2* (a[2] . ((mu* y-x^2-lambda)^2+x* (-2 *x (mu* y-x^2-lambda)-mu *x* y)))+c (a[1] . (mu *y-x^2-lambda))+2 *c (a[2] . (x *(mu *y-x^2-lambda)))+5* k^2 *b[2] *x *y *lambda-(c *b[2] *lambda^2 *mu)/(lambda^2 *sigma+mu^2)+(12 *b[1] *lambda *b[2] *x^3)/(lambda^2 *sigma+mu^2)+(12 *b[1] *lambda^2 *b[2] *x)/(lambda^2 *sigma+mu^2)-(12 *b[1]^2 *lambda *mu* y)/(lambda^2 *sigma+mu^2)+(k^2 *b[1] *lambda^2 *mu)/(lambda^2* sigma+mu^2)-12 *a[0] *b[1] *y-12* (a[1] . x) *b[1] *y-12* (a[2] . (x^2)) b[1] *y-6 *a[0]^2-12 *a[0] *(a[1] . x)-12 *a[0]* (a[2] . (x^2))-6* (a[1] . x)^2-12* (a[1] . x) *(a[2] . (x^2))-6* (a[2] . (x^2))^2-(2 *k^(2)* b[1] *lambda* mu^2 *y)/(lambda^2 *sigma+mu^2)+(k^2 *b[1] *lambda *mu *x^2)/(lambda^2 *sigma+mu^2)+(6* k^2 *b[2] *lambda *mu *x^3)/(lambda^2 *sigma+mu^2)+(6* k^2 *b[2] *lambda^2 *mu *x)/(lambda^2 *sigma+mu^2)+(2* c *b[2] *lambda *mu^2* y)/(lambda^2 *sigma+mu^2)-(c *b[2] *lambda* mu* x^2)/(lambda^2 *sigma+mu^2)-(12 *b[2]^2 *x^2 *lambda* mu* y)/(lambda^2 *sigma+mu^2)-(12* k^2 *b[2] *lambda* mu^2 *x *y)/(lambda^2 *sigma+mu^2)-(24 *b[1] *lambda *b[2] *x *mu* y)/(lambda^2 *sigma+mu^2)+6* (a[1] . x)+6* (a[2] . (x^2))+6 *b[2] *x *y+6 *b[1] *y;


P1 := coeff(coeff(ans, x, 4), y, 0);


Error, unable to compute coeff

Sometime, answer is coming sometine not.

2. Also, if one wants to substitute the value of x^2=t^2+5, in x^3 then why it is giving the ans.

Thank you very much!

I create and use the variable e (for elementary charge) often in my work.  I recently upgraded from version 2019 to version 2021 .  My workbooks now show the following warning when I run anything using my e vaiable.

Warning, if e is meant to be the exponential e, use command/symbol completion or palettes to enter this special symbol, or use the exp function
 

Is there a way to turn off this warning?  It is very annoying and a bit embarassing when I demo anything.

Thanks

Hi Maple Users,

Microsoft is enticing me to upgrade to Windows 11 from 10 for free. I am a bit hesitant because I don't know if Maple 2021 will continue working as well as in Windows 10. Does anyone have any thoughts or wisdom to share.

Thank you.

So this is my integral and I need to determine the recursion formula (using maple's integration by parts) and then calculate In: 
∫ 1/(x^2+1)^n 𝑑𝑥

Thanks in advance!

i have this differential equation of order 4 that i have problem with solving it,

when ever i try solving it using maple the answer comes like this [  ] with nothing inside.

the differntial equation is: u'''' - sin x u'' + uu' - u=-1-sinx.

and the inital values are: u(0)=2, u'(0)=0,u''(0)=-1,u'''(0)=0.

if you got the answer can you send the code in maple so i can try it and see where i did wrong.

How do i get to the 2nd line for a multiple problem? 

Run these codes

with(inttrans)

y := t -> invlaplace(exp(-s)/s, s, t)

The following gives correct answer

y(t - 1)

The following gives junk answer

y(t - 1.1)

and I cannot plot added shifted signals in time domain if their shifts are not integer numbers. Maple goes into infinite calculation loop.

First 108 109 110 111 112 113 114 Last Page 110 of 2173