Maple 2016 Questions and Posts

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

Find and classify all the critical point(s) for 

f(x,y)=x3 + 3xy2 - 15x + y3 - 15y .

I need a help from someone who knows the GRTensor commands.

If you create a tensor of rank 2 using the grdef ("F {(a) (b)}"). Until then, okay!

However, I would like to define each of the 16 tensor components and I do not know how to do.

Could someone help me?

Thank you very much!

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:

 

 

 

 

Hi, I am trying to solve two nonlinear simultaneous equations with two unknown variables T & W. The Range of one variable T is from 0 to 0.4

When I use fsolve command to solve it, it gives me a solution in which T value is more than the specified range so it is an invalid solution for me. When I specify the range of T from 0 to 0.4 in fsolve, it doesn't give any solution.

Solve command in maple also doesn't give any solution and just shows evaluating.

My question is how can I get all the roots of unknown variables (T & W), which can solve these two simultaneous equations.

The maple worksheet is attached. 

.maple_simul.equation.mw

Hello

I solved a complex PDE equation in maple but I can not plot the output.

The manner was like bellow:

PDE := [diff(A(z, t), z)+(1/2)*alpha*A(z, t)+(I*beta[2]*(1/2))*(diff(A(z, t), t, t))-(I*beta[3]*(1/6))*(diff(A(z, t), t, t, t))-I*(GAMMA(omega[0]))(abs(A(z, t))^2*A(z, t)) = 0];
IBC := {(D[2](A))(z, 1), A(0, t) = -sin(2*Pi*t), A(z, 0) = sin(2*Pi*z), (D[2](A))(z, 0) = 2*z};
pds := pdsolve(PDE, IBC, type = numeric, time = t, range = 0 .. 1);
pds:-plot3d(A(z, t)*conjugate(A(z, t)), t = 0 .. 1, z = 0 .. 10, shading = zhue, axes = boxed, labels = ["x", "t", "A(z,t)"], labelfont = [TIMES, ROMAN, 20], orientation = [-120, 40]);

It is solved but there is an error like:

Error, (in pdsolve/numeric/plot3d) unable to compute solution for z>INFO["failtime"]:
unable to store 11.2781250000000+4390.00000040000*I when datatype=float[8]

could you please help me?

what is the problem?

 

 

I have tried to compile a simple program looking for counterexamples to a conjecture by Goldbach that every odd number is a sum of a prime and twice a square. Stern gave the counterexamples 5777 and 5993 a long time ago, so this is mainly for instruction purposes.

My program

othergoldbachFCi:=proc(sieve::Array(1..10000,datatype=integer[4]))
   local i,j,M; 
   M:=10000;
   for i from 1 to M do
      if(sieve[i] mod 2=0) then 
         for j from 1 to iquo(M-i,2*i+1) do 
            sieve[i+j*(2*i+1)]:=2*iquo(sieve[i+j*(2*i+1)],2)+1;
         end do; 
         for j from 1 to floor(sqrt(M-i)) do 
            sieve[i+j*j]:=2+sieve[i+j*j] mod 2;  
         end do;
      else 
         if(sieve[i]<2) then 
            printf("%d is a counterexample\n",2*i+1); 
         end if; 
      end if; 
   end do; 
end proc;

works fine and compiles without problems. (I have to pass the array for the sieve because compiled program cannot declare memory, and it has to be 4 bytes even though I only need to use the lower 2 bit).  But the compiled version breaks with

   Error, (in compiledOGi) array index out of bounds

 

already in the first instance of the for loop. After a lot of trial and error I found out that if I replaced the line 

   sieve[i+j*j]:=2+sieve[i+j*j] mod 2;  

by

   temp:=iquo(sieve[i+j*j],2);
   sieve[i+j*j]:=2+(sieve[i+j*j]-2*temp);  

 

then the problem goes away and the compiled version works beautifully. It is not enough to do the mod 2 computation in temp, and not enough to replace mod by iquo in one line. 

This makes very little sense to me. Can anybody explain? I'm still using Maple 2016 and do not know if the issue has been resolved in Maple 2017.

 

Best,

Soren

 

Since I am a very recent Maple user, I do not know why I obtained a wrong answer with the following two comands:

