Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Yo I have fit a surface to a curve using polynomial regression:

(It's only supposed to be fit for negative t domain)

Now I've attempted to cap this function off at 0, using a piecewise function of the original:


Which when I print, looks somewhat about right:

Sorry it's so hard to see but you get the idea. The problem is that this seems to set the whole function to 0, rather than just the bits that should clip:


The piecwise function seems to be evaluating the fN>0 condition to true for all input values p,t, rather than substituing the new input values into the original function fN, and then evaluating the condition for every point, not really sure what the problem is, would appreciate some help!

Calculateif 

Determine which of the limits exist and calculate 
if 

Find the intersection points of the curves and build graphics. 
P.S. Sorry for the spam questions on the forum, but I need to pass the work as soon as possible.

Determine the dimension of the system solution space: 

Implement a procedure that calculates the number of all non-zero elements of a given matrix, and apply this procedure to the matrix: 

Hi, 

Versions concerned:  [ Maple 2015 ... Maple 2018 ]

I use DocumentTools:-Tabulate to display a matrix of numbers while coloring them according to some condition.
(line DocumentTools:-Tabulate(M, color=((M,i,j)->`if`(M[i,j]>3,....) below ... please note the output is not loaded for some unknown reason).
The fact is that the matrix appears with black characters meaning 'color' doesn't work.

In a second attempt I convert matrix M into a matrix of strings and use now
DocumentTools:-Tabulate(S, color=((S,i,j)->`if`(parse(S[i,j])>3,...)
I get now the desired result with some blue and red numbers.

So converting to strings could be a workaround.
But think to matrices where elements would be algebraic expressions, for instance 
M := Matrix(2, 2, (i,j)->exp(x^i)+cos(x*j))
and that we use the coloring scheme is color=((M,i,j)->`if`(i+j>3, "Red", "Blue")
Converting M to a string matrix will display the element [2, 2] in red and the others in blue, but what you get then is a no longer a 2D pretty output but, literally, things like exp(x^2)+cos(x*2) 

The "convert to string" workaround is thus far from perfect.
Is the fact that 'color' only acts on strings a "normal and known" behaviour?
Is it possible to change the color of the font for non "string type matrices" ?
 

restart:

M :=Matrix(2, 2, (i,j)->i+j)

M := Matrix(2, 2, {(1, 1) = 2, (1, 2) = 3, (2, 1) = 3, (2, 2) = 4})

(1)

DocumentTools:-Tabulate(M, color=((M,i,j)->`if`(M[i,j]>3, "Red", "Blue")), width=30)

S :=convert~(M, string):
DocumentTools:-Tabulate(S, color=((S,i,j)->`if`(parse(S[i,j])>3, "Red", "Blue")), width=30)

 


 

Download Tabulate_Color.mw

Draw the coordinate grid of the elliptical coordinate system.

Get an animation of the transformation of an ellipse into a hyperbola.

Dear all,

I am totally new to maple and would like to get an understanding for the "language" and how to work with maple. Thats why I tried to get a simple model from Mathematica into Maple, however, unfortunately, I am not able to initialize the plot I want to generate. Hence, I am wondering if someone could please help me here. My code looks as follows:
 

P[t] := a*ED[t - 1] + P[t - 1]

ED[t] := DC[t] + DF[t];

DC[t] := c(P[t] - P[t - 1])

DF[t] := b(F - P[t])

my initial conditions are:

a := 1
c := 0.75
b := 0.2
F := 100
P[0] := F
P[1] := F + 1

Now I would like to see how P[t] develops for t from 0 to 100, but I get the error "Error, (in Plot) Plot([ED[t-1]+P[t-1], t = 0 .. 100]) is not a valid command; see the plot help page" However, I am not able to get a grip on the helppage information. Hence I would be very glad if someone could help me here please.

Thank you in advance!

Best, Alex

 

 

what's the easiest way to have maple simplify the expression below from 'expr1' to the form of 'desired_form'? mathematica automatically simplifies to that (subjectively of course!) much nicer looking form.

 


 

restart:

 

expr1:=-lambda-(1/2)*kappa__c-gamma__p-(1/2)*sqrt(-16*N*g^2+4*lambda^2-8*lambda*gamma__p+4*lambda*kappa__c+4*gamma__p^2-4*gamma__p*kappa__c+kappa__c^2);

-lambda-(1/2)*kappa__c-gamma__p-(1/2)*(-16*N*g^2+4*lambda^2-8*lambda*gamma__p+4*lambda*kappa__c+4*gamma__p^2-4*gamma__p*kappa__c+kappa__c^2)^(1/2)

(1)

desired_form:=1/2*(-2*gamma__p - kappa__c - 2 *lambda - sqrt(-16*N*g^2 + (-2 * gamma__p + kappa__c + 2 * lambda)^2));

-gamma__p-(1/2)*kappa__c-lambda-(1/2)*(-16*N*g^2+(-2*gamma__p+kappa__c+2*lambda)^2)^(1/2)

(2)

expr1- desired_form:
simplify(%);

0

(3)

 


 

Download factor_under_sqrt.mw

how can i get an 'implicit=false' form (no RootOf) of my eigenvalues from the Eigenvectors() command? Should one expect the behavior be the same in Eigenvectors() and Eigenvalues()?

thanks

 

restart:

 

 

M:=Matrix(3, 3, [[-2*lambda-kappa__c, -2*sqrt(2)*g, 0], [(1/2)*g*N*sqrt(2), -lambda-(1/2)*kappa__c-gamma__phi, -sqrt(2)*g], [0, g*N*sqrt(2), -2*gamma__phi]])

Matrix(3, 3, {(1, 1) = -2*lambda-`#msub(mi("κ",fontstyle = "normal"),mi("c"))`, (1, 2) = -2*sqrt(2)*g, (1, 3) = 0, (2, 1) = (1/2)*g*N*sqrt(2), (2, 2) = -lambda-(1/2)*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`-`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`, (2, 3) = -sqrt(2)*g, (3, 1) = 0, (3, 2) = g*N*sqrt(2), (3, 3) = -2*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`})

(1)

LinearAlgebra:-Eigenvalues(M); #this is what i want but from Eigenvectors()

Vector(3, {(1) = -lambda-(1/2)*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`-`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`, (2) = -lambda-(1/2)*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`-`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`+(1/2)*sqrt(-16*N*g^2+4*lambda^2+4*lambda*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`-8*lambda*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`+`#msub(mi("κ",fontstyle = "normal"),mi("c"))`^2-4*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`+4*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`^2), (3) = -lambda-(1/2)*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`-`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`-(1/2)*sqrt(-16*N*g^2+4*lambda^2+4*lambda*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`-8*lambda*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`+`#msub(mi("κ",fontstyle = "normal"),mi("c"))`^2-4*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`+4*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`^2)})

(2)

LinearAlgebra:-Eigenvalues(M, implicit=true); #RootOf notation; not what i want, but option works here

Vector(3, {(1) = -lambda-(1/2)*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`-`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`, (2) = RootOf(_Z^2+(2*lambda+`#msub(mi("κ",fontstyle = "normal"),mi("c"))`+2*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`)*_Z+4*N*g^2+4*lambda*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`+2*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`, index = 1), (3) = RootOf(_Z^2+(2*lambda+`#msub(mi("κ",fontstyle = "normal"),mi("c"))`+2*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`)*_Z+4*N*g^2+4*lambda*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`+2*`#msub(mi("γ",fontstyle = "normal"),mi("φ",fontstyle = "normal"))`*`#msub(mi("κ",fontstyle = "normal"),mi("c"))`, index = 2)})

(3)

evals, evecs:=LinearAlgebra:-Eigenvectors(M); #RootOf everywhere;

evals, evecs := Vector(3, {(1) = RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 1), (2) = RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 2), (3) = -lambda-(1/2)*`κ__c`-`γ__φ`}), Matrix(3, 3, {(1, 1) = 8*g^2/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 1)+2*lambda+`κ__c`)^2, (1, 2) = 8*g^2/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 2)+2*lambda+`κ__c`)^2, (1, 3) = 2/N, (2, 1) = -2*sqrt(2)*g/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 1)+2*lambda+`κ__c`), (2, 2) = -2*sqrt(2)*g/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 2)+2*lambda+`κ__c`), (2, 3) = -(1/4)*sqrt(2)*(2*lambda+`κ__c`-2*`γ__φ`)/(g*N), (3, 1) = 1, (3, 2) = 1, (3, 3) = 1})

