Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Differential Equations with Discontinuities

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

07-16-2021
01:30 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-16-2021
01:30 PM

Differential Equations with Discontinuities

I am solving a system of odes with imposed discontinuites on the right hand side. I can do this by calling a solver up to the time of the discontinuity, imposing the jump condition, and then restarting the calculation (as in the attached worksheet). But I want to do this for a series of discontinuities. Since all the jumps are the same magnitude and occur at regular time intervals, it seemed like there should be a way to program it rather than doing it manually, but I could not see how to do it. Can anyone help?

Labels:

6 REPLIES 6

07-18-2021
07:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-18-2021
07:05 AM

Attached is a version using Odesolve (Mathcad 15). For more than two sets of discontinuous jumps you should be able to modify it in an obvious way.

It produces the following sort of results

Alan

07-18-2021
02:32 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-18-2021
02:32 PM

Thanks for the reply. It seems like that should work but your plot does not show a discontinuity in theta (t) at t = 1000. I did not show the plot of this in my previous post, but it is shown below:

Ultimately, I would like to do this for a staircase of discontinuties (with the same stepsize and time interval). BTW, I used dk=0 even though k is constant so I could change the value in the initial condition for different cases (though I think this is easier to do with Odesolve). I have not been using Odesolve because in looking at similar systems I have had a lot of trouble with convergence, the error "return value does not match...", and instabilities that is sometimes helped by fiddling with different solvers and tolerances.

07-20-2021
02:30 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-20-2021
02:30 PM

A little more like this then, where I've kept k constant and only solved for v and theta (you should be able to extend the method to the others easily enough). I've also added another step:

Alan

07-20-2021
08:11 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-20-2021
08:11 PM

Thanks. Looks good, but I will have to study a bit to make sure I understand.

07-21-2021
03:52 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-21-2021
03:52 PM

Hi Alan,

There still seems to be a discrepancy in how the jumps are implemented as shown below. JWRCalc uses my (laborious) method in worksheet Jumps04_jwr. Plot is added to the bottom of your worksheet in Jumps04_as. I could not detect where the problem is.

07-23-2021
05:38 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-23-2021
05:38 PM

I looked at this a little more but could not see how to modify your program to capture the jumps accurately (see bottom of attached worksheet). I do not know that it is possible using odesolve because it interpolates between the solution points. The manual way I did it, the same time value is assigned to the indices N and N+1, but the state (theta) has different values for N and N +1. So it gets the discontinuity exactly. I could not see how to adapt your program to do this by calling the solvers directly. So, unless you have some other suggestions, I guess I am stuck with solving between the discontinuites, implementing the jump condition and repeating. But thanks for your help.