Maple 2018 Questions and Posts

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

I discovered incidentally that the command  Matrix(3, 3, `-`) (the number 3 is purely illustrative) returned the same result than the command Matrix(3, 3, (i,j) -> i-j).
In the same way `+` realizes (i,j) -> i+j), `*` realizes (i,j) -> i*j), ...

More surprisingly `.` realizes (i,j) -> i*j while I'm in worksheet mode, with "old" maple input style, and that the command 2.3 does not answer 6 but concatenates 2 and 3.

Is this a known behaviour or an undocumented feature?

 

 

 

 

 

Hello,

I am attempting to check solutions to a system of ODEs using odetest. However, odetest only appears to partially substitute the provided solution. Furthermore, it appears to be related to the alphabetical order of the functions.

For instance, here I have two functions, phiL and phiM, that satisfy Laplace's equation and are coupled through the boundary conditions, BCs.

laplace := {-phiL(z) + diff(phiL(z),z$2)=0, -phiM(z) + diff(phiM(z),z$2)=0}:
BCs := {phiL(d1)=0,phiM(-d1)=0,phiL(0)=phiM(0), D(phiL)(0)-D(phiM)(0)=-n}:
sol := {
phiM(z) = n/2/coth(d1)*(cosh(z)+coth(d1)*sinh(z)),
phiL(z) = n/2/coth(d1)*(cosh(z)-coth(d1)*sinh(z))
}:

odetest(sol, laplace union BCs,{phiL(z),phiM(z)});

This returns

{0, 1/2*(2*phiL(0)*coth(d1)-n)/coth(d1), D(phiM)(0)-1/2*n}

Here, phiL(0) and phiM(0) are unevaluated even though the provided solutions are valid there.

Furthermore, while renaming phiL to an alphabetically earlier name (eg, phiJ) causes the corresponding change in the output. However, renaming it to something alphabetically after phiM (eg, phiN) causes the terms in the output to switch. That is, changing phiL to phiN in the above code results in

{0, 1/2*(2*phiM(0)*coth(d1)-n)/coth(d1), D(phiN)(0)+1/2*n}

Therefore, it seems to be related to the way Maple internally stores the list of variables.

Is this a bug? Or is there something I'm missing?

Thanks!

My question has two steps:

STEP 1:  The multiplication  of is defined as follows

 

if n<>l, then

.

if n=l and m<=s,

Question 1: I wrote a code for calculating the multiplication  of. Is it right?

The code for Step 1  

restart;

multiply:=proc(n,m,l,s) local g,a: 
a:=unapply(doublefactorial(2*j-1)/factorial(j),j):
g:=unapply((a(m-j)*a(j)*a(s-j)/a(m+s-j))*(2*m+2*s-4*j+1)/(2*m+2*s-2*j+1),j):

if n<>l then 0 else
sqrt((2*m+1)*(2*s+1))*2^(K/2-1).add((g(j)/sqrt(m+s-2*j+1/2))*phi[n, m+s-2*j],j=0..m) 
end if
end proc:
 
n:=2:
l:=2:
m:=1:
s:=1:
multiply(n,m,l,s);

when I compared the results which I got and the results which is given in the book as follows, I think it is right.

Step 2:

We know that the outer product matrix is calculated as follows 

  

We found the elements of the outer product matrix in Step 1. 

Question 2 : I want to write the elements which are derived in step 1 to the outer product matrix in step 2. In here, the outer product matrix is NxN matrix. N=(M+1).2^(K-1) where K, M are any integers.

Hello

Could you please help me to solve the following problem

I want to catch the optimized values for df, tf, hw, and tw using considered constraint.

Thank you very much.

Dear Community,

 

I'm trying to import a simple Excel (xlsx) file into my Maple worksheet.

1st problem: Maple reads it only, if I put it into my root directory. As soon as I try to read it from the directory I'm working in, and provide full file name (Path + file name)  it fails. Why?

2nd problem: The real surprise comes, when I manage to import it. Its a 150 x 2 matrix, but as soon as I try to retrieve a value, I get an error message "Error, bad index into Matrix". Why is this? Should be very simple. Files attached.

 

Tx in advance

best regards

Andras

ImportTest.mw

RC_Rate_Schedule.xlsx


Suggestions for a Maple program entering the coordinates of three points and giving the equation of the circle passing through these three points, non-aligned?
Thank you.

 

 

