MaplePrimes Questions

I am working on a simple program (4 lines excluding header/footer and debug command) that calculates a Lie-derivatives of a function G, supplied by the user, with the rule:
 

derivative of x[i]=F[i]  (an input supplied by the user),
derivative of y[i]=y[i+1].


this calculation revolves around a dot product, and I can't seem to work out what has gone wrong. My impression is that is because nops of a Vector gives you  1 more than the length of the Vector, so the Vector handed to DotProduct is wrong- but i can't see why it doesn't work in the case of G2 and F2 but does for G and F.

lieDer2_problems_mwe.mw

I am developing an algorythm which returns some differential equation, which I want to simplify. Here is an example:

eqq:= k[t]*(`ℓ`^2)*(diff(q[3](tau), tau, tau)+(5*alpha-sigma+2*theta+1)*q[3](tau)+(-4*alpha+sigma-theta)*q[2](tau)+q[1](tau)*alpha) = -(sqrt(m*(1/k[t]))*`ℓ`*k[t]*`Δθ`*(q[3](tau)-q[2](tau))*sin(sqrt(Lambda*k[t]*(1/m))*sqrt(m*(1/k[t]))*tau)+2*xi*sqrt(lambda*k[t]*m)*(diff(q[3](tau), tau)))*`ℓ`*(1/sqrt(m*(1/k[t])))

I want the parameters to be associated to the the variables, q[1](tau)q[2](tau)q[3](tau) and their derivattives. So, I have used "collect" command, as below:

vars:= {q[1](tau),q[2](tau),q[3](tau),diff(q[1](tau),tau),diff(q[2](tau),tau),diff(q[3](tau),tau),diff(q[1](tau),tau$2),diff(q[2](tau),tau$2),diff(q[3](tau),tau$2)}:
collect(eqq,vars);

The problem is that the equations remain with non-simplified terms, such as the terms inside the "sine" functions and the term "k[t]*ell^2". The command "simplify" does not have any effect. Ideally, I would like to have something like this:

(diff(q[3](tau), tau, tau))+alpha*q[1](tau)+(-4*alpha+sigma-theta)*q[2](tau)+(5*alpha-sigma+2*theta+1)*q[3](tau)+2*xi*sqrt(lambda)/`ℓ`*(diff(q[3](tau), tau))-`Δθ`*sin(sqrt(Lambda)*tau)*q[2](tau)+`Δθ`*q[3](tau)*sin(sqrt(Lambda)*tau) = 0;

Does anyone know how to solve that?
 

Hi,

I am having trouble with the syntax for entering a limit of a multivariate function with direction specifiers.

For a single variate function f(x) the limit for x -> a from the right is specified by

limit(f(x),x=a,right)

A limit of a multivariate function f(x,y) for x -> a and y -> b can be entered by

limit(f(x,y),{x=a,y=b})

However I do not know how to specify directions in this case. Say, I want x to approach a from the right, and y to approach b from the left. What is the syntax to do this?

Cheers!

 

 

 

Hello

we have a matrix A (s.p.d) and b where LDL^t=A is the cholesky decompositon.

Why is the commands output

LUDecomposition(A, method = 'Cholesky', output = ['L', 'U']);

different from the output described in books or wikipedia.

To be exact:

L, the lower triangular matrix, is not normalized (the diagonal entries should be 1, they are not!)
L^t (upper triangular matrix) too.
D is not available for Cholesky at all.

 

If we calculate it with GaussianElimination

LUDecomposition(A, output = ['L', 'U'])

L is the wanted normalized lower triangular matrix, but its not normalized with cholesky.

And the DIAGONAL enntries are the wanted diagonal matrix D with cholesky.

 

This output is very confusing. Please can someone explain how to use/get the correct decomposition?

A example worksheet is attached.

Thank you :)!


 

with(LinearAlgebra)

