Maple 2015 Questions and Posts

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

Often after using collect(expression,x) the prefactors of x are within a bracket but typically contain factors in each term of the bracket that are equal and not pulled out of the bracket. Is there a way to ask maple to automatically factor out these after collecting?

I hope it is clear what I mean...

Hello everyone,

First I want to thank you for paying attention to my post.

I'm trying to determine the maximum of the following function:

Maple Code:

(1/4)*(-1/4+alpha*(-1+b)*e^2+((1-b)*alpha+(1/4)*b)*e)^2/((-1+e)^2*(b*e-1)*alpha*e*(-1+b))(1/4)*(-1/4+alpha*(-1+b)*e^2+((1-b)*alpha+(1/4)*b)*e)^2/((-1+e)^2*(b*e-1)*alpha*e*(-1+b))

e is my variable and I want to study it in [0,1[. I have a several parameters restriction like b in [0,1[ and alpha>1.

When I value this function for specific values (b=0.1, alpha=4 for instance) I get the equation and its associated graphic representation:

Maple Code:

-0.6944444445e-1*(-1/4-3.6*e^2+3.625000000*e)^2/((-1+e)^2*(.1*e-1)*e)

 

 

I'm only interested in the domain where e is betweeen 0 and 1. I clearly on the graph see that there is a maximum and when 1) I compute roots of the expression I get 2) following solutions:

1)

2) 

    0.9324708634, 0.07447358108, 0.6965691592, 1.345632810, 

      -0.07419084270.

Here: 0.6965691592 corresponds to the maximum I'm looking for.

So now when I try to get a generalization of this function according to my parameters and when I compute the first derivative with respect to e

1)

 

2) 

3)...

the last is very big so I do not write it here.

To sum-up: I see that the solution I'm looking for exists but when it comes to use parameters I cannot define correct roots.

Hello dear!

Hope you all are fine. I am trying to sloution the system of nonlinear system of ODEs (see attached file) but my solutions not converging please see and fix the problem. I am waiting your quick response.

Graph.mw

Is there a possiblity to print exponents in the axis labeling?

Say I have large numbers in 10^6. Then I want to write

labels=["x","y [10^6]"]

However I only found the e-notation within

sprintf("%0.0e", 10^6)

for example, which is not really what I want though.

https://gist.github.com/hoyeunglee/b0c6b61fafd1bee988fcafef3cfe6025
https://gist.github.com/hoyeunglee/a1e0ca335be8bbc8fde301c6aded66f8

test1 = o(a(x,y),z)

test1.args[0]

python sympy can not get function name o and a

restart;
with(Groebner):

DoExist := proc(tau, n)
if rtable_num_elems(tau) >= n then
	return tau[n];
else
	return 0;
end if;
end proc;

IsZero := proc(a, b)
if a=0 then 
	return 0;
else 
	return a/b;
end if
end proc;

g1 := x^2-w*y;
g2 := x*y - w*z;
g3 := y^2 - x*z;
gro := Basis([g1,g2,g3],plex(x,y,z,w));

X1 := `*`(LeadingTerm(g1, tdeg(x, y, z, w)));
X2 := `*`(LeadingTerm(g2, tdeg(x, y, z, w)));
X3 := `*`(LeadingTerm(g3, tdeg(x, y, z, w)));
X12 := lcm(X1,X2);
X13 := lcm(X1,X3);
X23 := lcm(X2,X3);
S12 := SPolynomial(g1, g2, lexdeg([x, y, z, w]));
S23 := SPolynomial(g2, g3, lexdeg([x, y, z, w]));
S13 := SPolynomial(g1, g3, lexdeg([x, y, z, w]));
e1 := Vector([1,0,0]);
e2 := Vector([0,1,0]);
e3 := Vector([0,0,1]);
eq1:= S12 = h121*g1 + h122*g2 + h123*g3;
eq1 := S12 - expand(h121*g1 + h122*g2 + h123*g3):
NormalForm(eq1, Basis([g1, g2, g3], tdeg(x, y, z, w, h121, h122, h123)), tdeg(x, y, z, w, h121, h122, h123), 'Q');
h121 := 0;
h122 := 0;
h123 := 0;
s12 := IsZero(X12,X1)*e1-IsZero(X12,X2)*e2-Vector([DoExist(<Q>,3), DoExist(<Q>,2), DoExist(<Q>,1)]);

eq1 := S13-expand(h131*g1+h132*g2+h133*g3):
NormalForm(eq1, Basis([g1, g2, g3], tdeg(x, y, z, w, h131, h132, h133)), tdeg(x, y, z, w, h131, h132, h133), 'Q');
h131 := 0;
h132 := 0;
h133 := 0;
s13 := IsZero(X13,X1)*e1-IsZero(X13,X3)*e3-Vector([DoExist(<Q>,3), DoExist(<Q>,2), DoExist(<Q>,1)]);