(4)

 

 

evals, evecs:=LinearAlgebra:-Eigenvectors(M, implicit=false); #still RootOf everywhere;

evals, evecs := Vector(3, {(1) = RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 1), (2) = RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 2), (3) = -lambda-(1/2)*`κ__c`-`γ__φ`}), Matrix(3, 3, {(1, 1) = 8*g^2/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 1)+2*lambda+`κ__c`)^2, (1, 2) = 8*g^2/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 2)+2*lambda+`κ__c`)^2, (1, 3) = 2/N, (2, 1) = -2*sqrt(2)*g/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 1)+2*lambda+`κ__c`), (2, 2) = -2*sqrt(2)*g/(RootOf(_Z^2+(2*lambda+`κ__c`+2*`γ__φ`)*_Z+4*g^2*N+4*`γ__φ`*lambda+2*`γ__φ`*`κ__c`, index = 2)+2*lambda+`κ__c`), (2, 3) = -(1/4)*sqrt(2)*(2*lambda+`κ__c`-2*`γ__φ`)/(g*N), (3, 1) = 1, (3, 2) = 1, (3, 3) = 1})

(5)

 

 


 

Download evals.mw

 

 

 

 

The help for the package Differential Geometry suggests one way to create an anholonomic frame, but the method suggested assumes one knows the frame and can write it in the coordinates of the manifold, and use this representation to compute the structure equations. It is useful to turn this problem around: suppose I know the structure equations but I do not know the frame, how do I correctly enter this in Maple so that later computations are correct?

 