Exp:= Psi(rho(x,t),theta(x,t));
                  Psi(rho(x, t), theta(x, t))
Exp1:= diff(Exp,t);
     / d           \                                  
     |--- rho(x, t)| D[1](Psi)(rho(x, t), theta(x, t))
     \ dt          /                                  

          / d             \                                
    + |--- theta(x, t)| Psi(rho(x, t) + 1, theta(x, t))
          \ dt            /                                
 

Can someone, please, help me?

Thank you.

 

In the below calculations, I get some solutions after solving the system. I am not sure if this is done assuming that all the values that are under the radicals are positive or indeed they are positive without further assumptions. I mean can I be sure that each given set of solution is a feasible solution? I suspect that Maple may ignore the assumptions sometimes.  

The following are the equation and plot3d of the minimal surface named Catalan:

Catalan := [alpha-sin(alpha)*cosh(beta), 1-cos(alpha)*cosh(beta), 4*sin((1/2)*alpha)*sinh((1/2)*beta)]
plot3d(Catalan, alpha = 0 .. 2*Pi, beta = -3 .. 3, scaling = constrained, title = "Catalan's surface", titlefont = [Courier, bold, 14])

I would like to color and thicken the edge of this surface to emphasize what I presume is the wire which frames the soap film which forms the surface.

Contourplot3d only shows contours at constant values of the z coordinate, however the plot3d display with style option "surface with line" clearly shows the surface's edge contour, among others.

Given the surface equation, is there any way to display the surface edge programmatically e.g. as a spacecurve? 

Without my knowingly changing any Maple parameters, the execution time values of variables appearing in the window displayed when a DEBUG statement is executed have recently started to be listed at the end of my worksheet.

If I have been doing extensive debugging this list can be quite lengthy and a nuisance to erase.

Why did this listing suddenly begin and how can I stop it?

 I'm thinking upload a technical paper into maple cloud, and i would like to keep the intellectual property of this paper or have a mention from the reader if they use it. Is it possible?. Thanks!

Suppose Delta:=f(a,b)x^2+g(a,b)x+h(a,b), where f,g,h are functions of a and b. Is there a way to find conditions on a,b such that Delta is positive?

i want to solve this DAE system usin Dsolve , but i obtain this error message (cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up), if anyone can help me ,

Hello all, 

I am trying to compute the Groebner basis for a set of 3 coupled nonlinear equations. The variables I wish to solve for are A0,B0, and B1; however, my equations also have the variables DC, a, nu, q, and t. I wish to solve the 3 equations in terms of these other 5 variables such that I can substitute in any values I desire and obtain a result. When attempting to put the three equations into the PolynomialIdeal command from the PolynomialIdeals package, Maple gives me an error stating that the inputs must be polynomials with respect to all 8 variables. How would I go about declaring the other 5 variables such that they are considered arbitrary constants? 

I was able to get around the errors by assigning values to these 5 variables, though this is not what I am trying to accomplish. I need these 5 values to remain arbitrary.

I am very new to the concept of Groebner Bases and these commands so any help would be appreciated. I have attached my worksheet for reference. I am also happy to supply any additional information that may be needed to assist with this issue.

Thanks!
 

restart

NULL

``

SED2 := proc (A0, B0, B1) options operator, arrow; (32/3)*(nu+7)*A0^2*Pi*DC/(a^2*(1+nu))+3*DC*Pi*((1+nu)^4*(B0^2+(13/42)*B1^2+(4/5)*B0*B1)*a^2+(328/315)*A0^2*(1+nu)^2*((B0+(142/451)*B1)*nu^3+((323/41)*B0+(1490/451)*B1)*nu^2+(11*B0+(3874/451)*B1)*nu-(1847/41)*B0-(8034/451)*B1)*a+(128/105)*A0^4*(nu^4+18*nu^3+132*nu^2+494*nu+939))/(t^2*a^2*(1+nu)^4)-(1/6)*q*a^2*A0-(-(1/4)/a^2-(1/4)*(5+nu)/(a^2*(1+nu)))*A0*q*a^4-(1/2)*(5+nu)*A0*q*a^2/(1+nu) end proc;