eq1:= S23 - expand(h231*g1 + h232*g2 + h233*g3);
NormalForm(eq1, Basis([g1, g2, g3], tdeg(x, y, z, w, h231, h232, h233)), tdeg(x, y, z, w, h231, h232, h233), 'Q');
h231 := 0;
h232 := 0;
h233 := 0;
s23 := IsZero(X23,X2)*e2-IsZero(X23,X3)*e3-Vector([DoExist(<Q>,3), DoExist(<Q>,2), DoExist(<Q>,1)]);

with(LinearAlgebra):
#F = Syz*GrobnerBasis
F := simplify(MatrixMatrixMultiply(Matrix([[s12[1],s13[1],s23[1]],[s12[2],s13[2],s23[2]],[s12[3],s13[3],s23[3]]]), Matrix([[gro[1]],[gro[2]],[gro[3]]])));
F[1][1] - g1 = 0; 
F[2][1] - g2 = 0;
F[3][1] - g3 = 0;
F := simplify(MatrixMatrixMultiply(Matrix([[s12[1],0,s23[1]],[s12[2],0,s23[2]],[s12[3],0,s23[3]]]), Matrix([[gro[1]],[gro[2]],[gro[3]]])));
F[1][1] - g1 = 0; 
F[2][1] - g2 = 0;
F[3][1] - g3 = 0;

