Stiff ode solvers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Stiff ode solvers
I previously posted a version of this question, but did not get any response. So I decided to rephrase and try again.
I have been trying to compare the solvers (BDF, Radua, Stiffr and Stiffb) for stiff odes. Could be doing something stupid but BDF is the only one that I can get to run consistently. For the others I get error messages I do not understand (in this context):
"The return value of this function must match the problem size"
"This value must be real"
(BTW. Documentation says Stiffb does not work for more than 8 equations, but it seems like it should be "8 or more". 7 worked. 8 did not.)
Thanks to anyone who chimes in.
If you run the worksheet, be patient. It takes a while to calculate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
What is the initial setting of the problem that you want to solve with the program?
P.S. Crosspost: https://community.ptc.com/t5/PTC-Mathcad/Error-messages-in-solving-a-system-of-ode-s/m-p/704764
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The constant tp is neither defined nor initialized anywhere. How does the processor calculate sin (2πt / tp)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@-MFra- wrote:
The constant tp is neither defined nor initialized anywhere. How does the processor calculate sin (2πt / tp)?
The solve block is evaluated symbolically and the result is assigned to a function D which has tp (substituted by y[5) as one of its arguments. So all is OK and when you let the sheet run it works OK (at least with BDF and Radau & IC21).
BTW, VladimirN had unearthed a more than 8 months old question and obviously no one had an idea so far why the solvers other than BDF fail.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Although you work in symbolic, don't you have to initialize the variables first and then reset them for symbolic computation? otherwise if you write tp = ? before the Given, it marks it in red. As a result nothing changes, on this I agree.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Why would you write tp = ... ? Sure the variable is not defined but its not necessary to define it as its just used as a formal function argument (disguised as y[5).
A solve block which is evaluated symbolically (a feature not available in Prime) does not need any guess values for the variables solved for.
Here is an example to demonstrate defining a function similar but much simplified to the one in the worksheet. Neither a nor b need to be initialized - "a", because we evaluate symbolically and "b" because its provided as function argument:
And here is the same using "substitute" to change the name of the formal function argument, similar to the procedure done in the worksheet but not using a vector as we only deal with one single variable:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for the clarification. However, I always prefer to define variables and then reset them in case I need them for a symbolic calculation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@-MFra- wrote:
Thanks for the clarification. However, I always prefer to define variables and then reset them in case I need them for a symbolic calculation.
You sure do not define a variable x if you intend to define a function f(x):=.... later.
And so it also was not done in the worksheet with the variable tp (and others). The use of the solve block with symbolic evaluation and the substitution with x[5 just obscured the fact, that its just a "simple" definition of a function D of tp and other arguments.
But of course I agree thats its often good habit to define variables (and un-define them symbolically) which are used in symbolic evaluations and assignments to avoid the error from the numeric engine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Please delete. Thank you.