This application solves a set of compatible equations of two variables. It also graphs the intersection point of the variable "x" and "y". If we want to observe the intersection point closer we will use the zoom button that is activated when manipulating the graph. If we want to change the variable ("x" and "y") we enter the code of the button that solves and graphs. In spanish.

System_of_Equations_Determined_Compatible_2x2_and_3x3.mw

Lenin Araujo Castillo

Ambassador of Maple


Hello everyone! 

I have the following Maple code: 

with(CurveFitting); with(plottools); with(Statistics); A := [[1.364, 0.64765768e-1], [2.05, -.182176113], [2.664, -0.13914542e-1], [2.728, 0.2193938e-1], [4.092, -0.18349139e-1], [4.1, -.312968801], [5.328, -0.1819837e-2], [5.456, -.28840961], [6.15, -.57076866], [7.992, .175022254]];
F := LeastSquares(A, x);
plot([F, A], x = 0 .. 8, legend = ["Метод наименьших квадратов", "Экспериментальные данные"], legendstyle = [font = ["Roman", 15]], labels = ["d, ìì", "ln(I/I_0)"], labelfont = ["Roman", 15], labeldirections = ["horizontal", "vertical"], axesfont = ["ROMAN", "ROMAN", 15], color = [red, blue], style = [line, point], linestyle = [solid], symbolsize = 20, title = "Определение линейного коэффициента поглощения", titlefont = [Roman, bold, 20]);

This produces a plot:

How can I add error bars to the points that are colored in blue?

Thank you in advance for any help!

Hello all,

I'm trying to do kinetic modeling of sequential dissociations with DE. I'm hitting a snag when modeling the third dissociation. The population should start at zero at t=0, but some of my model functions are non-zero at t=0. Is there anyway to fix this to force the funtions to go through zero?

Scheme:
PPPP -> intermediates -> PPP -> intermediates -> PP -> intermediates -> P  
(where P is a subunit and intermediates are confirmational changes before dissociation of a subunit)

a'..d' is the first dissociation
e' is the second dissociation
f'..l' is the third dissociation
Fits are evaluated by the residual sum of squares.

sol := dsolve([a' = -k1*a(x), b' = k1*a(x)-k1*b(x), c' = k1*b(x)-k1*c(x), d' = k1*c(x)-k1*d(x),
e' = k1*d(x)-k2*e(x), 
f' = k2*e(x)-k3*f(x), g' = k3*f(x)-k3*g(x), h' = k3*g(x)-k3*h(x), i' = k3*h(x)-k3*i(x), j' = k3*i(x)-k3*j(x), k' = k3*j(x)-k3*k(x), l' = k3*k(x)-k3*l(x), 
a(0) = 1, b(0) = 0, c(0) = 0, d(0) = 0, e(0) = 0, f(0) = 0, g(0) = 0, h(0) = 0, i(0) = 0, j(0) = 0, k(0) = 0, l(0) = 0],
{a(x), b(x), c(x), d(x), e(x), f(x), g(x), h(x), i(x), j(x), k(x), l(x)}, method = laplace);

f1 := sol[6];
f1 := rhs(f1);
g1 := sol[7];
g1 := rhs(g1);
h1 := sol[8];
h1 := rhs(h1);
i1 := sol[9];
i1 := rhs(i1);
j1 := sol[10];
j1 := rhs(j1);
kk := sol[11];
kk := rhs(kk);
l1 := sol[12];
l1 := rhs(l1);

xdata := Vector([0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400], datatype = float);
ydata := Vector([0.0034,0.00392,0.00184,0.00782,0.01873,0.03683,0.11016,0.09838,0.18402,0.24727,0.20901,0.2972,0.37635,0.49235,0.57845,0.4457,0.50285,0.5672,0.62783,0.57264,0.54918,0.44792,0.49795,0.55218,0.47512,0.46473,0.37989,0.32236,0.3323,0.20894,0.28473,0.21273,0.19855,0.13548,0.12725,0.13277,0.0784,0.07969,0.06162,0.03855], datatype = float);

k1 := 0.391491454107626e-1; 
k2 := 0.222503562261129e-1; 


z1:=f1;
z2:=f1+g1;
z3:=f1+g1+h1;
z4:=f1+g1+h1+i1;
z5:=f1+g1+h1+i1+j1;
z6:=f1+g1+h1+i1+j1+kk;
z7:=f1+g1+h1+i1+j1+kk+l1;