Here is an example:

with(DifferentialGeometry): with(LieAlgebras):
DGsetup([x, y], R2):          
Fr := [A, B]; StructureEquations := [[A, B] = a(x, y)*A];
LD := LieAlgebras:-LieAlgebraData(StructureEquations, Fr, M);
DGsetup(LD, verbose):

that creates the Lie algebra M. I thought it would produce the manifold M whose frame {e1,e2} (or {A,B})) obeys the structure equations. But it does not. Indeed, the simple example

LieBracket(e1, f(x, y)*e2);

returns

f(x,y) a(x,y) e1.

The extra term where e1 differentiates f(x,y) does not appear. Just to be clear, the correct answer is

f(x,y) a(x,y) e1 + e1[f] e2.

 

How should I correctly setup this manifold?

Should Maple handle this error internally and may be give no solution if it can't solve it instead of this  error?

When setting boundary condition to zero, maple gives error below. Heat PDE in a sphere. No angle dependency. Only the radial part.

unassign('r,u,t');
pde:=diff(u(r,t),t)= 1/r*diff(r*u(r,t),r$2); #Laplacian in spherical
ic:=u(r,0)=1;
bc := u(1,t) =0;
pdsolve([pde,ic,bc],u(r,t),HINT =boundedseries(r=0)) assuming t>0

Error, (in assuming) when calling 'ln'. Received: 'when calling 'ln'. Received: 'numeric exception: division by zero''


Adding assumptions such as 0<r,r<1 did not help.

Physics version 348. Maple 2019 on windows 10. Is there something I am doing wrong? 

 

The following code yields "false" for the trace being non-negative.  This, however, is incorrect.

A look at the final expression for the trace shows it is a sum of products of positive values.

Does anyone know what the problem is?

restart;

with(LinearAlgebra);

n := 3;

p := 2;

Y := Matrix(n, p, symbol = y);

W := Matrix(n, n, symbol = w, shape = symmetric);

for i from 1 to n do

for j from 1 to n do

assume(w[i, j], RealRange(0, 1))

end do:

end do:

d := DiagonalMatrix(W . Matrix(n, 1, 1))

is(simplify(Trace(simplify(Transpose(Y) . (d-W) . Y))) >= 0)

 

First 8 9 10 11 12 13 14 Last Page 10 of 1540