cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

solving second order ODE more efficiently

googly1988
1-Newbie

solving second order ODE more efficiently

Hello,

I have got a linear set of two ordinary differential equations of second order with two unknowns. The starting conditions are known. However, depending on the result an external disturbance must be considered. Once this disturbance occurs the same equations hold but at the time of the disturbance, new inital conditions depending on the previously calculated solution, must be considered.

Currently, I have managed to solve this problem by setting up a first mathcad sheet for the interval from the start till the the first external disturbance. I have also created a second mathcad sheet for the second interval from after the first disturbance to the second disturbance. And so on.

Unfortunately, I have to consider many disturbances and not just a few. As I would like to perform a parameter studies, I suppose my current approach is not suitable. I am currently using MATHCAD 14 and have only used ODESOLVE to solve my problem so far. If anybody has an idea as how my problem could be implemented in MATHCAD more efficiently, kindly let me know. Thanking you in advance for any help in this regard.

Thank you.

14 REPLIES 14

Make an image of the system, attach in the forum. Your description impacts as if some components of the system is subjected to "non-linear" parameters. Odesolve is valid for DE's with non linear coefficients. At least it is for a large class of known variable coefficients DE's. From what you are saying, you know what value at each step, which in your description it corresponds to recasting the system. Don't be short of an abstract, a very descriptive abstract.

jmG

Hello,

Thank you for your reply. I have attached my worksheet and would also like to state some details for your reference. First I have obtained a free decay response and from that I have to determine the new initial conditions. The value of x2(t) must be either +/- 2 in this case. From the plot I pick the time point where x2 reaches the value of 2(+/-). I have done this each time seperately as it is just two times that we obtain the value of x2=+/- 2 after which it decreases.I would like to know in case where x2 reaches +/- 2 a number of times, is it possible to write a program that will do the same calculation esily instead of calculating the IC seperately each time. I would also like to know if its better to do the same using a programming language like C++ or Fortran or so. As I am not familiar with MATH CAD, any help in this regard will be highly appreciable. If you need further information regarding the problem, please let me know.Thank you once again.

regards,

Nandita Nanjappa.

Mathcad 11 can't read your work sheet. I don't understand why you have to recalculate initial conditions so many times and past a certain behaviour the IC's aren'r needed anymore. The project looks like the bouncing ball project. It has a solution without solving DE.

jmG

Hello,

Thank you for your reply...I have attached the file compatible with mathcad 11 and I hope it works now. I don`t really know which bouncing ball project you are referring to..my problem is quite similar to that I guess but the available space for the movement of the ball is restricted by a value of 2. That is why I have to determine the time point at which the value of x2 is ±2(select the alternating values) and then recalculate the initial conditions each time with the given formulas which gives the velocities after the ball hits the wall. According to my current problem definition, the ball hits the wall only three times but when we have a bigger frequency range, we have more hits and I would like to program this if possible in MATHCAD instead of calculating it each time separately. As I am new to MATHCAD, it would be appreciable if you could either give me some suggestions as to how to program it or some examples(like the bouncing ball one if available) I could refer to. I will be really grateful for any help in this regard. Thank you in advance for your help.

Regards,

Nandita.

Sounds like you want to set up your ODESolve as a function, with the initial conditions and the integration range as variables. Then you can write loop that runs through the disturbances and integrates from one disturbance to the next.

Hello,

Thank you very much for your reply. I wanted to use a similar approach to solve my problem but as I aam not very experienced with MATHCAD, it would be really nice if you could give me an idea or some examples as to how I could write the program. Thank you in advance for your help.

Regards,

Nandita.

Look up the neon bulb oscillator sheet (might be only in the collaboratory -- not everything was copied over here). It shows integrating a system with multiple states.

Hello,

Thank you for the answers. I have seen the example on Neon bulb oscillator and the bouncing ball and found the multistage problem similar to my problem. I re-solved my equations using Rkadapt solver and managed to get a solution.

From the calculated vector of y, I have to select the value of y=2 and the corresponding time point(say t1). At this time point I will have to calculate the values of the following variables i.e x, x`,y,y`.

Then I obtain the vector of new initial conditions which is at time t1:

x(0)=x(t1),y(0)=y(t1)=2

the velocities as the initial conditions will be calculated using the below formulas:

x`(0)= x`(t1)+a*y`(t1)

