1
$\begingroup$

I have the following set of coupled differential equations subject to some initial conditions which I can solve using NDSolve (after assigning numerical values for remaining arbitrary coefficients):

{
    Mt x''[t] == 
     - k1 x[t] - k2 (x[t] - y[t]) + 
      mc rcm Sin[ϕ[t]] ϕ''[t] - γ x'[t],

    Mt y''[t] == 
     - k1 y[t] - k2 (y[t] - x[t]) + 
      mc rcm Sin[ψ[t]] ψ''[t] - γ y'[t],

    Inertia ϕ''[t] + 
     mc g rcm Sin[ ϕ[t]] + 
      γm ϕ'[t] ((ϕ[t]/θ0)^2 - 1) + 
       mc x''[t] rcm Cos[ϕ[t]] == 0 ,

    Inertia ψ''[t] + 
     mc g rcm Sin[ ψ[t]] + 
      γm ψ'[t] ((ψ[t]/θ0)^2 - 1) + 
       mc y''[t] rcm Cos[ψ[t]] == 0
 }

subject to the following initial conditions

{
    x[1] == 1, 
    x'[1] == 1, 
    y[1] == 1, 
    y'[1] == 1, 
    ϕ[1] == 1, 
    ϕ'[1] == 1, 
    ψ[1] == 1, 
    ψ'[1] == 1
 }

The system can be solved using NDSolve. Now I have two problems.

  1. Instead of a single ϕ and ψ, I want to write down and find the solution for general ϕi and ψi with remaining parameters in the equations unchanged, and where i goes from 1 to N (i.e. instead of 2 coupled ODEs involving ϕi and ψi, we have 2N coupled ODEs each involving a specific ϕi and ψi). Here N is input by hand before finding the solution. The initial conditions can also be defined accordingly. How do I write and solve for the same?

  2. After this is solved, starting from the same initial conditions, I want to vary the values of k1, k2 and rcm with some step size each time; and want to get the final values of ϕi and ψi after some finite time. How do I do that?

Any suggestions will be greatly helpful.

$\endgroup$
5
  • $\begingroup$ You might get more help if you included parameters and more code. When you say you want N pairs of ODEs, are those pairs coupled to each other? Do they have same parameters? $\endgroup$
    – Chris K
    Jan 8 '18 at 4:38
  • $\begingroup$ @ChrisK sorry for the confusion. I did include the relevant parameters in the differential equations. What I meant by N pairs of ODEs is that I want to index [Phi] and [Psi] by using [Phi]_i and [Psi]_i, with the equations for them exactly same as the original one. So given some input value of N, I have total 2N equations involving [Phi]_i and [Psi]_i, with all being of the same form. $\endgroup$
    – Bruce Lee
    Jan 9 '18 at 15:24
  • $\begingroup$ Could you provide values for parameters such as Mt, k1, k2, mc, etc? $\endgroup$
    – Chris K
    Jan 10 '18 at 15:12
  • $\begingroup$ @ChrisK you can give all these parameters some numerical value by hand and use NDSolve to solve the equations. For specifically k1, k2 and rcm; after assigning them some initial value, I want to keep increasing the value with a step size each time; and want to get the final values of [Phi]_i and [Psi]_i after some finite time evolution. $\endgroup$
    – Bruce Lee
    Jan 10 '18 at 15:51
  • $\begingroup$ I believe Table will help you. $\endgroup$
    – xzczd
    Jan 12 '18 at 6:00
1
+50
$\begingroup$

I suggest you use matrix forms to generalize your equations. since I do not have general equations for xn, yn,ϕn,ψi, can only generalize what you have given to me.

I start with the following vectors:

R = {x[t], y[t], \[Phi][t], \[Psi][t]};
Q = {0, 0, \[Phi][t], \[Psi][t]};
zero = {0, 0, 0, 0};

Then I define the following matrices:

A = {{mt, 0, -mc rcm Sin[\[Phi][t]], 0}, {0, mt, 
0, -mc rcm Sin[\[Psi][t]]}, {-mc rcm Cos[\[Phi][t]], 0, Inertia, 
0}, {0, -mc rcm Cos[\[Psi][t]], 0, Inertia}};
B = {{\[Gamma], 0, 0, 0}, {0, \[Gamma], 0, 0}, {0, 
0, \[Gamma]m ((\[Phi][t]/\[Theta]0)^2 - 1), 0}, {0, 0, 
0, \[Gamma]m ((\[Psi][t]/\[Theta]0)^2 - 1)}};
Cc = {{k1 + k2, -k2, 0, 0}, {-k2, k1 + k2, 0, 0}, {0, 0, 0, 0}, {0, 0,
 0, 0}};
Dd = mc rcm Sin[Q];

The final equations can be derived and solved as follows:

eq=A.D[R, {t, 2}] + B.D[R, t] + Cc.R + Dd == zero;
NDSolve[{eq, conditions}, R, {t, tmin, tmax}]

you can see that the elements of following vector

G = A.D[R, {t, 2}] + B.D[R, t] + Cc.R + Dd

would yield the the equations correctly, i.e.

G[[1]]==0

gives the correct equation for x[t], and so on. As next step, generalizing these matrixes would be easy since you only need to add terms regarding new ϕs and ψs.

$\endgroup$
3
  • $\begingroup$ Bruce Lee, Perhaps if you give the set of equations for ϕ1 and ψ1 and ϕ2 and ψ2 and how they fit with x and y equations, I can generalize it for you using my method so you can understand how to use it for large number of ϕ and ψ . $\endgroup$ Jan 16 '18 at 17:52
  • $\begingroup$ Hi, sorry for being late. I will tell you the physical problem first, maybe that might be more helpful. I have 2 plates, bound to springs, moving in 1D, whose positions are given by x and y. Now I place n oscillators on each of the plates. The phases of the oscillators on the first plate is phi, on the second is psi. In the differential equation I wrote; I computed the equation for one oscillator on each plate, which was indexed by phi and psi. $\endgroup$
    – Bruce Lee
    Jan 17 '18 at 4:28
  • $\begingroup$ Since the differential equations for the n phases have the same structure, so what I meant earlier was that the equations for ϕn and ψn are all same as those of ψ and ϕ, in their couplings and x dependences. So what I wanted was to write down a large number of differential equations with the same structure with ψ and ϕ indexed by n. x and y aren't indexed, they remain x and y only. Thanks. $\endgroup$
    – Bruce Lee
    Jan 17 '18 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.