Statistics[NonlinearFit](z1,xdata, ydata, x, initialvalues = [k3=0.1], output = [parametervalues, residualsumofsquares]); 
A:=plot(xdata, ydata, style=point, symbol=solidcircle, color=blue, symbolsize=12,labels = ["time (minutes)", "Relative Abundance"], labeldirections = [horizontal, vertical]):
F:=Statistics[NonlinearFit](z1,xdata, ydata, x,initialvalues = [k3=0.1]):
B:=plot(F, x=xdata[1]..xdata[-1], color=red):
plots[display](A, B);

Statistics[NonlinearFit](z2,xdata, ydata, x, initialvalues = [k3=0.1], output = [parametervalues, residualsumofsquares]); 
A:=plot(xdata, ydata, style=point, symbol=solidcircle, color=blue, symbolsize=12,labels = ["time (minutes)", "Relative Abundance"], labeldirections = [horizontal, vertical]):
F:=Statistics[NonlinearFit](z2,xdata, ydata, x,initialvalues = [k3=0.1]):
B:=plot(F, x=xdata[1]..xdata[-1], color=red):
plots[display](A, B);

Statistics[NonlinearFit](z3,xdata, ydata, x, initialvalues = [k3=0.1], output = [parametervalues, residualsumofsquares]); 
A:=plot(xdata, ydata, style=point, symbol=solidcircle, color=blue, symbolsize=12,labels = ["time (minutes)", "Relative Abundance"], labeldirections = [horizontal, vertical]):
F:=Statistics[NonlinearFit](z3,xdata, ydata, x,initialvalues = [k3=0.1]):
B:=plot(F, x=xdata[1]..xdata[-1], color=red):
plots[display](A, B);

Statistics[NonlinearFit](z4,xdata, ydata, x, initialvalues = [k3=0.1], output = [parametervalues, residualsumofsquares]); 
A:=plot(xdata, ydata, style=point, symbol=solidcircle, color=blue, symbolsize=12,labels = ["time (minutes)", "Relative Abundance"], labeldirections = [horizontal, vertical]):
F:=Statistics[NonlinearFit](z4,xdata, ydata, x,initialvalues = [k3=0.1]):
B:=plot(F, x=xdata[1]..xdata[-1], color=red):
plots[display](A, B);

Statistics[NonlinearFit](z5,xdata, ydata, x, initialvalues = [k3=0.1], output = [parametervalues, residualsumofsquares]); 
A:=plot(xdata, ydata, style=point, symbol=solidcircle, color=blue, symbolsize=12,labels = ["time (minutes)", "Relative Abundance"], labeldirections = [horizontal, vertical]):
F:=Statistics[NonlinearFit](z5,xdata, ydata, x,initialvalues = [k3=0.1]):
B:=plot(F, x=xdata[1]..xdata[-1], color=red):
plots[display](A, B);

Statistics[NonlinearFit](z6,xdata, ydata, x, initialvalues = [k3=0.1], output = [parametervalues, residualsumofsquares]); 
A:=plot(xdata, ydata, style=point, symbol=solidcircle, color=blue, symbolsize=12,labels = ["time (minutes)", "Relative Abundance"], labeldirections = [horizontal, vertical]):
F:=Statistics[NonlinearFit](z6,xdata, ydata, x,initialvalues = [k3=0.1]):
B:=plot(F, x=xdata[1]..xdata[-1], color=red):
plots[display](A, B);

Statistics[NonlinearFit](z7,xdata, ydata, x, initialvalues = [k3=0.1], output = [parametervalues, residualsumofsquares]); 
A:=plot(xdata, ydata, style=point, symbol=solidcircle, color=blue, symbolsize=12,labels = ["time (minutes)", "Relative Abundance"], labeldirections = [horizontal, vertical]):
F:=Statistics[NonlinearFit](z7,xdata, ydata, x,initialvalues = [k3=0.1]):
B:=plot(F, x=xdata[1]..xdata[-1], color=red):
plots[display](A, B);

3rd_diss.mw

Dear All,

Gretting from me. I have faced a problem in Maple program due to some errors. Could you please help me about the solution of that problem?
Thanks

@Preben Alsholm
@tomleslie
Sourse File: solution.mw

Duo:=proc(a)  #a nombre congruent connu
local u,v,n,m,k,t:
t:=8000:
for m to t do
  for n to m do
    if (igcd(m,n)=1 and m>n) then
      u:=(m^2-n^2-2*m*n)^2:v:=(m^2+n^2)^2:
      k:=op(2,sqrt(v-u))^2: # k nombre congruent réduit
        if k=a then return (m,n): break 
        elif n=t then break fi:
    fi:
  od:
