Maple 2015 Questions and Posts

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

Hello,

For example, let's say we have the following function

 

Now if we want to calculate the value of a function we have to

subs([x1=10,x2=20],eval(hf));

My question is the following: How to substitute values for x1 and x2 using values from vector? something like that

x:=[10,20];

subs([x],eval(hf));

 

Best,

Rariusz

 

I have a problem that seems rather simple in theory, yet if implemented in maple there arise problems. I want to solve systems of linear equations that involve roots of unity.

This problem arises when trying to find explicit equations of multivariate polynomials of fixed degree through given points (together with conditions on the derivatives of the curve at these points). In the following case, the points are dented by P[i] and I'm looking for the explicit equation of the degree 9 polynomial through these points. Actually, I know there is a two parameter family of such polynomials, so the solution will be of dimension two.

Sorry for the rather crude implementation.

with(Groebner): with(algcurves): with(LinearAlgebra):

t := exp((1/9)*(2*Pi*I)):
s := exp((1/3)*(2*Pi*I)):
a_1 := -1*t:
a_2 := -s*t:
a_3 := -s^2*t:
P[1] := a_1, 0, 1: P[2] := a_2, 0, 1: P[3] := a_3, 0, 1:
P[4] := 1, t*a_1, 0: P[5] := 1, t*a_2, 0: P[6] := 1, t*a_3, 0:
P[7] := 0, 1, a_1: P[8] := 0, 1, a_2: P[9] := 0, 1, a_3:

G := 0: var1 := 0:
for n from 0 to 9 do
G := G+add(c[k, n-k]*x^k*y^(n-k), k = 0 .. n):
for k from 0 to n do var1 := var1, c[k, n-k]:
end do: 
end do:
F := Homogenize(G, z):
Fx := diff(F, x):
Fy := diff(F, y):
Fz := diff(F, z):
Fxx := diff(F, x, x):
Fxy := diff(F, x, y):
Fyx := Fxy:
Fyy := diff(F, y, y):
Fxz := diff(F, x, z):
Fzx := Fxz:
Fzz := diff(F, z, z):
Fyz := diff(F, y, z):
Fzy := diff(F, z, y):

f := unapply(F, [x, y, z]): fx := unapply(Fx, [x, y, z]): fy := unapply(Fy, [x, y, z]): fz := unapply(Fz, [x, y, z]): fxx := unapply(Fxx, [x, y, z]): fxy := unapply(Fxy, [x, y, z]): fyx := unapply(Fyx, [x, y, z]): fyy := unapply(Fyy, [x, y, z]): fxz := unapply(Fxz, [x, y, z]): fzx := unapply(Fzx, [x, y, z]): fzz := unapply(Fzz, [x, y, z]): fyz := unapply(Fyz, [x, y, z]): fzy := unapply(Fzy, [x, y, z]):