y`(0)=-e*y`(t1)

Now i have the new initial conditions and will have to solve the equations again. Once again the above process is repeated until I get a value of y=±2.

At some point of the calculation, we no longer obtain y=2 but y<2, at this point we terminate the loop and store the values of x and y at the respective time points and plot them for a number of cycles. That is why, i think the problem is similar to the multi stage problem. I am unable to use the FIND function for some reason(the eg. multistage also failed to work because of the find function), as it always says undefined. I am using MATHCAD 14. Could you please help me define the solve block for finding the value of y= 2 from the vector. I will be really grateful if you could help me in this regard or give me some suggestion to define the program loop. It will be really appreciable. Thank you in advance for your help.

p.s: The problem is a bit like the bouncing ball but the ball motion is restricted by boundaries which is y= ±2. Each time the ball hits the wall, it loses some energy and therefore at some point y<2 showing a loss of energy.

All what you are saying, put it in the work sheet with an abstract to renew the interest. It sounds a physical phenomenon that might have already been solved.

I'm willing to open your work sheet if you "save as" Mathcad 11, but on the first crash ... end of it. The PTC Mathcad versions don't save correctly in the Mathsoft Mathcad versions.

jmG

What I did in sequence:

1 plug the bouncing ball

2. clean and move your graphs

3. crash

4. crashcrashcrash etc.

So, after so many crashes: end of it.

While cleaning, I could visualize but can't do anything . Must understand first what you are trying to do, but you have no abstract. Whether possible or not to set the system recursive , don't know. PTC Mathcad aren't saving in lower version at all, otherwise they would either come red or work. Crashing is the absolute indication of incompatibility. If your system makes sense, it might then have another form. That in a DE system the IC's have to "update" . that's rather unusual . You need to solve the system only once based on the last IC's but how to arrive at the last IC"s ? Maybe a 2d boundary system.

jmG

Hello,

I have tried to program the loop for re-solving the ODE with newly calculated initial conditions for atleast 5 impacts. The program llop has some missing information or a major error as I know I haven`t programmed it correctly. If somebody could check the program and help me modify it, I will be extremely grateful. If you have further questions, please let me know.Any help in this regard will be highly appreciable. Thanking you in advance for your help.

P.S: I have attached the file as both MATHCAD 14 and 11 compatible versions. For MATHCAD 11, i just saved the file as a MATHCAD 11 version using MATHCAD 14 as that`s the only version i have. I hope it works now. If there is an alternative way I could do it then please let me know.

All red in 11. It does not take definition [ ...:=] in the sole block.

Trying to make it work 11 and if you use 14 is incoherent.

You don't have enough project description to evaluate if your

approach applies. In some ways it looks like the "Advection".

jmG

Hello,

Thank you for your reply. I have saved the file in rtf format...hope it is readable now. I also found a example on bouncing ball problem uploaded in MATHCAD resource center and have edited the program loop for finding the new initial conditions. Unfortunately there is still some missing data..I am not sure if we are allowed to parameterise the ode problem using rkadapt. I have tried to do so and then have used the program loop with the root function to determine the time similar to the bouncing ball problem definition. My problem approach is the supposedly similar to the one used in the bouncing ball project but i have a set of second order equations with two unknowns. Could you kindly have a look at my MATHCAD sheet and please try to help me out. I will extremely grateful if you could halp me in this regard. Thank you in advance for your time and consideration.

Regards.

Note: In my problem, i have to determine the time point t at which the value of y = 2(tolerance=0.1) and then determine the values of the new initial conditions for x, x` and y` (the velocities will be calculated with the coefficient of restitution) and the solve the ODE with the new IC and repeat this loop until y = 2 is no longer obtained and also y<2.

Posting a Word document is pure waste of time. Mathcad 11 does not open your version and I won't open again because it does crashes my all box. If you have no more project description than before it will be difficult for collabs to analyze and conclude that your system is posed correctly. Do you have some web material, a valid model, is it home work ?

jmG

Top Tags