[`&x`, Add, Adjoint, BackwardSubstitute, BandMatrix, Basis, BezoutMatrix, BidiagonalForm, BilinearForm, CARE, CharacteristicMatrix, CharacteristicPolynomial, Column, ColumnDimension, ColumnOperation, ColumnSpace, CompanionMatrix, CompressedSparseForm, ConditionNumber, ConstantMatrix, ConstantVector, Copy, CreatePermutation, CrossProduct, DARE, DeleteColumn, DeleteRow, Determinant, Diagonal, DiagonalMatrix, Dimension, Dimensions, DotProduct, EigenConditionNumbers, Eigenvalues, Eigenvectors, Equal, ForwardSubstitute, FrobeniusForm, FromCompressedSparseForm, FromSplitForm, GaussianElimination, GenerateEquations, GenerateMatrix, Generic, GetResultDataType, GetResultShape, GivensRotationMatrix, GramSchmidt, HankelMatrix, HermiteForm, HermitianTranspose, HessenbergForm, HilbertMatrix, HouseholderMatrix, IdentityMatrix, IntersectionBasis, IsDefinite, IsOrthogonal, IsSimilar, IsUnitary, JordanBlockMatrix, JordanForm, KroneckerProduct, LA_Main, LUDecomposition, LeastSquares, LinearSolve, LyapunovSolve, Map, Map2, MatrixAdd, MatrixExponential, MatrixFunction, MatrixInverse, MatrixMatrixMultiply, MatrixNorm, MatrixPower, MatrixScalarMultiply, MatrixVectorMultiply, MinimalPolynomial, Minor, Modular, Multiply, NoUserValue, Norm, Normalize, NullSpace, OuterProductMatrix, Permanent, Pivot, PopovForm, ProjectionMatrix, QRDecomposition, RandomMatrix, RandomVector, Rank, RationalCanonicalForm, ReducedRowEchelonForm, Row, RowDimension, RowOperation, RowSpace, ScalarMatrix, ScalarMultiply, ScalarVector, SchurForm, SingularValues, SmithForm, SplitForm, StronglyConnectedBlocks, SubMatrix, SubVector, SumBasis, SylvesterMatrix, SylvesterSolve, ToeplitzMatrix, Trace, Transpose, TridiagonalForm, UnitVector, VandermondeMatrix, VectorAdd, VectorAngle, VectorMatrixMultiply, VectorNorm, VectorScalarMultiply, ZeroMatrix, ZeroVector, Zip]

(1)

b := `<,>`(1, 2, 2)

Vector[column](%id = 18446744078207759414)

(2)

A := Matrix(3, 3, {(1, 1) = 4, (1, 2) = 6, (1, 3) = 2, (2, 1) = 6, (2, 2) = 10, (2, 3) = 8, (3, 1) = 2, (3, 2) = 8, (3, 3) = 30})

Matrix(%id = 18446744078207760614)

(3)

LUDecomposition(A, method = 'Cholesky', output = ['L', 'U'])

Matrix(%id = 18446744078207732662), Matrix(%id = 18446744078207732422)

(4)

LUDecomposition(A, output = ['L', 'U'])

Matrix(%id = 18446744078207771822), Matrix(%id = 18446744078207772062)

(5)

``


 

Download dasfindetnichtmalpeterlustig.mw

 

dasfindetnichtmalpeterlustig.mw

 

How do i change keyboard shortcuts, E.g one of my keyboard keys are broken or have stopped working. How do i redirect my shortcut to another keyboard combination or another hotkey simply.

Hello, is it possible to have a document synchronized in the same way as Onenote? We're a group of engieneer students wanting to share documents, however the only way we can figure out a way to do it. Is uploading to maplecloud groups, sharing a "base" document, and everytime someone "updates" the document you save a new one. So it kind of defeats the purpose of making it a smart idea of collaborating on one document, am i missing something or is this really how oldschool it works?

Hello,

     I'm trying to simplify an expression involving signum and sqrt using assumptions:

assumptions := { A>0,psi::real,1+A*cos(psi)<sqrt(1+sin(psi)),1+sin(psi)>0 }:
signum(1+A*cos(psi)-sqrt(1+sin(psi))):
simplify(%) assuming op(assumptions);

It seems to me that, given these assumptions, we can safely conclude that the result should be -1. However, I can't get Maple to show this. Interestingly, setting A=1 does allow maple to simplify the result to -1. Is there something I'm missing?


