C_R

2867 Reputation

19 Badges

5 years, 85 days

MaplePrimes Activity


These are answers submitted by C_R

I have added a few (t) to some variables in the equations of your worksheet.
The equations were in non executable mode. I changed that to executable and applied dsolve to the equations.

Below is the solution. Since you have not given initial conditions for the variables, the solution contains integration constants c__i. Maple cannot solve the second differential equation symbolically and returns the equation unchanged. This does not mean that there is no such solution. It simply means that Maple does not provide such a solution. You have to give initial conditions for the variables, numerical values for the parameters of the equation and solve numerically with dsolve.

NULL

diff(Q1(t), t) = -k1*Q1(t)

diff(Q1(t), t) = -k1*Q1(t)

(1)

 

diff(Q2(t), t) = k1*Q1(t)+k3/Q2(t)-k2*Q2(t)-k4*Q2(t)

diff(Q2(t), t) = k1*Q1(t)+k3/Q2(t)-k2*Q2(t)-k4*Q2(t)

(2)

 

diff(Q3(t), t) = k4*Q2(t)

diff(Q3(t), t) = k4*Q2(t)

(3)

 

diff(Q4(t), t) = k2*Q2(t)-k3/Q2(t)

diff(Q4(t), t) = k2*Q2(t)-k3/Q2(t)

(4)

 

dsolve({diff(Q1(t), t) = -k1*Q1(t), diff(Q2(t), t) = k1*Q1(t)+k3/Q2(t)-k2*Q2(t)-k4*Q2(t), diff(Q3(t), t) = k4*Q2(t), diff(Q4(t), t) = k2*Q2(t)-k3/Q2(t)})

[{Q1(t) = c__3*exp(-k1*t)}, {diff(Q2(t), t) = (k1*Q1(t)*Q2(t)-k4*Q2(t)^2-k2*Q2(t)^2+k3)/Q2(t)}, {Q3(t) = Int(k4*Q2(t), t)+c__2}, {Q4(t) = Int((k2*Q2(t)^2-k3)/Q2(t), t)+c__1}]

(5)

NULL

Download System_Of_Differential_Equations_reply.mw

An example would be helpfull. Other users could compare the perfomance of your system to their system.

To start you can compare your system to this one (i7-10710U CPU @ 1.10GHz):

f := sin(x + y) - exp(x)*y = 0:
g := x^2 - y = 2:
CodeTools:-Usage(fsolve( {f, g}, {x = -1..1, y = -2..0} ));

memory used=7.79MiB, alloc change=33.00MiB, cpu time=94.00ms, real time=87.00ms, gc time=0ns

A recent processor model i9-13900H 2.6 GHz ("high" performance mobile) is about 3 times faster in cpu time. You will not get much more speed on a laptop.

The graphics card is probably not used for your problem. You can check in task manager for GPU usage.

Q1: Your setup looks good, however for a better overview on the structure of the problem it is helpfull to replace all subexpression that do not depend on the unkowns lambda[i] by new parameters (new names). Do denom(eq1) for example to see what we are dealing with. These are big expressions.

Q2: Ok

Q3:Yes, see Q1. You can for example use innert operators when defining the equations

pTRw:=((p%^T) %. R) %. w

In this case I would not use the assignemt operator (":=") to define p, R, w. Use equations for later substitution/evaluation like p=...

Concerning the problem:

You want to solve a system of polynominal equations. The equations are of 4th degree. Try for all equations and unknowns the following to investigate:

degree(simplify((eq1-lambda[1])*denom(eq1)),lambda[1])
                               4

As you posed the problem Maple assumes all parameters complex. This adds, besides the size of the equations, an addtional burden to Maple. It could be that there are symbolic solutions in the complex domain but Maple has to investigate many cases. This takes time.

Therefore, reducing the complexity of the problem by using assumptions and upfront simplification of the equations helps allot.

Maybe a soluton by hand is possible but for that we have to see the structure of the equations in the first place