sys := [f(P[1]) = 0, fx(P[1]) = 0, fy(P[1]) = 0, fz(P[1]) = 0, fxy(P[1]) = 0, fxz(P[1]) = 0, fxx(P[1]) = 0, fyy(P[1]) = 0, fzz(P[1]) = 0, fyz(P[1]) = 0, f(P[2]) = 0, fx(P[2]) = 0, fy(P[2]) = 0, fz(P[2]) = 0, fxy(P[2]) = 0, fxz(P[2]) = 0, fxx(P[2]) = 0, fyy(P[2]) = 0, fzz(P[2]) = 0, fyz(P[2]) = 0, f(P[3]) = 0, fx(P[3]) = 0, fy(P[3]) = 0, fz(P[3]) = 0, fxy(P[3]) = 0, fxz(P[3]) = 0, fxx(P[3]) = 0, fyy(P[3]) = 0, fzz(P[3]) = 0, fyz(P[3]) = 0, f(P[4]) = 0, fx(P[4]) = 0, fy(P[4]) = 0, fz(P[4]) = 0, fxy(P[4]) = 0, fxz(P[4]) = 0, fxx(P[4]) = 0, fyy(P[4]) = 0, fzz(P[4]) = 0, fyz(P[4]) = 0, f(P[5]) = 0, fx(P[5]) = 0, fy(P[5]) = 0, fz(P[5]) = 0, fxy(P[5]) = 0, fxz(P[5]) = 0, fxx(P[5]) = 0, fyy(P[5]) = 0, fzz(P[5]) = 0, fyz(P[5]) = 0, f(P[6]) = 0, fx(P[6]) = 0, fy(P[6]) = 0, fz(P[6]) = 0, fxy(P[6]) = 0, fxz(P[6]) = 0, fxx(P[6]) = 0, fyy(P[6]) = 0, fzz(P[6]) = 0, fyz(P[6]) = 0, f(P[7]) = 0, fx(P[7]) = 0, fy(P[7]) = 0, fz(P[7]) = 0, fxy(P[7]) = 0, fxz(P[7]) = 0, fxx(P[7]) = 0, fyy(P[7]) = 0, fzz(P[7]) = 0, fyz(P[7]) = 0, f(P[8]) = 0, fx(P[8]) = 0, fy(P[8]) = 0, fz(P[8]) = 0, fxy(P[8]) = 0, fxz(P[8]) = 0, fxx(P[8]) = 0, fyy(P[8]) = 0, fzz(P[8]) = 0, fyz(P[8]) = 0, f(P[9]) = 0, fx(P[9]) = 0, fy(P[9]) = 0, fz(P[9]) = 0, fxy(P[9]) = 0, fxz(P[9]) = 0, fxx(P[9]) = 0, fyy(P[9]) = 0, fzz(P[9]) = 0, fyz(P[9]) = 0]:
var := [c[0, 0], c[0, 1], c[1, 0], c[0, 2], c[1, 1], c[2, 0], c[0, 3], c[1, 2], c[2, 1], c[3, 0], c[0, 4], c[1, 3], c[2, 2], c[3, 1], c[4, 0], c[0, 5], c[1, 4], c[2, 3], c[3, 2], c[4, 1], c[5, 0], c[0, 6], c[1, 5], c[2, 4], c[3, 3], c[4, 2], c[5, 1], c[6, 0], c[0, 7], c[1, 6], c[2, 5], c[3, 4], c[4, 3], c[5, 2], c[6, 1], c[7, 0], c[0, 8], c[1, 7], c[2, 6], c[3, 5], c[4, 4], c[5, 3], c[6, 2], c[7, 1], c[8, 0], c[0, 9], c[1, 8], c[2, 7], c[3, 6], c[4, 5], c[5, 4], c[6, 3], c[7, 2], c[8, 1], c[9, 0]]:
A, b := GenerateMatrix(sys, var):

Solving this with

simplify(LinearSolve(A, b))

Gives a rather nicely looking solution. But the calculation strongly depends on the form of s, t and the a_i.

For example if we instead define 

s:=t^3:

The computation takes much longer and the result doesn't take a particularly nice form. Similarly if we instead take

a_1 := -t: a_2 := -t^4: a_3 := -t^7:

the computation takes hours / days and the result looks rather ugly (huge coefficients). Yet both of these inputs are mathematically equivalent to the original one.

The thing is that I have similar systems of linear equations that I know must have solutions, but the solution vector that maple puts out has coefficients with thousands of digits (which after the above I suspect to be wrong). I know the systems are vastly overdetermined, but even removing all redundant equations does not solve the problen.

Is there a way to get the correct solutions with maple? Does anyone know whether a different program would handle this problem better?

Hello,

I am trying to do parallel computing by using task programming. In the attached file, I am having the following error:

Error, (in generate) type 'sizeType' does not exist.

The error comes out only when the size of the computation is large enough and so the Threads piece of my "generate" function is run.

Could you please help me to understand what is wrong?

Here is the link to my .mv file: 0927.mw

Thanks.

 

If I have 4 latitude and longitude coordinates in degree.  How can I convert all of them to radian and assign each to a specific variable inside a procedure?

>

> DBP(36.9,102.04,37.345,101.6104)
Error, invalid loop statement termination

attached: WA57dev.mw

Hi!
I'm very new to Maple, so I apologize ahead if this is a stupid question.

It seems that my "Determinant" function is not working properly, as shown in the picture.
I simply defined the matrix M and called for the determinant, as instructed by the help system in Maple.

 

 

Does anyone know what's happening?

Thank you very much.

is there an algorithm to search whether protocol exist for movement of balls in different boxes

for example