proc (A0, B0, B1) options operator, arrow; (32/3)*(nu+7)*A0^2*Pi*DC/(a^2*(1+nu))+3*DC*Pi*((1+nu)^4*(B0^2+(13/42)*B1^2+(4/5)*B0*B1)*a^2+(328/315)*A0^2*(1+nu)^2*((B0+(142/451)*B1)*nu^3+((323/41)*B0+(1490/451)*B1)*nu^2+(11*B0+(3874/451)*B1)*nu-(1847/41)*B0-(8034/451)*B1)*a+(128/105)*A0^4*(nu^4+18*nu^3+132*nu^2+494*nu+939))/(t^2*a^2*(1+nu)^4)-(1/6)*q*a^2*A0-(-(1/4)/a^2-(1/4)*(5+nu)/(a^2*(1+nu)))*A0*q*a^4-(1/2)*(5+nu)*A0*q*a^2/(1+nu) end proc

(1)

NULL

``

eqA0 := proc (A0, B0, B1) options operator, arrow; diff(SED2(A0, B0, B1), A0) end proc:

eqB0 := proc (A0, B0, B1) options operator, arrow; diff(SED2(A0, B0, B1), B0) end proc:

eqB1 := proc (A0, B0, B1) options operator, arrow; diff(SED2(A0, B0, B1), B1) end proc:

NULL

``

type(SED2, polynom);

true

(2)

type(eqA0, polynom);

true

(3)

type(eqB0, polynom);

true

(4)

type(eqB1, polynom);

true

(5)

NULL

``

with(Groebner):

with(PolynomialIdeals):

NULL

NULL

WL := PolynomialIdeal({eqA0(A0, B0, B1), eqB0(A0, B0, B1), eqB1(A0, B0, B1)})

Error, (in PolynomialIdeals:-PolynomialIdeal) generators must be polynomials with respect to, {A0, B0, B1, DC, a, nu, q, t}

 

NULL

type(WL, PolynomialIdeals:-PolynomialIdeal);

false

(6)

``

NULL

GB := Basis(WL, lexdeg([B0, B1], [A0]))

Error, (in Groebner:-Basis) the first argument must be a list or set of polynomials or a PolynomialIdeal

 

NULL

``

GB[1];

GB[1]

(7)

GB[2];

GB[2]

(8)

GB[3];

GB[3]

(9)

``

``

A00 := solve(GB[1], A0):

A00 := simplify(remove(has, [A00], I)):

A0 := A00[1]

Error, invalid subscript selector

 

B10 := solve(GB[2], B1):

B10 := simplify(remove(has, [B10], I)):

B1 := B10[1]

Error, invalid subscript selector

 

B00 := solve(GB[3], B0):

B00 := simplify(remove(has, [B00], I)):

B0 := B00[1]

Error, invalid subscript selector

 

NULL

``


 

Download Groebner_Basis_Work.mw

 

Hello,

i have a vector-valued function mapping from R^n  -> R^m
I  compute its Jacobian Matrix as well as the Hessian Matrix of each output with regard to the inputs, which works so far.
Now I would like to use the CodeGeneration package to generate optimized C Code to compute these matrices numerically. This is, where i encounter a Problem:

I would like to optimize Code for all matrixes at once, because they contain common subexpressions. However CodeGeneration::C tells me it is unable to optimize the given input and generates unoptimized code.


I appended an exemplary file to illustrate the problem: Jacobian_Hessian_codeGeneration_tryout.mw

short version:

C(Jac, optimize = tryhard, resultname = JacobianMatrix);
C(H1, optimize = tryhard, resultname = Hessian1); 
C(H2, optimize = tryhard, resultname = Hessian2); 
C(H3, optimize = tryhard, resultname = Hessian3)

works, but is suboptimal.

C([JacobianMatrix = Jac, Hessian1 = H1, Hessian2 = H2, Hessian3 = H3], optimize)

fails to optimize and

C([Jac, H1, H2, H3], optimize)

fails completely.

(With Jac beeing a m by n matrix and H1-3 beeing n by n matrices)

If anyone can tell me what I'm missing here I'd really appreciate the help.

First 23 24 25 26 27 28 29 Last Page 25 of 61