Thanks!

I recently corresponded with maplesoft on whether the program Groebner:-Basis always produces reduced Groebner bases or not. They say it does. This mw appears to show it producing a non reduced Groebner Basis for a set of polynomials.

More specifically, the coefficient of the lead term of the first polynomial generated is not 1.

I'd like to be shown wrong here, but I am struggling to see what i could be doing wrong.


 

restart:

alias(epsilon = e, omega = w, omega[0] = w0, t[1] = t1, t[2] = t2, alpha[1] = a1, alpha[2] = a2, alpha[3] = a3); e := proc (t1, t2) options operator, arrow; e end proc; w0 := proc (t1, t2) options operator, arrow; w0 end proc; f := proc (t1, t2) options operator, arrow; f end proc; mu := proc (t1, t2) options operator, arrow; mu end proc

ode := (D@@2)(u)+u+e*a1*D(u)+e*a2*u^3-f0*cos(omega*t) = 0

(D@@2)(u)+u+epsilon*alpha[1]*D(u)+epsilon*alpha[2]*u^3-f0*cos(omega*t) = 0

(1)

e_oredr := 1:

ode := subs(D = sum('e^(i-1)*D[i]', 'i' = 1 .. e_oredr+1), ode);

((epsilon*D[2]+D[1])@@2)(u)+u+epsilon*alpha[1]*(epsilon*D[2]+D[1])(u)+epsilon*alpha[2]*u^3-f0*cos(omega*t) = 0

(2)

u := sum('q[i]*e^i', 'i' = 0 .. e_oredr);

q[1]*epsilon+q[0]

(3)

ode := collect(ode, e):

 

 

ode:=simplify(%,{e^3=0,e^2=0});

-f0*cos(omega*t)+D[1, 1](q[1])*epsilon+D[1, 1](q[0])+2*D[1, 2](q[0])*epsilon+D[1](q[0])*alpha[1]*epsilon+(alpha[2]*q[0]^3+q[1])*epsilon+q[0] = 0

(4)

 

 

 

for i from 0 to e_oredr do eq[i] := coeff(lhs(ode), e, i) = 0 end do;

-f0*cos(omega*t)+D[1, 1](q[0])+q[0] = 0

 

alpha[2]*q[0]^3+alpha[1]*D[1](q[0])+2*D[1, 2](q[0])+D[1, 1](q[1])+q[1] = 0

(5)

 

eq[1]:=convert(eq[1](t1, t2), diff);

alpha[2](t[1], t[2])*q[0](t[1], t[2])^3+alpha[1](t[1], t[2])*(diff(q[0](t[1], t[2]), t[1]))+2*(diff(diff(q[0](t[1], t[2]), t[1]), t[2]))+diff(diff(q[1](t[1], t[2]), t[1]), t[1])+q[1](t[1], t[2]) = 0

(6)

 

q[0] :=A(t2)*exp(I*t1)+b*exp(I*w*t1)+conjugate(A)(t2)*exp(-I*t1)+b*exp(-I*w*t1); convert(%, 'exp'); q[0] := unapply(%, (t1, t2)):  # Chage the value 

A(t[2])*exp(I*t[1])+b*exp(I*omega*t[1])+(conjugate(A))(t[2])*exp(-I*t[1])+b*exp(-I*omega*t[1])

 

A(t[2])*exp(I*t[1])+b*exp(I*omega*t[1])+(conjugate(A))(t[2])*exp(-I*t[1])+b*exp(-I*omega*t[1])

(7)

 

expand(lhs(eq[1])):

eq:=combine(%, exp):

eq:=simplify(%, power):  

eq:=combine(subs(w=1/3+e*sigma,%),exp):   ## substituting the detuning parameter

expand(%):

eq:=algsubs(t1*e=t2,%):

 

eq:=collect(%, exp(I*t1)):

 

coeff(%, exp(I*t1),1):