assume there are 5 boxes, each box has a variable number of number balls

ball number 1 move from box 1 to box 3 and box 5

then when discover ball number 8 in any box, ball number 1 will disappear

if input data are 5 list of numbers each row

1. [1,2,3],[5,7,12],[12,14,15],[1,5,7,9,15],[12,13,14]

2. [2,3],[5,7,12],[1,12,14,15],[1,5,7,9,15],[1,12,13,14]

....

etc

 

 

I would like to plot h over the real interval from 0 to 2*Pi, but

produces an empty plot...  How can I plot successfully?

If I enter the following I do not get the residue... how do I make the residue command work?

 

is it possible to express rational number into fraction in terms of power of 2

input

2.142857143

output

(2^3+2^2+2+1)/(1+2+2^2)

ode1a := diff(y1(tt),tt) = round(rhs(odeparm1[1][1]))*y1(tt) + round(rhs(odeparm1[1][2]))*y2(tt) + round(rhs(odeparm1[1][3]))*y3(tt);
ode2a := diff(y2(tt),tt) = round(rhs(odeparm1[1][4]))*y1(tt) + round(rhs(odeparm1[1][5]))*y2(tt) + round(rhs(odeparm1[1][6]))*y3(tt);
ode3a := diff(y3(tt),tt) = round(rhs(odeparm1[1][7]))*y1(tt) + round(rhs(odeparm1[1][8]))*y2(tt) + round(rhs(odeparm1[1][9]))*y3(tt);
sys := subs(y3(tt)=1,[ode1a,ode2a]);
print(DEplot(sys, [y1(tt), y2(tt)], tt = 0 .. 16, y1 = -16 .. 16, y2 = -16 .. 16, color = magnitude, title = `Stable Limit Cycles`, arrows = curve, dirfield = 800, axes = none));

 

how to mirror the vector field graph mathematically?

mirror the graph about x=0 this line,

so that the graph looked flip

i find curl can do, but how to do ?

 

restart;
with(VectorCalculus):
SetCoordinates('cartesian'[x(t), y(t), z(t)]);
Curl((x(t),y(t),z(t)),(Diff(x(t),t) - a11*x(t) - a12*y(t) - a13*z(t),Diff(x(t),t) - a21*x(t) - a22*y(t) - a23*z(t),Diff(x(t),t) - a31*x(t) - a32*y(t) - a33*z(t)));
Error, (in VectorCalculus:-SetCoordinates) coordinate system `cartesian[x(t), y(t), z(t)]` does not exist
Error, (in Vector) dimension parameter is required for this form of initializer

 

Hello everybody

I'm using discrete distributions from the Statistics package and I found a rather strange result.

In short the theoritical values of some statistics of a NegativeBinomial(1, P) Random Variable (P being the probability of success equal to 1e-4) are correctly computed, but their empirical estimators computed from a sample of this RV are roughly wrong.

For NegativeBinomial(1, P) is similar to Geometric(P) I asked Maple to compute the theoritical values of some statistics of Geometric(P) and next to assess their empirical values from a sample of Geometric(P).
Some discrepancies still remain but they can be explained by statistical fluctuations.

Could you please look to the attached file (an error on my part is still possible) and help me to fix this ?

Thanks in advance


PS : the histogram of Sample(NegativeBinomial(K, P), AnySizeYouWant) is obviously wrong (it should look like a decreasing exponential) 


 

Download NegativeBinomial.mw

Dear all,

I'm trying to plot dispersion curves in Maple but I'm having some trouble. The code is attached as a file also.

f1  is my main function and I want to plot Vx with regard to f as all the rest are known variables, but I'm not able to do so.

I hope that someone can tell me why do I have this error.

Thanks in advance!

