dharr

Dr. David Harrington

8440 Reputation

22 Badges

21 years, 28 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

Maple has some algorithm to find the best set of points to use for plotting a function (not just at equal intervals across the x-axis), and here it seems to be getting confused. You can fix this by using adaptive=false or numpoints=2000.

I'm not sure how integration by parts would apply here. You can just exchange the sum and integration:

restart

inte_eq := int(-(sum(B[i]*beta[i]* exp(-beta[i] * (t-tau)),i=1..n)),tau=0..t);

int(-(sum(B[i]*beta[i]*exp(-beta[i]*(t-tau)), i = 1 .. n)), tau = 0 .. t)

summand := Student:-Calculus1:-Summand(inte_eq)[];

B[i]*beta[i]*exp(-beta[i]*(t-tau))

integ := int(summand, tau=0..t);

-B[i]*exp(-beta[i]*t)+B[i]

ans := simplify(-sum(integ, i=1..n));

sum(B[i]*(-1+exp(-beta[i]*t)), i = 1 .. n)

Download integral.mw

@one man @vv I found plex wasn't much slower than tdeg and put all the pieces together. RationalUnivariateRepresentation should allow fsolve to work on a single polynomial but there are numerical and speed issues.

(I originally tried these polynomial systems with SolveTools:-PolynomialSystem, but it was much slower and I gave up.)

nonlinear2.mw

Edit: I wasn't substituting back into the correct original equations; now fixed.

Well, this still uses the tickmarks option, but I think it achieves what you want. 

restart; with(plots); with(DEtools)

Ode1 := diff(y(t), t, t) = cos(t)

diff(diff(y(t), t), t) = cos(t)

IC := (D(y))(0) = 0, y(0) = 1

(D(y))(0) = 0, y(0) = 1

gsol := dsolve(Ode1, y(t))

y(t) = -cos(t)+c__1*t+c__2

exactsol := dsolve({IC, Ode1}, y(t), numeric, output = listprocedure)

odeplot(exactsol, [t, y(t)], 0 .. 4*Pi, color = blue, title = "Solution to the Differential Equation", labels = ["t", "y(t)"], tickmarks = [piticks, default])

 

NULL

Download directly_integrable.mw

Depends on the exact type of question. But Maple's geometry package might be able to help. Or you can set up relevant equations in Maple and then solve them.

You can't use B[1] or B[2] as parameter names - use B1, B2 instead. Note: if you were using 1-D input, you would receive a more intelligible error message about unexpected [ and the cursor would point you to the offending [

In your first approach notice that there is an infinity at the end, so Maple is telling you the result is +/- infinity. Within the signum function, there two terms that might have different signs. Assuming n>1 would not be enough to resolve this. To check the infinity part, you could put in some numerical values for all but gamma, and plot vs gamma.

So for the second part, you will get the same result, but now the X and lambda are more complicated, and deciding the signs of things is also more complicated, so it will take much longer to decide if it can.

Your question is not very specific about what you want to do, so maybe this doesn't answer your question. The LinearAlgebra:-Generic package allows you to define generic field operations, but for extensions of Q you can do many basic things just with the LinearAlgebra package.

restart

alias(alpha = RootOf(x^2-2))

alpha

M := Matrix(2, 2, [1+alpha, alpha, 2, 2])

Matrix(%id = 36893490439769270860)

evala(1/M)

Matrix(%id = 36893490439769228340)

M.M; evala(%)

Matrix(2, 2, {(1, 1) = (1+RootOf(_Z^2-2))^2+2*RootOf(_Z^2-2), (1, 2) = (1+RootOf(_Z^2-2))*RootOf(_Z^2-2)+2*RootOf(_Z^2-2), (2, 1) = 6+2*RootOf(_Z^2-2), (2, 2) = 2*RootOf(_Z^2-2)+4})

Matrix(%id = 36893490439840085884)

NULL

Download Field.mw

"I tried converting an outupt to a string which removed all the backslashes in the file path. Maybe there is a dedicated command that I overlooked."

SplitPath does this, in a way that doesn't care whether the separator is \\ or /

Other related manipulations are in the FileTools package

f:=currentdir(); #some path

"C:\Users\dharr\OneDrive - University of Victoria\Desktop"

FileTools:-SplitPath(f);

["C:", "Users", "dharr", "OneDrive - University of Victoria", "Desktop"]

NULL

Download SpliPath.mw

numnew := nops(new): numpast := nops(past):
DataFrame(Matrix(numnew, numpast, (i,j) -> {new[i][]} intersect {past[j][]}),
'rows' = [cat("new ", 1..numnew)], 'columns' = [cat("past ", 1..numpast)]);

Download table.mw

Here's a spruced-up version:

Download table2.mw

restart;

with(DEtools):local gamma;