simplify(combine(%,exp));

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3+3*alpha[2](t[1], t[2])*A(t[2])^2*(conjugate(A))(t[2])+6*alpha[2](t[1], t[2])*b^2*A(t[2])+I*A(t[2])*alpha[1](t[1], t[2])+(2*I)*(diff(A(t[2]), t[2]))

(8)

subs({A(t2)=a(t2)*exp(I*beta(t2))/2,conjugate(A)(t2)=a(t2)*exp(-I*beta(t2))/2},%);

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3*(exp(I*beta(t[2])))^2*exp(-I*beta(t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*exp(I*beta(t[2]))*alpha[1](t[1], t[2])+(2*I)*(diff((1/2)*a(t[2])*exp(I*beta(t[2])), t[2]))

(9)

combine(%,exp);

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3*exp(I*beta(t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*exp(I*beta(t[2]))*alpha[1](t[1], t[2])+(2*I)*((1/2)*(diff(a(t[2]), t[2]))*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*(diff(beta(t[2]), t[2]))*exp(I*beta(t[2])))

(10)

map(x->x*exp(-I*beta(t2)),%);

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3*exp(-I*beta(t[2]))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3*exp(I*beta(t[2]))*exp(-I*beta(t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])*exp(I*beta(t[2]))*exp(-I*beta(t[2]))+((1/2)*I)*a(t[2])*exp(I*beta(t[2]))*alpha[1](t[1], t[2])*exp(-I*beta(t[2]))+(2*I)*((1/2)*(diff(a(t[2]), t[2]))*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*(diff(beta(t[2]), t[2]))*exp(I*beta(t[2])))*exp(-I*beta(t[2]))

(11)

simplify(%,exp);

alpha[2](t[1], t[2])*b^3*exp(-I*(-3*sigma*t[2]+beta(t[2])))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3-a(t[2])*(diff(beta(t[2]), t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])+((1/2)*I)*a(t[2])*alpha[1](t[1], t[2])+I*(diff(a(t[2]), t[2]))

(12)

subs({3*sigma*t2-beta(t2)=C(t2),beta(t2)=3*sigma*t2-C(t2)},%);

alpha[2](t[1], t[2])*b^3*exp(I*C(t[2]))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3-a(t[2])*(diff(3*sigma*t[2]-C(t[2]), t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])+((1/2)*I)*a(t[2])*alpha[1](t[1], t[2])+I*(diff(a(t[2]), t[2]))

(13)

convert(%,trig);

alpha[2](t[1], t[2])*b^3*(cos(C(t[2]))+I*sin(C(t[2])))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3-a(t[2])*(3*sigma-(diff(C(t[2]), t[2])))+3*alpha[2](t[1], t[2])*b^2*a(t[2])+((1/2)*I)*a(t[2])*alpha[1](t[1], t[2])+I*(diff(a(t[2]), t[2]))

(14)

 

 

 

 

 

 

 

 

 

 

cond1 := collect(coeff(%, I, 0), [diff(C(t2), t2), cos(C(t2))]);

a(t[2])*(diff(C(t[2]), t[2]))+alpha[2](t[1], t[2])*b^3*cos(C(t[2]))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3-3*a(t[2])*sigma+3*alpha[2](t[1], t[2])*b^2*a(t[2])

(15)

cond2 := collect(coeff(%%, I, 1), [diff(A(t2), t2), sin(C(t2))]);

alpha[2](t[1], t[2])*b^3*sin(C(t[2]))+(1/2)*a(t[2])*alpha[1](t[1], t[2])+diff(a(t[2]), t[2])

(16)

a(t2):= a; C(t2):=C; cond1 = 0; cond2 =0;

a

 

C

 

alpha[2](t[1], t[2])*b^3*cos(C)+(3/8)*alpha[2](t[1], t[2])*a^3-3*a*sigma+3*alpha[2](t[1], t[2])*b^2*a = 0

 

alpha[2](t[1], t[2])*b^3*sin(C)+(1/2)*a*alpha[1](t[1], t[2]) = 0

(17)

alpha[1]:=unapply(alpha[1],[t1,t2]);alpha[2]:=unapply(alpha[2],[t1,t2]);

proc (t1, t2) options operator, arrow; alpha[1] end proc

 

proc (t1, t2) options operator, arrow; alpha[2] end proc

(18)

remove(has, cond1, cos)^2+remove(has, cond2, sin)^2 = select(has, cond1, cos)^2+select(has, cond2, sin)^2;

((3/8)*alpha[2]*a^3-3*a*sigma+3*alpha[2]*b^2*a)^2+(1/4)*a^2*alpha[1]^2 = alpha[2]^2*b^6*cos(C)^2+alpha[2]^2*b^6*sin(C)^2

(19)

simplify(%,'trig');   

(9/64)*a^2*(a^2*alpha[2]+8*alpha[2]*b^2-8*sigma)^2+(1/4)*a^2*alpha[1]^2 = alpha[2]^2*b^6

(20)

 

af_eq:=%;

(9/64)*a^2*(a^2*alpha[2]+8*alpha[2]*b^2-8*sigma)^2+(1/4)*a^2*alpha[1]^2 = alpha[2]^2*b^6

(21)

##

 

 

##

b:=0.5*f0/(1-(1/3)^2);

.5625000000*f0

(22)

with(plots, implicitplot):

 f0 :=1; alpha[1]:=0.0087;alpha[2]:=2.5871;   b:=0.5*f0/(1-(1/3)^2);#change the value 

1

 

0.87e-2

 

2.5871

 

.5625000000

(23)

af_eq;
curve1,curve2:=solve(af_eq, sigma):

A0:=2:

(9/64)*a^2*(2.5871*a^2-8*sigma+6.548596875)^2+0.1892250000e-4*a^2 = .2120125612

(24)

``

 

 

``

 

``

pu1:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = 0 .. A0,  numpoints = 200000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, 0 .. 6]):
pu2:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = A0 .. 10,linestyle=[1,3],  numpoints = 20000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, 0 .. 6]):