Here are some more but not all solutions.
To find at least some non-trival solutions, I have attached a way to reduce the number of equations from 8 to 4. This was possible because your system of equations has a sparse structure (i.e. not all equations depend on all unknows -> see the white gaps).

It is now much easiere to find some non-trivial solutions for the remaining unknowns

It also looks like that for x5=0 and x7=0 any real value for x1 and x4 is allowed.

For an extended search of solutions I have to hand over to someone more gifted in using fsolve and other rootfinding tools of Maple. If you do not know ranges with roots you can deduce them from the attachement.
I hope this is a good start.

question1118_reply.mw

Compact display seems to prevent rendering of partial differentials. Attached is a version that does not use compact display but alias instead.

Update:
I have attached a second version that resolves the issue with varphi not beeing rendered compact

restart

interface(version)

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

(1)

with(Physics[Vectors])

NULL

NULL

macro(Av = A_(x, y, z, t), `ϑ` = `ϕ`(x, y, z, t), Vv = v_(x, y, z, t), Fv = F_(x, y, z, t))

show, ON, OFF, kd_, ep_, Av, vartheta, Vv, Fv

(2)

 

alias(A__x=A__x(x, y, z, t),A__y=A__y(x, y, z, t),A__z=A__z(x, y, z, t),v__y=v__y(x, y, z, t),v__z=v__z(x, y, z, t)); # does not work for varphi

A__x, A__y, A__z, v__y, v__z

(3)

 

Fv = q*('-VectorCalculus[Nabla](`ϑ`)'-(diff(Av, t))+`&x`(Vv, `&x`(VectorCalculus[Nabla], Av)))

F_(x, y, z, t) = q*(-Physics:-Vectors:-Nabla(varphi(x, y, z, t))-(diff(A_(x, y, z, t), t))+Physics:-Vectors:-`&x`(v_(x, y, z, t), Physics:-Vectors:-Curl(A_(x, y, z, t))))

(4)

Av = A__x(x, y, z, t)*_i+A__y(x, y, z, t)*_j+A__z(x, y, z, t)*_k, Vv = v__x(x, y, z, t)*_i+v__y(x, y, z, t)*_j+v__z(x, y, z, t)*_k, F_(x, y, z, t) = F__x*_i+F__y*_j+F__z*_k

A_(x, y, z, t) = A__x(x, y, z, t)*_i+A__y(x, y, z, t)*_j+A__z(x, y, z, t)*_k, v_(x, y, z, t) = v__x(x, y, z, t)*_i+v__y(x, y, z, t)*_j+v__z(x, y, z, t)*_k, F_(x, y, z, t) = F__x*_i+F__y*_j+F__z*_k

(5)

subs[eval](A_(x, y, z, t) = A__x(x, y, z, t)*_i+A__y(x, y, z, t)*_j+A__z(x, y, z, t)*_k, v_(x, y, z, t) = v__x(x, y, z, t)*_i+v__y(x, y, z, t)*_j+v__z(x, y, z, t)*_k, F_(x, y, z, t) = F__x*_i+F__y*_j+F__z*_k, F_(x, y, z, t) = q*(-Physics[Vectors][Nabla](varphi(x, y, z, t))-(diff(A_(x, y, z, t), t))+Physics[Vectors][`&x`](v_(x, y, z, t), Physics[Vectors][Curl](A_(x, y, z, t)))))

F__x*_i+F__y*_j+F__z*_k = q*(-(diff(varphi(x, y, z, t), x))*_i-(diff(varphi(x, y, z, t), y))*_j-(diff(varphi(x, y, z, t), z))*_k-(diff(A__x(x, y, z, t), t))*_i-(diff(A__y(x, y, z, t), t))*_j-(diff(A__z(x, y, z, t), t))*_k+(-v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_i+(-v__z(x, y, z, t)*(diff(A__y(x, y, z, t), z))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), y))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__y(x, y, z, t), x)))*_j+(v__y(x, y, z, t)*(diff(A__y(x, y, z, t), z))-v__y(x, y, z, t)*(diff(A__z(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__z(x, y, z, t), x))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_k)

(6)

map(Component, F__x*_i+F__y*_j+F__z*_k = q*(-(diff(varphi(x, y, z, t), x))*_i-(diff(varphi(x, y, z, t), y))*_j-(diff(varphi(x, y, z, t), z))*_k-(diff(A__x(x, y, z, t), t))*_i-(diff(A__y(x, y, z, t), t))*_j-(diff(A__z(x, y, z, t), t))*_k+(-v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_i+(-v__z(x, y, z, t)*(diff(A__y(x, y, z, t), z))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), y))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__y(x, y, z, t), x)))*_j+(v__y(x, y, z, t)*(diff(A__y(x, y, z, t), z))-v__y(x, y, z, t)*(diff(A__z(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__z(x, y, z, t), x))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_k), 1)

