Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Why is assume(...) do_something();  gives an error when I run the code one more time, but do_something() assuming ...; do not give an error when everything else is the same?

Is there semantic difference between the two forms? I thought they should work the same way. Here is an example

#in separate cell
restart;

#in separate cell
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
assume(x>0);assume(t>0);assume(k>0):
sol:= pdsolve({pde,ic,bc},u(x,t)):

#in separate cell. Now this gives error
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
assume(x>0);assume(t>0);assume(k>0):
sol:= pdsolve({pde,ic,bc},u(x,t)):
#error message now

Here is screen shot

Now will do the same, but use assuming. Now there is no error

#in one cell
restart;

#in one cell
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
sol:= pdsolve({pde,ic,bc},u(x,t)) assuming x>0,t>0,k>0:

#in one cell, no error
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
sol:= pdsolve({pde,ic,bc},u(x,t)) assuming x>0,t>0,k>0:

Here is screen shot

Why does one give an error, but the second one does not?

I thought they work the same way. Which method is recommended to use?

assume(...); do_something(); 

or 

do_something() assuming ...;

Maple 2018 on windows.

equ.pdf The equation is in the following form:

 

Hello,

     I'm attempting to use unevaluation quotes on a keyword argument within a procedure. For instance, if I have two procedures with the same keyword arguments, I need to unevaluate one to call the other:

foo1 := proc( {param:={}}, $)
  foo2('param'=param):
end proc:


foo2 := proc( {param:={}}, $)
end proc:

foo1('param'=1);

The above code throws the error,

Error, (in foo1) invalid input: too many and/or wrong type of arguments passed to foo2; first unused argument is 1 = 1

which I take to mean that 'param' in foo1 isn't being unevaluated in the call to foo2. What is the correct way to accomplish this?

Thanks!

Is it possible to get the following integral involving vectors done in Maple 2018, but handle the singularity when p1=p3?

Note that the output of p3 and p1 are slightly different, probably because the earlier version of the worksheet was in Maple 2017? 

(Note: Earlier version - was due to help received from Dr. Edgardo Cheb-Terrab, using Maple 2017). 

 
with(Physics[Vectors]);
r_ := _i*x+_j*y+_k*z;
                    r_ := _i x + _j y + _k z
p__1_ := _i*`p__1x `+_j*`p__1y `+_k*`p__1z `;
           p__1_ := _i p__1x  + _j p__1y  + _k p__1z 
p__3_ := _i*`p__3x `+_j*`p__3y `+_k*`p__3z `;
           p__3_ := _i p__3x  + _j p__3y  + _k p__3z 
Expression to integrate wrt p3
'exp(i*(p__1_ . r_))/((p__3_ - p__1_)^2)'
             exp(I Physics:-Vectors:-.(p__1_, r_))
             -------------------------------------
                                                2 
              Physics:-Vectors:-+(p__3_, -p__1_)  
Delaying the evaluation above, if evaluation is allowed, the integrand is
exp(I*(p__1_ . r_))/(p__3_-p__1_)^2;
(exp(I (p__1x  x + p__1y  y + p__1z  z)))/((_i (-p__1x  + p__3x )

   + _j (-p__1y  + p__3y ) + _k (-p__1z  + p__3z ))^2)
T i is the imaginary unit
interface(imaginaryunit = I);
                               I
Because (4), has the value of i before being the imaginary unit, input the integrand again
'exp(i*(p__1_ . r_))/((p__3_ - p__1_)^2)'
             exp(I Physics:-Vectors:-.(p__1_, r_))
             -------------------------------------
                                                2 
              Physics:-Vectors:-+(p__3_, -p__1_)  


