Maple 2018 Questions and Posts

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

hi

I want to mix two curve and have only one figure(I want to compare two curve in one plot domain )?

Thank you

plot.mw
 

h1 := solve(Vdc = 0.1500000000e-2*sqrt(2.53669508*10^8*u^3-6.06101011*10^8*u^2+3.46343435*10^8*u), u); plot([h1], Vdc = 0 .. 11.5, color = [magenta], thickness = 1); plot(Vector([0, 3.38, 5.21, 6.97, 8.4108, 10.099, 10.9232, 11.8091]), Vector([0, 0.760e-1, .1275, .1994, .2286, .3222, .3637, .999]), style = point, symbol = asterisk, color = "Blue")

 

 

``


 

Download plot.mw

 

 

Hi, fairly simple question,

I solve a simple equation:

solve(x^x = 4, allsolutions, explicit);

#(2*(I*Pi*_Z7+ln(2)))/LambertW(_Z9, 2*ln(2)+(2*I)*Pi*_Z7)

Maple  gave me solution with prefix _Z for integer values, but why  _Z9 must be exactly equal  Zero  to be correct ?.

If _Z9 is integer it can also take other values than zero ?

Thanks in advance.



More information see attached file:

Download Allsolution.mw

 

We have just released an update to Maple, Maple 2018.2. This release includes improvements in a variety of areas, including code edit regions, Workbooks, and Physics, as well as support for macOS 10.14.

This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2018.2 download page, where you can also find more details.

For MapleSim users, the update includes optimizations for handling large models, improvements to model import and export, updates to the hydraulics and pneumatics libraries, and more. For more details and download instructions, visit the MapleSim 2018.2 download page.

Is it possible to output to the console without a new line being added. The code:

prints each number on a separate line. I want to print them all on the same line.

Hello!