restart;
f1 := (C33*Rp*kzp+C13*kx)*(Rm*kx+kzm)*sin(kzp*h)*cos(kzm*h)-(C33*Rm*kzm-C13*kx)*(Rp*kx+kzp)*sin(kzm*h)*cos(kzp*h)=0;
Rp := (-C11*kx^2-C55*kzp^2+omega^2*rho)/((C55+C13)*kx*kzp);
Rm := (-C11*kx^2-C55*kzm^2+omega^2*rho)/((C55+C13)*kx*kzm);
kzp := sqrt(((-M+sqrt(M^2-4*N))*(1/2))*kx^2);
kzm := sqrt(((-M-sqrt(M^2-4*N))*(1/2))*kx^2);
M := (C11*C33/rho^2-2*C55*C13/rho^2+C13^2-omega^2*(C33+C55)/(rho*kx^2))*rho^2/(C33*C55);
N := (omega^2/kx^2-C11/rho)*(omega^2/kx^2-C55/rho)*rho^2/(C33*C55);
C11 := 0.435e10;
C13 := 0.259e10;
C55 := 0.112e10;
C33 := 0.108e11;
rho := 923;
h := 0.7e-2*(1/2);
kx := omega/Vx;
omega := 2*Pi*f;
f1;
plot(f1, f = 10 .. 0.100e6);
Error, (in plot) unexpected options: [(.4633081900*(-0.1717311166e12*f^2/Vx^2-0.2210791386e11*(...

Asim_dispers.mw

From clues:
a1 := subs(y=n,1/y!*x^y); # diff make it equal to the left term
a2 := subs(y=n-1,1/y!*x^y);
simplify(factor(a1 - a2));
 
To find limit of below
nterm := sum(tanh(product(sum(kk, kk=1..jj),jj=1..y))*1/y!*x^y, y=n..n);
n2term := sum(tanh(product(sum(kk, kk=1..jj),jj=1..y))*1/y!*x^y, y=(n+1)..(n+1));
simplify(factor(n2term - nterm));
simplify(limit((subs(x=x+h, n2term)-n2term)/h, h=0)) = nterm;
 
question is to find a limit make n2term equal nterm after calculation

unknown := sum(exp(product(sum(kk, kk=1..jj),jj=1..y))*1/y!*x^y, y=0..infinity):
evalf(subs(x=1, unknown));
plot(unknown, x=-3..3, numpoints = 5);
 

Dear friends!

Hope you would be fine. I want to solve the following system of ODEs

restart; L := 1; with(plots); Digits := 30;

a[1] := 0; a[2] := 1; a[3] := 2; a[4] := .2; a[5] := 4; a[6] := 6;

S := 1; Pr := 6.2; a := 1; a1 := 1; a2 := 1; lambda := 1; delta := 1; Bi := 1; A := 1; B := 1;

HA := [a[1], a[2], a[3]];

Eq1 := diff(F(eta), eta, eta, eta)+a*(a1*((F(eta)+G(eta))*(diff(F(eta), eta, eta))-(diff(F(eta), eta))^2)-M1*(diff(F(eta), eta))) = 0;

Eq2 := diff(G(eta), eta, eta, eta)+a*(a1*((F(eta)+G(eta))*(diff(G(eta), eta, eta))-(diff(G(eta), eta))^2)-M1*(diff(G(eta), eta))) = 0;

Eq3 := (A+B)*(diff(H(eta), eta, eta))+a2*Pr*(F(eta)+G(eta))*(diff(H(eta), eta)) = 0;

IC1 := F(0)+G(0)=0, (D(F))(0) = 1+delta*((D@@2)(F))(0), (D(G))(0) = lambda+delta*((D@@2)(G))(0), (D(H))(0) = -Bi*(1-H(0)), (D(F))(L) = 0, (D(G))(L) = 0, H(L) = 0;

params := {B111 = .2};
associated with the above (mentioned as red) boundary conditions. The problem which I faced in first condition i.e., F(0)+G(0)=0 because its combine condition for F(eta) and G(eta) which should be use for both function. The rest part of my program is below:

for k to nops(HA) do;

P || k := plots:-odeplot(dsolve(eval({Eq1, Eq2, Eq3, IC1}, `union`(params, {M1 = .5, phi = HA[k]})), numeric), [[eta, diff(F(eta), eta)]], linestyle = [solid, solid, solid, solid][k], color = [red, green, blue, red][k], labels = [eta, f], thickness = 3) end do;

f1 := plots:-display(P || (1 .. nops(HA)));

display(f1, axes = boxed, size = [380, 310], title = "Ethylene glycol/Cu: M = 2, S = -5", titlefont = ["Arial", 12, bold]);

Please fix my problem ASAP. I also attach the maple file. Thanks in advance.

Help.mw

3 4 5 6 7 8 9 Last Page 5 of 50