Now on the integration
Int(exp(I*(p__1_ . r_))/(p__3_-p__1_)^2, [`p__3x ` = -infinity .. infinity, `p__3y ` = -infinity .. infinity, `p__3y ` = -infinity .. infinity]);
  /infinity   /infinity   /infinity                            
 |           |           |                                     
 |           |           |          (exp(I (p__1x  x + p__1y  y
 |           |           |                                     
/-infinity  /-infinity  / -infinity                            

   + p__1z  z)))/((_i (-p__1x  + p__3x ) + _j (-p__1y  + p__3y )

   + _k (-p__1z  + p__3z ))^2) dp__3x  dp__3y  dp__3y 
value(Int(exp(I*(`p__1x `*x+`p__1y `*y+`p__1z `*z))/(_i*(-`p__1x `+`p__3x `)+_j*(-`p__1y `+`p__3y `)+_k*(-`p__1z `+`p__3z `))^2, [`p__3x ` = -infinity .. infinity, `p__3y ` = -infinity .. infinity, `p__3y ` = -infinity .. infinity]));
                                         /         /[          
 exp(I (p__1x  x + p__1y  y + p__1z  z)) |PIECEWISE|[infinity, 
                                         \         \[          

   Im(_i p__1x  + _j p__1y  + _k p__1z  - _k p__3z )    ]  
   ------------------------------------------------- = 0], 
                          _i                            ]  

                 \\         
   [0, otherwise]|| infinity
                 //         
In the above, there is the product of three Dirac delta functions, that can be represented as a single 3D Dirac delta
combine(exp(I*(`p__1x `*x+`p__1y `*y+`p__1z `*z))*piecewise(Im(_i*`p__1x `+_j*`p__1y `+_k*`p__1z `-_k*`p__3z `)/_i = 0, infinity, 0)*infinity);
                                         /         /[          
 exp(I (p__1x  x + p__1y  y + p__1z  z)) |PIECEWISE|[infinity, 
                                         \         \[          

   Im(_i p__1x  + _j p__1y  + _k p__1z  - _k p__3z )    ]  
   ------------------------------------------------- = 0], 
                          _i                            ]  

                 \\         
   [0, otherwise]|| infinity
                 //         

 

Hello. Tell me please how to fix it and build a graph? Thank you in advance.

p := PolyhedralSets([-x >= 0, -y >= 0, -z >= 0, -(1/2)*x >= 0, (-x-y)*(1/2) >= 0, (-x-z)*(1/2) >= 0], {y = -20}, [x, y, z]);
plot(p);
Error, (in plot) cannot determine plotting variable
 

Hello,

I wonder why trigonometric functions in the Trig Identities context menu in this new release are now suddenly printed italic like cos(x). It's not only inconsistent with the display of functions everywhere else within Maple, also every LaTeX user with very little knowledge of mathematical typesetting rules will frown at the sight of this.

I know it's not a big thing but Maple always stresses to produce pretty-print textbook style output. Powers of trigonometric functions like tan(theta)^2 as shown in the attached screenshot would however be printed like tan^2(theta) in textbooks just as when written by hand.

There are quite some examples where Maple uses significantly strange typesetting like total derivatives dx dy dz in the Physics package that are typeset as partial derivatives. I wonder why Maple introduced a partial-d but not also a total-d operator - doesn't that kind of hurt the eye even if the functionality is beyond critique? That's actually the only case that comes to my mind right now where even Mathematica's typesetting resembles mathematics in textbooks more closely and displays mathematical content more pleasantly than Maple does.

Good day. Please can someone kindly help to reduce the result of this code. Thank you and kind regards

restart:
s:=(sum(a[j]*x^j,j=0..3)+sum(a[j]*exp(-(j-3)*x),j=4..7)):
F:=diff(s,x):
p1:=simplify(eval(s,x=q))=y[n]:
p2:=simplify(eval(F,x=q))=f[n]:
p3:=simplify(eval(F,x=q+h/3))=f[n+1/3]:
p4:=simplify(eval(F,x=q+h))=f[n+1]:
p5:=simplify(eval(F,x=q+5*h/3))=f[n+5/3]:
p6:=simplify(eval(F,x=q+2*h))=f[n+2]:
p7:=simplify(eval(F,x=q+7*h/3))=f[n+7/3]:
p8:=simplify(eval(F,x=q+3*h))=f[n+3]:


vars:= seq(a[i],i=0..7):
Cc:=eval(<vars>, solve({p||(1..8)}, {vars})):
for i from 1 to 8 do
	a[i-1]:=Cc[i]:
end do:
Cf:=s:
L:=collect(simplify(simplify(expand(eval(Cf,x=q+3*h)),size)), [y[n],f[n],f[n+1/3],f[n+1],f[n+5/3],f[n+2],f[n+7/3],f[n+3]], factor):
length(L);
H := ee -> collect(numer(ee),[exp],h->simplify(simplify(h),size))/collect(denom(ee),[exp],h->simplify(simplify(h),size)):
M:=y[n+3]=(H@expand)(L);
length(M);

 

CurveFitting.mws

Splines and BSplines etc for curve fitting.

The attached short program uses with(CurveFitting) and BS:=BSpline(2,x);  outputs four expressions, the third being 

2-x, x<2.  I'd like to be able to access this, and plot it. but plots[display](BS[3], x=1..2); comes up with an error message.

Thanks in advance for any help. 

How do you can write equation with Maple 2015

into 

please help me!

hi, i am trying to get a list of equations using the coeff function. I have the following equation:

restart;
Lambda:=-(1/8)*(D[4](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), x))-(1/8)*(D[6](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), y, x))-(1/8)*(D[7](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), x, t))-(1/8)*(D[5](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), x, x))-(1/8)*(D[12](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), x, t, t))-(1/8)*(D[10](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), x, x, t))-(1/8)*(D[11](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), y, x, t))-(1/8)*(D[9](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), y, x, x))+(1/8*(-3*(D[8](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))-4))*(diff(u(x, y, t), x, x, x))-(1/8)*(D[1](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))+(1/4)*(D[8](a))(x, y, t, u(x, y, t), diff(u(x, y, t), x), diff(u(x, y, t), y), diff(u(x, y, t), t), diff(u(x, y, t), x, x), diff(u(x, y, t), y, x), diff(u(x, y, t), x, t), diff(u(x, y, t), y, t), diff(u(x, y, t), t, t))*(diff(u(x, y, t), x, x, x));

Now I am trying to get the coefficients of the derivatives of u(x,y,t). So by hand I have done the calculation of taking the coeffient of diff(u(x,y,t),x,x,x) and setting this equal to zero, and then the coefficient of diff(u(x,y,t),x,x,t) and so on. However when I use the coeff function, it will only allow me to compute the coeff of diff(u(x,y,t),x,x,x) and others of third order. However it will not let me use the deriviateves of u of second and first order.

coeff(Lambda,diff(u(x,y,t),x));

this will not work but 

coeff(Lambda,diff(u(x,y,t),x,x,x));

will work.

Any help would be great thanks.


 

if known solution [a,b,c,d]

solve([eq2, eq3, eq4, ....], [a,b,c,d])

but not equal to known solution a,b,c,d even if number of equations more than number of variables.

then guess that there are some necessary and sufficient conditions unknown.

how to find the necessary and sufficient conditions from solutions?

is there options to set for this?

or can eliminate function help to find necessary and sufficient conditions and how to do?

 

 

 

I am trying to solve the equation

exp(2*sin(t))-1=0, over the interval 0 <= t <=  16

I tried entering this into Maple:

solve({exp(2*sin(t))-1=0, 0 <= t,t <= 16}, AllSolutions, Explicit)

When I enter it, Maple just says "Evaluating"... and then returns nothing.

I tried "solve" without AllSolutions/Explicit, and even fsolve.

Then Maple only gives me the trivial result t = 0.

Is there a way to approximate the roots, like a root solver.

Ideally I would like to get the exact roots over the interval [0,16].