od:
end:

Duo(30);
                              3, 2
Duo(1794);
                             26, 23
Duo(6);
                              2, 1
u, v, w sont des carrés en progression arithmétique dont la raison est un nombre congruent
Procédure permettant de trouver un triplet pythagoricien primitif correspondant au nombre congruent a connu
TriPy:=proc(m,n)# triangles pythagoriciens
local a,a1,b1,c1,d,k,q,u,v,w:
 if (igcd(m,n)=1 and m>n) then
 u:=(m^2-n^2-2*m*n)^2:v:=(m^2+n^2)^2:w:=(m^2-n^2+2*m*n)^2:
 a:=(op(2,sqrt(v-u)))^2:#nombre congruent réduit
 a1:=2*m*n:b1:=(m^2-n^2):c1:=m^2+n^2:
 q:=sqrt((v-u)/a)/2:#rapport de réduction
 print(a1/q,b1/q,c1/q):fi
end:
TriPy(Duo(34));
                              17  145
                          24, --, ---
                              6    6 

TriPy(Duo(39));
                          156  5  313
                          ---, -, ---
                           5   2  10 

TriPy(Duo(111));
                         444  35  1513
                         ---, --, ----
                         35   2    70 
TriPy(Duo(1794));
                         1196      1205
                         ----, 21, ----
                          7         7  
TriPy(Duo(23));don't work, "part dans les choux"

How  I can use from equations 1-6 and repleacing them into equation 7 to remove qx,qy,qz?

Thank you

simpl2.mw
 

A := q__x(x, y, z, t)+`&tau;__q`*(diff(q__x(x, y, z, t), t))+(1/2)*`&tau;__q`^2*(diff(q__x(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), x))-k*`&tau;__T`*(diff(T(x, y, z, t), x, t))-(1/2)*k*`&tau;__T`^2*(diff(T(x, y, z, t), x, t, t))
NULL

q__x(x, y, z, t)+tau__q*(diff(q__x(x, y, z, t), t))+(1/2)*tau__q^2*(diff(diff(q__x(x, y, z, t), t), t)) = -k*(diff(T(x, y, z, t), x))-k*tau__T*(diff(diff(T(x, y, z, t), t), x))-(1/2)*k*tau__T^2*(diff(diff(diff(T(x, y, z, t), t), t), x))

(1)

A__x := diff(A, x)

diff(q__x(x, y, z, t), x)+tau__q*(diff(diff(q__x(x, y, z, t), t), x))+(1/2)*tau__q^2*(diff(diff(diff(q__x(x, y, z, t), t), t), x)) = -k*(diff(diff(T(x, y, z, t), x), x))-k*tau__T*(diff(diff(diff(T(x, y, z, t), t), x), x))-(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), x), x))

(2)

NULL

B := q__y(x, y, z, t)+`&tau;__q`*(diff(q__y(x, y, z, t), t))+(1/2)*`&tau;__q`^2*(diff(q__y(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), y))-k*`&tau;__T`*(diff(T(x, y, z, t), y, t))-(1/2)*k*`&tau;__T`^2*(diff(T(x, y, z, t), y, t, t))

q__y(x, y, z, t)+tau__q*(diff(q__y(x, y, z, t), t))+(1/2)*tau__q^2*(diff(diff(q__y(x, y, z, t), t), t)) = -k*(diff(T(x, y, z, t), y))-k*tau__T*(diff(diff(T(x, y, z, t), t), y))-(1/2)*k*tau__T^2*(diff(diff(diff(T(x, y, z, t), t), t), y))

(3)

B__y := diff(B, y)

diff(q__y(x, y, z, t), y)+tau__q*(diff(diff(q__y(x, y, z, t), t), y))+(1/2)*tau__q^2*(diff(diff(diff(q__y(x, y, z, t), t), t), y)) = -k*(diff(diff(T(x, y, z, t), y), y))-k*tau__T*(diff(diff(diff(T(x, y, z, t), t), y), y))-(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), y), y))

(4)

NULL

C := q__z(x, y, z, t)+`&tau;__q`*(diff(q__z(x, y, z, t), t))+(1/2)*`&tau;__q`^2*(diff(q__z(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), z))-k*`&tau;__T`*(diff(T(x, y, z, t), z, t))-(1/2)*k*`&tau;__T`^2*(diff(T(x, y, z, t), z, t, t))