A0:=-2:

pu3:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = -10 .. A0, linestyle=[3,1], numpoints = 200000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, -6 .. 0]):
pu4:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = A0 .. 0,  numpoints = 20000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, -6 .. 0]):

pp1:=display([pu1,pu2,pu3,pu4]);

(25)

How can I merge these pictures into one

 

 

 

 

 


Like this one

Download merege_two_diagram.mw

I was wondering how Maple cope with piecewise functions during forward integration and if it's preferable to use dsolve events option in place of defining a piecewise discontinuos function.

As far as I understood dsolve/events halts the integration each time an event is triggered and subsequently restarts the integration using the pre-trigger outputs as new initial conditions. I suppose that by using a piecewise, if a discontinuity is detected, dsolve proceeds exactly in the same way halting and restarting the integration.

Here a toy example of a 2D rolling dice (idea of a rolling dice from the rolling cube by @one man :P ) in which the reaction forces of the floor can be seen as function of the compenetration dice/ground

Both the appraches (events and piecewise) give the same results

falling_dice.mw

First, I want to say thank you to all who contributed to previous questions. God bless you.

I need Maple code in solving first order differential equation using Langrange and Newton's Interpolation Method.

The aim is to compare these two numerical result with the exact in tabular form and also to plot the graph.

Some questions are attached.

ODE_Questions.pdf

I have to take limit of the HeunG function at infinity.

Here is what I tried

This is clearly not working. I have to take limit of a function which consist multiple HeunG functions at infinities.

Hi,

how do I make second power of integers in a list?

e. g.: L1:=[-3,-2,-1,0,1,2,3]

and i want

L2:=[9,4,1,0,1,4,9]

Thanks

I am trying to solve a second order differential equation but getting error. The differential equation valid for r>0.

 

Vr.mw

Hi, I'm quite a beginner in Maple.

Currently, I'm solving several complex ODE using maple. When I run the code, it gives me some results. However, when I re-run the code using exactly the same equations and parameter, I somehow got completely different results. Using the same input sometimes it gives float(undefined), complex number, or real number.

Could anyone explain what's happening here? Does it mean that my set of ODE is not independent of each other?

Any helps would be greatly appreciated.

Thanks!

First 786 787 788 789 790 791 792 Last Page 788 of 2434