Wolfram has no problem solving this exactly.https://www.wolframalpha.com/input/?i=solve(%5Bexp(2*sin(t))-1%3D0,+0+%3C%3D+t,t+%3C%3D+16%5D,+AllSolutions,+Explicit)

I posted the worksheet

solveroots.mw

Could some Maple expert help me understand why pdsolve gives me this error message from trying to solve this Schrödinger pde and if there is a work around?

restart;
pde:=I*diff(f(x,t),t)=-diff(f(x,t),x$2)+2*x^2*f(x,t);
bc:=f(-infinity,t)=0,f(infinity,t)=0;
sol:=pdsolve([pde,bc],f(x,t));

I must be doing something wrong, but do not see it.

Mathematica solves the above as follows

pde=I D[f[x,t],t]==-D[f[x,t],{x,2}] + 2 x^2 f[x,t];
bc={f[-Infinity,t]==0,f[Infinity,t]==0};
sol=DSolve[{pde,bc},f[x,t],{x,t}]

thank you

Have been using Maple on and off the last couple years, and am stuck on trying to get the output of a symbolic polynomial solution into MATLAB code.  

The original equation I am trying to solve (for lambda):

fl := t^2*lambda^4/pi+K*lambda^3/pi-4*pi/(3*(-nu^2+1)) = 0

And the way I am attempting to solve it in Maple: 

f1 := RootOf(fl = 0, lambda):

res := allvalues(f1):

 

I won't put the entire output of that last expression here :P.

 

However upon attempting to convert to MATLAB code, I get an error:

> Matlab(res);
Error, (in Translate) options [-(1/4)*(-3*K+3*K*nu^2)/(3*t^2*nu^2-3*t^2)+(1/12)*3^(1/2)*((-3*K^2*(pi^2*(9*K^2+((-1024*pi^2*t^6-81*K^4+81*K^4*nu^2)/(-1+nu^2))^(1/2))*(-1+nu^2)^2)^(1/3)+3*K^2*(pi^2*(9*K^2+((-1024*pi^2*t^6-81*K^4+81*K^4*nu^2)/(-1+nu^2))^(1/2))*(-1+nu^2)^2)^(1/3)*nu^2+4*2^(1/3)*(pi^2*(9*K^2+((-1024*pi^2*t^6-81*K^4+81*K^4*nu^2)/(-1+nu^2))^(1/2))*(-1+nu^2)^2)^(2/3)*t^2-32*pi^2*2^(2/3)*t^4+32*pi^2*2^(2/3)*t^4*nu^2)/((pi^2*(9*K^2+((-1024*pi^2*t^6-81*K^4+81*K^4*nu^2)/(-1+nu^2))^(1/2))*(-1+nu^2)^2)^(1/3)*(-1+nu^2)))^(1/2)/t^2-(1/12)*(-(18*K^2*(pi^2*(9*K^2+((-1024*pi^2*t^6-81*K^4+81*K^4*nu^2)/(-1+nu^2))^(1/2))*(-1+nu^2)^2)^(1/3)*((-3*K...
 

 

I'm guessing it's something to do with the fact that the allvalues() funciton spits out four answers (and I want to examine them one at a time in MATLAB to know which one is right for me).

 

Any thoughts?

 

B

> S:=-1/2*((-30*sqrt(3)+81*I)^(2/3)+21+2*sqrt(3)*(-30*sqrt(3)+81*I)^(1/3)-6*(-30*sqrt(3)+81*I)^(1/3)+I*sqrt(3)*(-30*sqrt(3)+81*I)^(2/3)-21*I*sqrt(3))/(-30*sqrt(3)+81*I)^(1/3);

When I enter

simplify(S);

a not much simpler expression involving arctan is output
but when I enter

factor(S);

the expected simplification to the number

3

is output.

This is not a but report, just a report of curious behavior.

I am using Maple 2016 on a Windows 10 PC.

 

             

First 831 832 833 834 835 836 837 Last Page 833 of 2216