q__z(x, y, z, t)+tau__q*(diff(q__z(x, y, z, t), t))+(1/2)*tau__q^2*(diff(diff(q__z(x, y, z, t), t), t)) = -k*(diff(T(x, y, z, t), z))-k*tau__T*(diff(diff(T(x, y, z, t), t), z))-(1/2)*k*tau__T^2*(diff(diff(diff(T(x, y, z, t), t), t), z))

(5)

C__z := diff(C, z)

diff(q__z(x, y, z, t), z)+tau__q*(diff(diff(q__z(x, y, z, t), t), z))+(1/2)*tau__q^2*(diff(diff(diff(q__z(x, y, z, t), t), t), z)) = -k*(diff(diff(T(x, y, z, t), z), z))-k*tau__T*(diff(diff(diff(T(x, y, z, t), t), z), z))-(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), z), z))

(6)

NULL

expand(simplify(-A__x-B__y-C__z+Q = rho*c__p*(diff(T(x, y, z, t), t))))

(-(diff(q__x(x, y, z, t), x))-tau__q*(diff(diff(q__x(x, y, z, t), t), x))-(1/2)*tau__q^2*(diff(diff(diff(q__x(x, y, z, t), t), t), x))-(diff(q__y(x, y, z, t), y))-tau__q*(diff(diff(q__y(x, y, z, t), t), y))-(1/2)*tau__q^2*(diff(diff(diff(q__y(x, y, z, t), t), t), y))-(diff(q__z(x, y, z, t), z))-tau__q*(diff(diff(q__z(x, y, z, t), t), z))-(1/2)*tau__q^2*(diff(diff(diff(q__z(x, y, z, t), t), t), z))+Q = k*(diff(diff(T(x, y, z, t), x), x))+k*tau__T*(diff(diff(diff(T(x, y, z, t), t), x), x))+(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), x), x))+k*(diff(diff(T(x, y, z, t), y), y))+k*tau__T*(diff(diff(diff(T(x, y, z, t), t), y), y))+(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), y), y))+k*(diff(diff(T(x, y, z, t), z), z))+k*tau__T*(diff(diff(diff(T(x, y, z, t), t), z), z))+(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), z), z))+Q) = rho*c__p*(diff(T(x, y, z, t), t))

(7)

NULL

``


 

Download simpl2.mw

 

Dear Community,

I would like to have a 3D matrix, where each of the matrix elements is a collection of different kind of data, e.g. integers, real (float) numbers, logical variable, 1D vector of integers or reals, 1D vector of logical variables, etc. In other words I would like to store a collection of different data on a 3D grid. This collection is of course identical for all grid points, i.e. matrix elements. I experimented with DataFrames, but it did not allow me to use vectors. How could I realize such a structure in Maple? It is done quite easily in MATLAB e.g. with the "struct" command, or in FORTRAN with the "Type" command.

Many tx in advance,

best regards

Andras

 

Suppose that (x1, x2, . . . , xn) is a sequence of real numbers. The mean μ and the standard deviation σ are defined as
μ= n(x1 +x2 +...+xn);

σ=√[(1/2)n[(x1 −μ) +(x2 −μ) +...+(xn −μ) ]]


1. Suppose that n = 20 and xk = k for all k. Write for loops to determine the mean and the standard deviation of the sequence.

2. Suppose that n = 30 and xk = k3 for all k. Write for loops to determine the mean and the standard deviation of the sequence.

I've been trying to learn how to do Grid-based parallelization in Maple, but I've been running into a weird error.

Suppose I run the following simple Grid code, which just runs on a single node:

X := [1, 2, 3, 4]; babyGrid := proc (X) [Grid:-MyNode(), X] end proc; Grid:-Launch(babyGrid, X);

 I get this error:

Error, (in Grid:-Launch) invalid input: Launch expects its 7th argument, exports, to be of type ({list, set})({name, string}), but received [1, 2, 3, 4]

So for some reason it assumes that X is the exports variable. This error goes away if I instead make X an array X:=Array([1,2,3,4])

In this case the code runs fine and produces the expected output.

What's the difference here? Is there a reason that Grid can't take list arguments? Is there a reason this is so obvious that it isn't documented?

 

First 9 10 11 12 13 14 15 Last Page 11 of 41