I am trying to determine the type of Lie algebra originating from Killing vectors. However, Maple says that some variable x is protected (though, I guess, it shouldn't even be in the L). Is there any way to solve this issue?

Best regards, 
Nick

error.mw

restart

with(DifferentialGeometry); with(Tensor); with(LieAlgebras); with(GroupActions); with(Library)

DGsetup([x, y], M)

g := evalDG((`&t`(dx, dx)+`&t`(dy, dy))/y^2)

_DG([["tensor", M, [["cov_bas", "cov_bas"], []]], [[[1, 1], 1/y^2], [[2, 2], 1/y^2]]])

(1)

kv := KillingVectors(g)

[_DG([["vector", M, []], [[[1], (1/2)*x^2-(1/2)*y^2], [[2], y*x]]]), _DG([["vector", M, []], [[[1], x], [[2], y]]]), _DG([["vector", M, []], [[[1], 1]]])]

(2)

L := LieAlgebraData(kv, Poincare)

_DG([["LieAlgebra", Poincare, [3]], [[[1, 2, 1], -1], [[1, 3, 2], -1], [[2, 3, 3], -1]]])

(3)

DGsetup(L); MultiplicationTable("LieTable")

Query(Poincare, "Semisimple")

true

(4)

CSA := CartanSubalgebra(Poincare)

[_DG([["vector", Poincare, []], [[[2], 1]]])]

(5)

RSD := RootSpaceDecomposition(CSA)

Error, (in MultiSet:-Entries) attempting to assign to `x` which is protected.  Try declaring `local x`; see ?protect for details.

 

``


 

Download error.mw

 

hi.

I can not gain answer for integral.

Best

int.mw
 

restart

PDE := (12*kappa^2*psi^2*(-upsilon^2+1)*((3*Pi^2*Q^2*(nu*psi^2+1)/(32*(-nu^2+1))+Q^2*(Pi^2*cos(2*Pi*y)/(8*psi^2)+psi^2*cos(2*Pi*x)*Pi^2*cos(2*Pi*y)/(4*(psi^2+1)^2)+Pi^2*cos(4*Pi*y)/(32*psi^2)+psi^2*cos(2*Pi*x)*Pi^2*cos(4*Pi*y)/(2*(4*psi^2+1)^2)+psi^2*cos(4*Pi*x)*Pi^2*cos(2*Pi*y)/(8*(psi^2+4)^2)))*(2*Q*Pi^2*sin(Pi*x)^2*cos(Pi*y)^2-2*Q*cos(Pi*x)^2*cos(Pi*y)^2*Pi^2)+(2*Q*cos(Pi*x)^2*Pi^2*sin(Pi*y)^2-2*Q*cos(Pi*x)^2*cos(Pi*y)^2*Pi^2)*(3*Pi^2*Q^2*(psi^2+nu)/(32*(-nu^2+1))+Q^2*((1/8)*psi^2*cos(2*Pi*x)*Pi^2+psi^2*cos(2*Pi*x)*Pi^2*cos(2*Pi*y)/(4*(psi^2+1)^2)+(1/32)*psi^2*cos(4*Pi*x)*Pi^2+psi^2*cos(2*Pi*x)*Pi^2*cos(4*Pi*y)/(8*(4*psi^2+1)^2)+psi^2*cos(4*Pi*x)*Pi^2*cos(2*Pi*y)/(2*(psi^2+4)^2)))-8*Q^3*cos(Pi*x)*cos(Pi*y)*Pi^2*sin(Pi*x)*sin(Pi*y)*(-psi^2*Pi^2*sin(2*Pi*x)*sin(2*Pi*y)/(4*(psi^2+1)^2)-psi^2*Pi^2*sin(2*Pi*x)*sin(4*Pi*y)/(4*(4*psi^2+1)^2)-psi^2*Pi^2*sin(4*Pi*x)*sin(2*Pi*y)/(4*(psi^2+4)^2)))+beta*V^2/(1-Q*cos(Pi*x)^2*cos(Pi*y)^2)^2-8*Q*Pi^4*cos(Pi*x)^2*cos(Pi*y)^2+8*Q*Pi^4*sin(Pi*x)^2*cos(Pi*y)^2-2*psi^2*(4*Q*Pi^4*sin(Pi*x)^2*sin(Pi*y)^2-4*Q*Pi^4*sin(Pi*x)^2*cos(Pi*y)^2-4*Q*cos(Pi*x)^2*Pi^4*sin(Pi*y)^2+4*Q*Pi^4*cos(Pi*x)^2*cos(Pi*y)^2)-psi^4*(-8*Q*cos(Pi*x)^2*Pi^4*sin(Pi*y)^2+8*Q*Pi^4*cos(Pi*x)^2*cos(Pi*y)^2))*(1-Q*cos(Pi*x)^2*cos(Pi*y)^2)^2*cos(Pi*x)^2*cos(Pi*y)^2

int(int(PDE, y = -1/2 .. 1/2), x = -1/2 .. 1/2)


 

Download int.mw

 

This is probably a silly question, but...

given 

GST := AE+AI-ANB-AR-CP

how do i append [i] to each element of the list so I get

AE[i]+AI[i]-ANB[i]-AR[i]-CP[i]

this nearly gets it

(GST@`[]`)~(i);
 

I an unable to get a numerical result out of this triple integral.  Maple runs forever.  I stopped it after about half an hour:

Int(exp(-a^2-b^2-c^2),
    a=b^2/(4*c)..infinity, b=-infinity..infinity, c=0..infinity);
value(%);
evalf(%);

Is there a trick to make it work?

I am working on a project in dynamical system and I am to apply Pontryagins maximum principle of control. i have coded the control equations but it shows an error message "Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 7, got 6". What could be the possible problem?

Not sure why I need to invoke the simplify command here, shouldn't the immediate simplification occur?


                  

simplify(%)
                   

However, it does work algebraically


                 

                    

 

hi.

According to the fhgure attaceh how i can gain the equation (2-27) . I write the equation (2-26) in maple but I couldnot to gain that result.

If possible to reach equation via maple?

Thanks

diff.mw
 

restart

FC := (1/2)*W_m^2*(c1*x^2+c2*y^2)+(E.(h^2))*W_m^2*(sum(An*((sinh(n*Pi/lambda)+n*Pi*cosh(n*Pi/lambda)/lambda)*cosh(2*n*Pi*y/a)-2*n*Pi*y*sinh(n*Pi/lambda)*sinh(2*n*Pi*y/a)/a)*cos(2*n*Pi*x/a)/(n^2*(sinh(n*Pi/lambda)*cosh(n*Pi/lambda)+n*Pi/lambda))+Bn*((sinh(n*Pi*lambda)+n*Pi*lambda*cosh(n*Pi*lambda))*cosh(2*n*Pi*x/b)-2*n*Pi*x*sinh(n*Pi*lambda)*sinh(2*n*Pi*x/b)/b)*cos(2*n*Pi*y/b)/(lambda^2*n^2*(sinh(n*Pi*lambda)*cosh(n*Pi*lambda)+n*Pi*lambda)), n = 1 .. n))

Warning,  computation interrupted

 

S := diff(FC, x); SS := diff(S, x)

g := subs(x = (1/2)*a, SS)

0

(1)

coeff(g, sinh(n*Pi/lambda))

0

(2)

``


 

Download diff.mw

The procedure presented here does independence tests of a contingency table by four methods:

  1. Pearson's chi-squared (equivalent to Statistics:-ChiSquareIndependenceTest),
  2. Yates's continuity correction to Pearson's,
  3. G-chi-squared,
  4. Fisher's exact.

(All of these have Wikipedia pages. Links are given in the code below.) All computations are done in exact arithmetic. The coup de grace is Fisher's. The first three tests are relatively easy computations and give approximations to the p-value (the probability that the categories are independent), but Fisher's exact test, as its name says, computes it exactly. This requires the generation of all matrices of nonnegative integers that have the same row and column sums as the input matrix, and for each of these matrices computing the product of the factorials of its entries. So, there are relatively few implementations of it, and perhaps none that do it exactly. (Could some with access check Mathematica please?)

Our own Joe Riel's amazing and fast Iterator package makes this computation considerably easier and faster than it otherwise would've been, and I also found inspiration in his example of recursively counting contingency tables found at ?Iterator,BoundedComposition

ContingencyTableTests:= proc(
   O::Matrix(nonnegint), #contingency table of observed counts 
   {method::identical(Pearson, Yates, G, Fisher):= 'Pearson'}
)
description 
   "Returns p-value for Pearson's (w/ or w/o Yates's continuity correction)" 
   " or G chi-squared or Fisher's exact test."
   " All computations are done in exact arithmetic."
;
option
   author= "Carl Love <carl.j.love@gmail.com>, 27-Oct-2018",
   references= (                                                           #Ref #s:
      "https://en.wikipedia.org/wiki/Pearson%27s_chi-squared_test",         #*1
      "https://en.wikipedia.org/wiki/Yates%27s_correction_for_continuity",  #*2
      "https://en.wikipedia.org/wiki/G-test",                               #*3
      "https://en.wikipedia.org/wiki/Fisher%27s_exact_test",                #*4
      "Eric W Weisstein \"Fisher's Exact Test\" _MathWorld_--A Wolfram web resource:"
      " http://mathworld.wolfram.com/FishersExactTest.html"                 #*5
   )
;
uses AT= ArrayTools, St= Statistics, It= Iterator;
local
   #column & row sums: 
   C:= AT:-AddAlongDimension(O,1), R:= AT:-AddAlongDimension(O,2),
   r:= numelems(R), c:= numelems(C), #counts of rows & columns
   n:= add(R), #number of observations
   #matrix of expected values under null hypothesis (independence):
   #(A 0 entry would mean a 0 row or column in the original, which is not allowed.)
   E:= Matrix((r,c), (i,j)-> R[i]*C[j], datatype= 'positive') / n,
   #Pearson's, Yates's, and G all use a chi-sq statistic, each computed by 
   #slightly different formulae.
   Chi2:= add@~table([
       'Pearson'= (O-> (O-E)^~2 /~ E),                     #see *1
       'Yates'= (O-> (abs~(O - E) -~ 1/2)^~2 /~ E),        #see *2
       'G'= (O-> 2*O*~map(x-> `if`(x=0, 0, ln(x)), O/~E))  #see *3
   ]), 
   row, #alternative rows generated for Fisher's
   Cutoff:= mul(O!~), #cut-off value for less likely matrices
   #Generate recursively all contingency tables whose row and column sums match O.
   #Compute their probabilities under independence. Sum probabilities of all those
   #at most as probable as O. (see *5, *4)
   #Parameters: 
   #   C = column sums remaining to be filled; 
   #   F = product of factorials of entries of contingency table being built;
   #   i = row to be chosen this iteration
   AllCTs:= (C, F, i)->
      if i = r then #Recursion ends; last row is C, the unused portion of column sums. 
         (P-> `if`(P >= Cutoff, 1/P, 0))(F*mul(C!~))
      else
         add(
            thisproc(C - row[], F*mul(row[]!~), i+1), 
            row= It:-BoundedComposition(C, R[i])
         )
      fi      
;
   userinfo(1, ContingencyTableTests, "Table of expected values:", print(E));
   if method = 'Fisher' then AllCTs(C, 1, 1)*mul(R!~)*mul(C!~)/n!
   else 1 - St:-CDF(ChiSquare((r-1)*(c-1)), Chi2[method](O)) 
   fi   
end proc:

The worksheet below contains the code above and one problem solved by the 4 methods


 

 

DrugTrial:= <
   20, 11, 19;
   4,  4,  17
>:

infolevel[ContingencyTableTests]:= 1:

ContingencyTableTests(DrugTrial, method= Pearson):  % = evalf(%);

ContingencyTableTests: Table of expected values:

Matrix(2, 3, {(1, 1) = 16, (1, 2) = 10, (1, 3) = 24, (2, 1) = 8, (2, 2) = 5, (2, 3) = 12})

exp(-257/80) = 0.4025584775e-1

#Compare with:
Statistics:-ChiSquareIndependenceTest(DrugTrial);

hypothesis = false, criticalvalue = HFloat(5.991464547107979), distribution = ChiSquare(2), pvalue = HFloat(0.04025584774823787), statistic = 6.425000000

infolevel[ContingencyTableTests]:= 0:
ContingencyTableTests(DrugTrial, method= Yates):  % = evalf(%);

exp(-1569/640) = 0.8615885805e-1

ContingencyTableTests(DrugTrial, method= G):  % = evalf(%);

exp(-20*ln(5/4)+4*ln(2)-11*ln(11/10)-4*ln(4/5)-19*ln(19/24)-17*ln(17/12)) = 0.3584139703e-1

CodeTools:-Usage(ContingencyTableTests(DrugTrial, method= Fisher)):  % = evalf(%);

memory used=0.82MiB, alloc change=0 bytes, cpu time=0ns, real time=5.00ms, gc time=0ns

747139720973921/15707451356376611 = 0.4756594205e-1

 


 

Download FishersExact.mw

Here's a slightly reduced form of a little module from some code that I posted recently:

KandR:= module()
local
   a, b, c, e, #parameters

   #procedure that lets user set parameter values:
   ModuleApply:= proc({
       a::algebraic:= KandR:-a, b::algebraic:= KandR:-b, 
       c::algebraic:= KandR:-c, e::algebraic:= KandR:-e
   })
   local k;
      for k to _noptions do thismodule[lhs(_options[k])]:= rhs(_options[k]) od;
      return
   end proc
;
end module:

The purpose of the module is simply to be a container for the four parameters and to provide a simple ModuleApply interface by which they can be set, reset, and/or unset. 

I very often use a procedure parameter of a ModuleApply to set a local variable of same name in the module. Because of the name conflict, thismodule needs to be used in these situations. I see this as the primary use of thismodule. In the module above, the purpose of the line 

for k to _noptions do thismodule[lhs(_options[k])]:= rhs(_options[k]) od;

is to avoid the need to explictly use the parameters yet a third time. First off, I am amazed that this works! I've had many disappointments with thismodule (which is essentially undocumented---its miniscule help page is nearly worthless). I am using Maple 2018, release 1. Another Maple 2018 user (not sure which release) reports that the above line gives an error (when executed) that thismodule's index must be a name.

Question 1: What's up with that?

[Edit: It's been determined that the problem was due to an unfortunate global assignment in that user's initialization file rather than different behavior of thismodule. So, I consider Question 1 to be completely answered, and it should be ignored.]

Question 2: The for loop is not entirely satisfying to me. Is there a better way?

[Status: Answered, see below.]

Question 3: Ideally, I'd like to explicity use the four parameters once, not two or three times. Is there a way? If I need to use a container for the parameters (such as a Record), to achieve that, I'd be happy to do that, and I wouldn't mind needing to invoke that container's name any number of times.

[Status: Answered, see below.]

Note that op and exports can be applied to thismodule to extract the module's operands. I have found this occasionally useful.

Question 4: What are some other good uses for thismodule? The one and only example given on its help page seems ridiculous to me.

The docs say that you can assign initial values to a record as shown in this screenshot:

I would expect the last two lines of output to be 1, 2. The slighly more complicated example in the docs does not work as expected either. This is the worksheet: queery.mw

I can assign to a record subsequently, but that makes for very prolix code,

Thanks for any help.

Hello,

I am trying to get Maple to recognize and reverse the product rule in more than one dimension. In one dimension, this works:

Int((Diff(f(x), x))*g(x)+(Diff(g(x), x))*f(x), x) = int((diff(f(x), x))*g(x)+f(x)*(diff(g(x), x)), x);

Int((Diff(f(x), x))*g(x)+(Diff(g(x), x))*f(x), x) = int((diff(f(x), x))*g(x)+f(x)*(diff(g(x), x)), x).

But in two dimensions, it no longer evaluates:

Int((Diff(f(x, y), x))*g(x, y)+(Diff(g(x, y), x))*f(x, y), x) = int((diff(f(x, y), x))*g(x, y)+f(x, y)*(diff(g(x, y), x)), x)

Int((Diff(f(x, y), x))*g(x, y)+(Diff(g(x, y), x))*f(x, y), x) = int((diff(f(x, y), x))*g(x, y)+f(x, y)*(diff(g(x, y), x)), x)

As far as I can tell, mathematically these should be identical (except for the antiderivatives being defined up to a constant in the first case and a function of y in the second). Is there a way to get Maple to reverse the product rule to integrate in more than one dimension? Or am I missing something mathematically that makes this incorrect?

Thanks for your help,

Johnathan

First 40 41 42 43 44 45 46 Last Page 42 of 61