Maple 2018 Questions and Posts

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


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)+`τ__q`*(diff(q__x(x, y, z, t), t))+(1/2)*`τ__q`^2*(diff(q__x(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), x))-k*`τ__T`*(diff(T(x, y, z, t), x, t))-(1/2)*k*`τ__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)+`τ__q`*(diff(q__y(x, y, z, t), t))+(1/2)*`τ__q`^2*(diff(q__y(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), y))-k*`τ__T`*(diff(T(x, y, z, t), y, t))-(1/2)*k*`τ__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)+`τ__q`*(diff(q__z(x, y, z, t), t))+(1/2)*`τ__q`^2*(diff(q__z(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), z))-k*`τ__T`*(diff(T(x, y, z, t), z, t))-(1/2)*k*`τ__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?

 

Update

I am not sure what happened, but now after starting Maple, these PDE's no longer hang. Even though I tried them before number of times before posting to make sure.  This is strange. I do not know what happened.

Any way, there is no issue any more. These do not hang in version 319.

original post

Hello Maple experts.

FYI, I noticed some pde's are no longer solved (hang) after downloading latest physics package cloud version 319, when before when using version 301 these were solved.

version()
 User Interface: 1362973
         Kernel: 1362973
        Library: 1362973
                            1362973
Physics:-Version()
 "C:\Maple_updates\Physics_Updates_319.maple", 2019, March 3, 
    17:7 hours, version in the MapleCloud: 319, version installed in this 
    computer: the "Physics Updates" is not  installed.

Any idea why this happened? It is possible this is due to bug fix of course, but thought to point this out.

These PDE's were solved with Maple 2018.2.1 with Physics ver. 301 but not in ver. 319

#now not solved or hangs, before it was solved in 7 seconds
pde := diff(u(x, t), t) = (1/20)*(diff(u(x, t), x$2))+t;
bc := u(0, t) = 5, (u(1, t)+ eval( diff(u(x,t),x),x=1)) = 10;
ic:= u(x, 0) = -40*x^2/3+45*x/2+5;
pdsolve([pde, bc,ic], u(x, t));

#now it hangs, before it was solved in 0.2 seconds
pde :=  (A*y^2+B*x^2-a^2*B)*diff(w(x,y),x)+(C*y^2+2*B*x*y)*diff(w(x,y),y) = 0;
pdsolve(pde,w(x,y));

#now hangs when it was solved before in 5 seconds
pde := 2*diff(w(x,y),x)+((lambda+a-a*sin(lambda*x))*y^2 +lambda -a -a*sin(lambda*x))*diff(w(x,y),y) = 0;
pdsolve(pde,w(x,y));

#now hangs when it was solved before in 1.8 seconds
pde := diff(w(x,y),x)+((lambda+a*sin(lambda*x)^2)*y^2 + lambda -a +a*sin(lambda*x)^2)*diff(w(x,y),y) = 0;
pdsolve(pde,w(x,y));

Using windows 10.

 

How do I remove Array B from Array A? e.g.

A:=Array([1,2,3,4,5,6,7,8...1000]
B:=Array([3,6,9,12,15....])   assuming A contains all the elements of B.

to get [1,2,4,5,7,8,11....]

Also is it possible to do it in place?

.I am testing out the MutableSet command, There seems to be a problem with the number of emements that can be operated on. When N =100000 things are ok. When N=1000000 (or there abouts) the process doesn't terminate last line. Uorks ok for sets. Using Maple 2018.2 on Win10 64bit.


 

restart

N := 900000

900000

(1)

A := {seq(i^2, i = 1 .. N)}

B := {seq(A[i+1]-A[i], i = 1 .. nops(A)-1)}

``

``

C := MutableSet(seq(i^2, i = 1 .. N))

module MutableSet () local storage; global MutableSet; option object; end module

(2)

upperbound(C)

900000

(3)

MutableSet(seq(C[i+1]-C[i], i = 1 .. N-1))

``


 

Download Mutable_set_issue.mw

Hello every one,

My slideshow now contains a lot of animation sequences and take
a very long time to load and a large amount of physical memory (>20GB).

To reduce this size I have decided to convert these animations to GIF format.
Unfortunatly Maple/MaplePayer do not play GIF animations.

I decide to put URLs (image icons pointing to GIF files) in the document.
Now the GIF are play by a WEB browser (program to operate in fullscreen 
mode to minimize any disturbance in the audience with IE11).

Now the issue:
Using F11 to start the Slideshow, cliking the URL start the browser with the requested
animated GIF, that is fine, but now Maple/MaplePayer both auto-exit fullscreen
mode just after that click. The speaker (me) now need to manage the return to
fullscreen (F11) at the current slide while
thinking about what i have to
say next.

Is there any trick to prevent auto-exit from fulls-screen mode in this situation?

Thank you for your help

LL

 

Des suggestions de solutions? Merci.

A) a) Écrire une procédure qui produit une itération du calcul babylonien de la racine carrée d'un nombre positif k à partir     d'une première approximation x0 .

    Entrée: k , x0 .

    Sortie:  x1 = (x0+ k/x0)/2 .

b) En utilisant la procédure trouvée en a), en écrire une autre, qui prend en entrée un entier positif n en plus des entiers k   et x0 vus en a) et qui retourne en sortie n itérations du calcul babylonien de la racine carée de k.

 B)

Écrire une procédure récursive Maple qui prend en entrée deux nombres n et k et qui utilise l'identité (n k) = (n -1k)+(n-1 k-1) pour retourner en sortie le coefficient binomial (n k) , cette procédure ne doit pas utiliser la commande Maple binomial.

TRADUCTION:

Suggestions for solutions? Thank you.

A) a) Write a procedure that produces an iteration of the Babylonian calculus of the square root of a positive number k from a     first approximation x0.

    Input: k, x0.

   Output: x1 = (x0 + k / x0) / 2.

b) Using the procedure found in a), write another one, which takes as input a positive integer n in addition to the integers k and   x0 seen in a) and which returns in exit n iterations of the Babylonian calculation of the square root of k.

B) Write a Maple recursive procedure that takes as input two numbers n and k and uses the identity (n k) = (n-1 k)+ (n-1 k-1) to   return the binomial coefficient (n k), this procedure should not use the binomial Maple command.

First 29 30 31 32 33 34 35 Last Page 31 of 61