zenterix

350 Reputation

4 Badges

2 years, 195 days

MaplePrimes Activity


These are questions asked by zenterix

I created the following worksheet to illustrate my question.

restart

We have two equations. w and w__0 are parameters and we wish to solve for A__1 and A__2.

eq1 := A__1*(w^2-3*w__0^2)+A__2*w__0^2 = 0 = A__1*(w^2-3*w__0^2)+A__2*w__0^2 = 0NULL

eq2 := A__1*w__0^2+A__2*(w^2-w__0^2) = 0 = A__1*w__0^2+A__2*(w^2-w__0^2) = 0NULL

solve({eq1, eq2}, {A__1, A__2}) = {A__1 = 0, A__2 = 0}NULL

 

Maple says the only solution is the trivial solution.

If we check the determinant of the matrix of the system we see it can be zero for certain values of w given w__0.

M := Matrix([[w^2-3*w__0^2, w__0^2], [w__0^2, w^2-w__0^2]]) = Matrix(%id = 36893488152149895276)NULL

d := LinearAlgebra:-Determinant(M) = w^4-4*w^2*w__0^2+2*w__0^4NULL

solutions := solve(d = 0, w)

(2+2^(1/2))^(1/2)*w__0, -(2+2^(1/2))^(1/2)*w__0, (2-2^(1/2))^(1/2)*w__0, -(2-2^(1/2))^(1/2)*w__0

(1)

If w is one of these values then the system of equations is singular and has non-zero solutions.``

 

For example, subbing the first value above into the equations and solving Maple gives us non-trivial solutions.

 

solve({subs(w = solutions[1], eq1), subs(w = solutions[1], eq2)}, {A__1, A__2})

{A__1 = -(1+2^(1/2))*A__2, A__2 = A__2}

(2)

``

Why didn't Maple give us any indication that there could be non-zero solutions in the first call to solve?


For context, the system of equations comes from a calculation involving coupled oscillators.

I had a system of differential equations, guessed at a solution, plugged it in and got the equations shown in the worksheet. The guess isn't a correct solution in general, but it is a solution if w is one of the values computed in the worksheet (the values of the variable "solutions").

Download solve-nonzero-solutions.mw

In the code below, I define an expression, then turn it into a function of omega_d.

Consider the results (5) and (6) below.

I take the derivative of the function relative to omega_d, set the derivative to zero and ask Maple to solve for the critical point (ie, the omega_d at which the derivative is zero).

I get the correct result in (5), ie three different critical points. But when I simplify this result, Maple returns only one of the critical points.

Why?

restart

expr := f/sqrt((`ω__0`^2-`ω__d`^2)^2+`γ__b`^2*`ω__d`^2)

f/((omega__0^2-omega__d^2)^2+gamma__b^2*omega__d^2)^(1/2)

(1)

A := unapply(expr, `ω__d`)

proc (omega__d) options operator, arrow; f/((omega__0^2-omega__d^2)^2+gamma__b^2*omega__d^2)^(1/2) end proc

(2)

diff(A(`ω__d`), `ω__d`)

-(1/2)*f*(-4*(omega__0^2-omega__d^2)*omega__d+2*gamma__b^2*omega__d)/((omega__0^2-omega__d^2)^2+gamma__b^2*omega__d^2)^(3/2)

(3)

simplify(diff(A(`ω__d`), `ω__d`))

-f*omega__d*(gamma__b^2-2*omega__0^2+2*omega__d^2)/(omega__d^4+(gamma__b^2-2*omega__0^2)*omega__d^2+omega__0^4)^(3/2)

(4)

solve(diff(A(`ω__d`), `ω__d`) = 0, `ω__d`)

0, (1/2)*(-2*gamma__b^2+4*omega__0^2)^(1/2), -(1/2)*(-2*gamma__b^2+4*omega__0^2)^(1/2)

(5)

simplify(solve(diff(A(`ω__d`), `ω__d`) = 0, `ω__d`))

0

(6)

NULL


This was a problem for me just now because I used the command in (6) first and just could not figure out what the heck was going on. I did the calculations by hand to check, and then finally found out it was this simplify command.

Download simplifysolve.mw

Why doesn't evalf work on the data structures below?
 

M1 := Matrix([[m__1, m__2]])

Matrix(%id = 36893488151929448556)

(1)

M := [M1, M1]

[Matrix(%id = 36893488151929448556), Matrix(%id = 36893488151929448556)]

(2)

m__1 := 1; m__2 := 2

M

[Matrix(%id = 36893488151929448556), Matrix(%id = 36893488151929448556)]

(3)

evalf(M)

[Matrix(%id = 36893488151929440844), Matrix(%id = 36893488151929440964)]

(4)

evalf(M[1])

Matrix(%id = 36893488151929437108)

(5)

evalf(op(M))

Matrix(%id = 36893488151929432292), Matrix(%id = 36893488151929432412)

(6)

evalf(op(M[1]))

1., 2., {(1., 1.) = m__1, (1., 2.) = m__2}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []

(7)

NULL


 

Download evalf.mw

Why does sqrt(-2) give as a result only i*sqrt(2)?

Why does the result not also include -i*sqrt(2)?

Suppose we have the following simple Matrix

T := <1,2;3,4>;

How do we replace an entry with another expression?

I know that for a list L := [1,2,3] we can do, for example subsop(2=500,L) to replace the entry at index 2.

This creates a new list since lists are immutable.

As far as I can tell, a Matrix is mutable.

However, I wish to change an entry in a Matrix without mutating it.

My actual use case is the following.

I use LinearAlgebra:-Eigenvectors to obtain a Matrix of eigenvectors. Some of the entries are huge expressions with many variables. I would like to sub in placeholders where these huge expressions are so I can visualize the Matrix better, but without modifying the original Matrix.

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