#F = GrobnerBasis*Syz
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],s13[1],s23[1]],[s12[2],s13[2],s23[2]],[s12[3],s13[3],s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],0,s23[1]],[s12[2],0,s23[2]],[s12[3],0,s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;

#F = GrobnerBasis*Syz
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],s12[1],s12[1]],[s13[2],s13[2],s13[2]],[s23[3],s23[3],s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],0,s12[1]],[s13[2],0,s13[2]],[s23[3],0,s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;

syz result is s12, s23

but after verify, F is not equal to GrobnerBasis*Syz

The procedure "ContractIndices" seems to produce wrong results. This is proved by the following source code, comparing the result of this procedure and a simple direct calculation:

with(DifferentialGeometry):with(Tensor):with(Tools):

DGsetup([x,y],P);
m:=nops(DGinfo("FrameBaseVectors"));
g:=evalDG(1/y^2*dx &t dx+1/y^2*dy &t dy);
CS:=Christoffel(g,"SecondKind");
R0:=CurvatureTensor(CS);
RFc:=ContractIndices(R0,g,[[1,1]]); # Maple Version 2015

# Out of the Help Page: ?Tensor[ContractIndices]
# Form the tensor product T &otimes; S and contract 
# the 1st index of T against the 1st index of S. 
# ContractIndices(T, S, [[1, 1]]);

# Only for comparison: g:= 
# _DG([["tensor", P, [["cov_bas", "cov_bas"], []]], [[
# [1, 1], 1/y^2], 
# [[2, 2], 1/y^2]]]);

# g in table form with all indices, including the zeros: 
g1t:=
table([(1, 1) = 1/y^2, (2, 1) = 0, (1, 2) = 0, (2, 2) = 1/y^2]);

# Only fpr comparison:
# R0:=
# _DG([["tensor", P, [["con_bas", "cov_bas", "cov_bas", "cov_bas"], 
# []]], 
# [
# [[1, 2, 1, 2], -1/y^2], 
# [[1, 2, 2, 1], 1/y^2], 
# [[2, 1, 1, 2], 1/y^2], 
# [[2, 1, 2, 1], -1/y^2]]
# ]);

# R0 in table form with all indices, including the zeros:
R01t:=
table([
(2, 1, 1, 2) = 1/y^2, 
(2, 1, 1, 1) = 0, 
(2, 2, 2, 1) = 0, 
(2, 1, 2, 1) = -1/y^2, 
(1, 1, 1, 2) = 0, 
(1, 2, 2, 2) = 0, 
(1, 2, 2, 1) = 1/y^2, 
(2, 1, 2, 2) = 0, 
(2, 2, 1, 2) = 0, 
(2, 2, 2, 2) = 0, 
(1, 1, 2, 1) = 0, 
(1, 2, 1, 2) = -1/y^2, 
(2, 2, 1, 1) = 0, 
(1, 1, 2, 2) = 0, 
(1, 1, 1, 1) = 0, 
(1, 2, 1, 1) = 0
]);

# Only fpr comparison:
# RFc := 
# _DG([["tensor", P, [["cov_bas", "cov_bas", "cov_bas", "cov_bas"], 
# []]], 
# [
# [[1, 1, 2, 2], 1/y^4], 
# [[1, 2, 1, 2], -1/y^4], 
# [[2, 1, 2, 1], -1/y^4], 
# [[2, 2, 1, 1], 1/y^4]]
# ]);

# RFc in table form with all indices, including the zeros:
RFc1t:=
table(
[(2, 1, 1, 2) = 0, 
(2, 1, 1, 1) = 0, 
(2, 2, 2, 1) = 0, 
(2, 1, 2, 1) = -1/y^4, 
(1, 1, 1, 2) = 0, 
(1, 2, 2, 2) = 0, 
(1, 2, 2, 1) = 0, 
(2, 1, 2, 2) = 0, 
(2, 2, 1, 2) = 0, 
(2, 2, 2, 2) = 0, 
(1, 1, 2, 1) = 0, 
(1, 2, 1, 2) = -1/y^4, 
(2, 2, 1, 1) = 1/y^4, 
(1, 1, 2, 2) = 1/y^4, 
(1, 1, 1, 1) = 0, 
(1, 2, 1, 1) = 0
]);

TestContr:=proc()
    description "Simple contraction";
    local i,j,k,l;
    global RR;
    for i from 1 to m do
        for j from 1 to m do
            for k from 1 to m do
                for l from 1 to m do
                    RR[i,j,k,l]:=add(R01t[r,j,k,l]*g1t[i,r],r=1..m)
                od;
            od;
        od;
    od;
    print(`OK`)
end;

TestContr();

# Result of this:
# RR:=
# table(
# [(2, 1, 1, 2) = 1/y^4, 
# (2, 1, 1, 1) = 0, 
# (2, 2, 2, 1) = 0, 
# (2, 1, 2, 1) = -1/y^4, 
# (1, 1, 1, 2) = 0, 
# (1, 2, 2, 2) = 0, 
# (1, 2, 2, 1) = 1/y^4, 
# (2, 1, 2, 2) = 0, 
# (2, 2, 1, 2) = 0, 
# (2, 2, 2, 2) = 0, 
# (1, 1, 2, 1) = 0, 
# (1, 2, 1, 2) = -1/y^4, 
# (2, 2, 1, 1) = 0, 
# (1, 1, 2, 2) = 0, 
# (1, 1, 1, 1) = 0, 
# (1, 2, 1, 1) = 0
# ]);

Testeq:=proc()
    local i,j,k,l;
    # global
    for i from 1 to m do
        for j from 1 to m do
            for k from 1 to m do
                for l from 1 to m do
    if not (RFc1t[i,j,k,l] = RR[i,j,k,l]) then 
     print([i,j,k,l]) fi;
                od;
            od;
        od;
    od;
end;

Testeq();
# Result of this:
#                          [1, 1, 2, 2]
#                          [1, 2, 2, 1]
#                          [2, 1, 1, 2]
#                          [2, 2, 1, 1]

# No equality for these indices!

I am trying to implement an example from page 106 in the book Essential Maple 7 in hope that I can understand a problem related to the "solve" function. The example is:

restart;
f[1] := c*x[1]^2*x[2]+9*x[1]^2+2*x[1]*x[2]+5*x[1]+x[2]-3;

f[2] := 2*x[1]^3*x[2]+6*x[1]^3-2*x[1]^2-x[1]*x[2]-3*x[1]-x[2]+3;

f[3] := x[1]^3*x[2]+3*x[1]^3+x[1]^2*x[2]+2*x[1]^2;

with(Groebner)

infolevel[primpart]:=5

gb:=gbasis([f[1],f[2],f[3]],tdeg(x[1],x[2])):

According to the book, I should receive an output that tell me what "content" has been removed. This will tell me what values of the parameter c have special solutions.

If I enter this in my version of Maple 2015 with no changes, I receive no output. This is not so surprising since the example was written for Maple 7. So I changed infolevel[primpart] to infolevel[all]. With this change, I receive some information, but it is rather general and not what I want.

Does anyone know if there is some other way to do this example in Maple 2015?

Thanks for your help.

Hello dear!

I want to find the vector field of a vector field my approch is below:

with(VectorCalculus);
SetCoordinates(cartesian[x, y, z]);
V := VectorField(<(u(x, y, z), v(x, y, z), w(x, y, z))>);
Gradient(V);

I want answer as bellow:

Matrix(3, 3, {(1, 1) = Diff(u, x), (1, 2) = Diff(u, y), (1, 3) = Diff(u, z), (2, 1) = Diff(v, x), (2, 2) = Diff(v, y), (2, 3) = Diff(v, z), (3, 1) = Diff(w, x), (3, 2) = Diff(w, y), (3, 3) = Diff(w, z)});

Please help me to fix this problem. I am waiting the quick answer.

THANKS in advance

How to find the range of poset?

i would like to search the range of range is equal to the range of domain after solve system.

it may not exactly equal but around 80% of elements in range belong to the range of domain

if it is not factorisation domain,

how to generate ideal with function in maple?

How to get the number of parameters of an operator/procedure? Like this.

How do I move a circle around a sphere?

See attached:  WA61_circle_sphere_post.mw

Circle shares surface area of sphere, how can circle be moved independently around sphere?

I would like to retain the patchwork of the sphere to resemble latitude/longitude lines.

Thanks in advance

Les

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.

 

1 2 3 4 5 6 7 Last Page 2 of 48