gamma

verg:= (-delta*eta^2 + alpha*eta)*diff(diff(U(xi), xi), xi) - U(xi)*(2*eta*gamma*theta*(delta*eta - alpha)*U(xi)^2 + eta^2*delta*k^2 + (-alpha*k^2 - 2*delta*k)*eta + 2*k*alpha + delta);

(-delta*eta^2+alpha*eta)*(diff(diff(U(xi), xi), xi))-U(xi)*(2*eta*gamma*theta*(delta*eta-alpha)*U(xi)^2+eta^2*delta*k^2+(-alpha*k^2-2*delta*k)*eta+2*k*alpha+delta)

verg2:=collect(verg/(-delta*eta^2 + alpha*eta),U(xi));

 

-2*eta*gamma*theta*(delta*eta-alpha)*U(xi)^3/(-delta*eta^2+alpha*eta)+(-eta^2*delta*k^2-(-alpha*k^2-2*delta*k)*eta-2*k*alpha-delta)*U(xi)/(-delta*eta^2+alpha*eta)+diff(diff(U(xi), xi), xi)

dsolve(verg2);

U(xi) = c__2*((delta*eta^2*k^2-alpha*eta*k^2-2*delta*eta*k+2*alpha*k+delta)/(-c__2^2*delta*eta^2*gamma*theta+c__2^2*alpha*eta*gamma*theta+delta*eta^2*gamma*theta+eta^2*delta*k^2-alpha*eta*gamma*theta-alpha*eta*k^2-2*delta*eta*k+2*k*alpha+delta))^(1/2)*JacobiSN(((eta*(-delta*eta+alpha)*(-delta*eta^2*gamma*theta-delta*eta^2*k^2+alpha*eta*gamma*theta+alpha*eta*k^2+2*delta*eta*k-2*alpha*k-delta))^(1/2)*xi/(eta*(-delta*eta+alpha))+c__1)*((delta*eta^2*k^2-alpha*eta*k^2-2*delta*eta*k+2*alpha*k+delta)/(-c__2^2*delta*eta^2*gamma*theta+c__2^2*alpha*eta*gamma*theta+delta*eta^2*gamma*theta+eta^2*delta*k^2-alpha*eta*gamma*theta-alpha*eta*k^2-2*delta*eta*k+2*k*alpha+delta))^(1/2), c__2*(-(-delta*eta^2*gamma*theta-delta*eta^2*k^2+alpha*eta*gamma*theta+alpha*eta*k^2+2*delta*eta*k-2*alpha*k-delta)*eta*gamma*theta*(-delta*eta+alpha))^(1/2)/(-delta*eta^2*gamma*theta-delta*eta^2*k^2+alpha*eta*gamma*theta+alpha*eta*k^2+2*delta*eta*k-2*alpha*k-delta))

Notice the JacobiSN, so look this up in DLMF

Imported from https://dlmf.nist.gov/22.13.E13 This is presumably what you mean by a standard form. (Paste the pMML into Maple and change it to 2D math.)

diff(sn(z, k), z, z) = -(k^2+1)*sn(z, k)+2*k^2*sn(z, k)^3

diff(diff(sn(z, k), z), z) = -(k^2+1)*sn(z, k)+2*k^2*sn(z, k)^3

This is close the above, so Maple must have found some change of variables

map(factor,[dcoeffs(verg2,U(xi))]);

[1, 2*gamma*theta, (-delta*eta^2*k^2+alpha*eta*k^2+2*delta*eta*k-2*alpha*k-delta)/(eta*(-delta*eta+alpha))]

NULL

Download ode.mw

Something like this? I generated Cases automatically, but am not sure exactly about the rules.
[Edit: now handles the case where neither A nor B are zero,]

restart