F__x = -v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))*q+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))*q+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))*q-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z))*q-(diff(varphi(x, y, z, t), x))*q-(diff(A__x(x, y, z, t), t))*q

(7)

collect(F__x = -v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))*q+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))*q+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))*q-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z))*q-(diff(varphi(x, y, z, t), x))*q-(diff(A__x(x, y, z, t), t))*q, [q, v__x(x, y, z, t), v__y(x, y, z, t), v__z(x, y, z, t)])

F__x = (v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x)-(diff(A__x(x, y, z, t), y)))+(diff(A__z(x, y, z, t), x)-(diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(diff(varphi(x, y, z, t), x))-(diff(A__x(x, y, z, t), t)))*q

(8)

convert(F__x = (v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x)-(diff(A__x(x, y, z, t), y)))+(diff(A__z(x, y, z, t), x)-(diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(diff(varphi(x, y, z, t), x))-(diff(A__x(x, y, z, t), t)))*q, Diff)

F__x = (v__y(x, y, z, t)*(Diff(A__y(x, y, z, t), x)-(Diff(A__x(x, y, z, t), y)))+(Diff(A__z(x, y, z, t), x)-(Diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(Diff(varphi(x, y, z, t), x))-(Diff(A__x(x, y, z, t), t)))*q

(9)

 

convert(F__x = (v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x)-(diff(A__x(x, y, z, t), y)))+(diff(A__z(x, y, z, t), x)-(diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(diff(varphi(x, y, z, t), x))-(diff(A__x(x, y, z, t), t)))*q, D)

F__x = (v__y(x, y, z, t)*((D[1](A__y))(x, y, z, t)-(D[2](A__x))(x, y, z, t))+((D[1](A__z))(x, y, z, t)-(D[3](A__x))(x, y, z, t))*v__z(x, y, z, t)-(D[1](varphi))(x, y, z, t)-(D[4](A__x))(x, y, z, t))*q

(10)

 

Download error_display-2.mw

error_display-2-1.mw

Partial derivative of a summation: why it is not just 2*`X__i`?

Answer: The output of Maple is correct because you differentiated for all i from 1 to n. How can Maple know which i you are interested in? If you expect only 2*X__i as output the information about the range for i from 1 to n is lost.

` `*`Partial derivative of a double summation: how to define the nested structure of a double summation where j<>i?`

Answer: B__wrong is correct. Maple only automatically simplified it. You can use Sum instead of sum to prevent this

` `*`System of n equations: how to define and solve for it?`

You must give n a number. Example for n=m=5

m:=5;
A := sum(X[i]^2, i = 1 .. n);
eqs:=seq(diff(eval(A = 0,n=j),X[j]),j=1..m);
vars := seq(X[i], i = 1 .. m);
solve({eqs}, {vars})
                             m := 5

                               n        
                             -----      
                              \         
                               )       2
                        A :=  /    X[i] 
                             -----      
                             i = 1      

eqs := 2 X[1] = 0, 2 X[2] = 0, 2 X[3] = 0, 2 X[4] = 0, 2 X[5] = 0

              vars := X[1], X[2], X[3], X[4], X[5]

       {X[1] = 0, X[2] = 0, X[3] = 0, X[4] = 0, X[5] = 0}

What you experience are numerical integrations errors.

method=rosenbrock gives a slightly deceasing energy.