with(PDEtools); with(DEtools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

c := combinat:-powerset({A, B}); Cases := [seq({seq(x = 0, `in`(x, s))}, `in`(s, c))]

{{}, {A}, {B}, {A, B}}

[{}, {A = 0}, {B = 0}, {A = 0, B = 0}]

S := diff(G(xi), xi) = G(xi)^2+A*G(xi)+B

diff(G(xi), xi) = G(xi)^2+A*G(xi)+B

"sol:=table():  for i,case in Cases do    sol[i]:=dsolve(eval(S,case));  end do;  "

G(xi) = -(1/2)*A-(1/2)*tanh((1/2)*(A^2-4*B)^(1/2)*(c__1+xi))*(A^2-4*B)^(1/2)

G(xi) = tan(B^(1/2)*(c__1+xi))*B^(1/2)

G(xi) = A/(-1+exp(-A*xi)*c__1*A)

G(xi) = 1/(-xi+c__1)

NULL

Download find_all_case_solution_of_ode_.mw

 

That is strange. Looks like a bug. You can find the singular vector by solving linear equations. (Matrices don't show correctly on Mapleprimes for Maple 2024.)

with(LinearAlgebra); assume(k > 0); assume(abs(l) < 1)

M := Matrix(2, 2, {(1, 1) = l-(1-l*conjugate(l))*k, (1, 2) = -a*(1-l*conjugate(l))*k, (2, 1) = 0, (2, 2) = l+(1-l*conjugate(l))*k})

Matrix(%id = 36893490269467697748)

simplify(SingularValues(M)[1])

(1/2)*(2*(-abs(l)^2+1)*k*(k^2*(abs(l)-1)^2*(abs(l)+1)^2*abs(a)^4+(4*k^2*abs(l)^4+(-8*k^2+4)*abs(l)^2+4*k^2)*abs(a)^2+4*l^2+8*abs(l)^2+4*conjugate(l)^2)^(1/2)+2*k^2*(abs(a)^2+2)*abs(l)^4+4*(-abs(a)^2*k^2-2*k^2+1)*abs(l)^2+2*k^2*(abs(a)^2+2))^(1/2)

X := LinearAlgebra:-HermitianTranspose(M).M; Y := M.LinearAlgebra:-HermitianTranspose(M)

Matrix(2, 2, {(1, 1) = (l-(1-l*conjugate(l))*k)*conjugate(l-(1-l*conjugate(l))*k), (1, 2) = -conjugate(l-(1-l*conjugate(l))*k)*a*(1-l*conjugate(l))*k, (2, 1) = -k*conjugate(a*(1-l*conjugate(l)))*(l-(1-l*conjugate(l))*k), (2, 2) = a*(1-l*conjugate(l))*k^2*conjugate(a*(1-l*conjugate(l)))+(l+(1-l*conjugate(l))*k)*conjugate(l+(1-l*conjugate(l))*k)})

Matrix(%id = 36893490269631762788)

Eigenvectors are zero, but X is not defective (distinct eigenvals)!! Same happens for Y

evalsX, evecsX := Eigenvectors(X); simplify(evalsX[1]-evalsX[2])

Vector[column](%id = 36893490269492440468), Matrix(%id = 36893490269492440588)

(-abs(l)^2+1)*k*(k^2*(abs(l)-1)^2*(abs(l)+1)^2*abs(a)^4+(4*k^2*abs(l)^4+(-8*k^2+4)*abs(l)^2+4*k^2)*abs(a)^2+4*l^2+8*abs(l)^2+4*conjugate(l)^2)^(1/2)

So do it the hard way - we get some arbitrary scale factor this way, which we set to 1

uX1 := simplify(LinearSolve(X-evalsX[1]*IdentityMatrix(2), `<,>`(0, 0), free = t)); uX1 := eval(uX1, t[1] = 1); uX2 := simplify(LinearSolve(X-evalsX[2]*IdentityMatrix(2), `<,>`(0, 0), free = t)); uX2 := eval(uX2, t[1] = 1); uX := `<|>`(uX1, uX2)

Vector(2, {(1) = 1, (2) = (1/2)*((-abs(l)^2+1)*k*sqrt(k^2*(abs(l)-1)^2*(abs(l)+1)^2*abs(a)^4+(4*k^2*abs(l)^4+(-8*k^2+4)*abs(l)^2+4*k^2)*abs(a)^2+4*l^2+8*abs(l)^2+4*conjugate(l)^2)+abs(a)^2*abs(l)^4*k^2+(-2*abs(a)^2*k^2-2*k*l-2*conjugate(l)*k+2)*abs(l)^2+(2*k-2*l)*conjugate(l)+k*(abs(a)^2*k+2*l))/(a*k*(abs(l)-1)*(abs(l)+1)*(k*abs(l)^2-k+conjugate(l)))})

Vector[column](%id = 36893490269491420204)

Check - -2*Re(l)+conjugate(l)+lshould simplify to zero but doesn't.

Xtest := simplify(X.uX-uX.DiagonalMatrix(evalsX))

Matrix(%id = 36893490269566840092)

So try with some random values;

eval(Xtest, {a = 2.1, k = 1.9, l = .3+.2*I})

Matrix(%id = 36893490269505921140)

NULL

Download singular_vect_2_by_2_matrix.mw

See the help page ?encrypted. This means that for procedures in a repository with option encrypted, the code cannot be seen by the user after the procedure is loaded.

Maple has a web page for third party products; not sure how many are packages. As for licensing, I guess you need to read your licencing agreement carefully to see what is allowed.

See also here.

I got a different error (Maple 2024.1). If I take the numerator it is a cubic and can be solved, but the answer is probably not useful, unless you put some numbers in.

Q_simplify_solv.mw

First 12 13 14 15 16 17 18 Last Page 14 of 83