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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Return Value of this function must match the problem size

JohnRudnicki
14-Alexandrite

Return Value of this function must match the problem size

What does this mean? I could not find it in the list of error messages. The attached program was working until I set a_1, b_1 and d_1 = 0.

10 REPLIES 10
LucMeekes
23-Emerald III
(To:JohnRudnicki)

Can you save the file as a Mathcad 11 .mcd file and attach?

 

Luc

JohnRudnicki
14-Alexandrite
(To:LucMeekes)

Saved as MC11. Sorry, Luc, I forgot that you are even further behind on versions that I am. Thanks for taking a look.

LucMeekes
23-Emerald III
(To:JohnRudnicki)

After some fumbling this works:

LucMeekes_0-1619805844004.png

Note that Mathcad 11's Radau only knows 5 parameters, not 6.

 

Success!
Luc

JohnRudnicki
14-Alexandrite
(To:LucMeekes)

That worked until I made a (I thought, fairly innocuous) change in the second row of Dr. Then I got the same problem with S02 and S03 (though S01 still worked).

LucMeekes
23-Emerald III
(To:JohnRudnicki)

So you multiplied the second row with

LucMeekes_0-1619851147688.png

Mathcad11 has no problems with that.

The results are:

LucMeekes_1-1619851558981.png

Attached is a PRN file from:

LucMeekes_2-1619851873032.png

(Zipped of course, due to the forum not supporting .PRN files)

Also attached is the Mathcad 11 file with a copy of the D(t,y) set of expressions.

 

Success!

Luc

JohnRudnicki
14-Alexandrite
(To:LucMeekes)

Maybe I misunderstood your suggestion but when I ran your file with MC14 using Dc instead of D, the same problem occured

JohnRudnicki_0-1619866851350.png

The numerator of the first line was too long to check, but otherwise the expressions for D and Dc were equivalent. When I changed the solver from Radau to BDF the file ran and appeared to give solutions of the expected form. Not the most satisfying solution, but  it works. Unless you have other suggestions for sorting this out, I will go with it. Also, if you have some explanation for what is going on here, I would like to hear it.

 

Thanks for your help.

 

LucMeekes
23-Emerald III
(To:JohnRudnicki)

I'm no expert on Mathcad 14. All I can assume is that Mathcad 14 has a different Radau algorithm, different from the one in Mathcad 11. And/or it probably runs into a problem when it needs to determine the functions for a longer time, or another initial condition than what you set for the first, S01.

Can you run S01 for tend=160 (like what S03 is trying)?

Otherwise, can you run S02 until tend=50?

Another option is the step size, determined from start and end time and the number of points. Can you run S01 with 1/6th of the value of N?

 

Success!
Luc

JohnRudnicki
14-Alexandrite
(To:LucMeekes)


@LucMeekes wrote:

I'm no expert on Mathcad 14. All I can assume is that Mathcad 14 has a different Radau algorithm, different from the one in Mathcad 11. And/or it probably runs into a problem when it needs to determine the functions for a longer time, or another initial condition than what you set for the first, S01.

Can you run S01 for tend=160 (like what S03 is trying)?

Yes S01 still works

Otherwise, can you run S02 until tend=50?

Yes. S02 still gives the same error.

Another option is the step size, determined from start and end time and the number of points. Can you run S01 with 1/6th of the value of N?

Tried N/5 (needed to be an integer). S01 still works.

 

Initial conditions definitely matter. Note that for S01 IC, the coefficient of the oscillatory terms are zero. It is not for S02 and S03. (But those are the cases I am most interested in. S01 is for comparison) This seems to be what is causing the problem. I tried with that coefficient = 0.0001 (S04) and a shorter end time (50) but got the same error.

 

JohnRudnicki_0-1620056764758.png

 


 

LucMeekes
23-Emerald III
(To:JohnRudnicki)

No surprise: Mathcad 11 calculates all your set-ups.

What if you play with tolerance (the additional parameter to the Radau function)?

 

Otherwise, I'm willing to calculate one or more setup's for you, if you provide the Mathcad file including a WRITEPRN for whatever result data you need.

 

Success!
Luc

 

JohnRudnicki
14-Alexandrite
(To:LucMeekes)


@LucMeekes wrote:

No surprise: Mathcad 11 calculates all your set-ups.

Hmm. That is interesting. 

What if you play with tolerance (the additional parameter to the Radau function)?

Tried it, but no success

Otherwise, I'm willing to calculate one or more setup's for you, if you provide the Mathcad file including a WRITEPRN for whatever result data you need.

 

That is a very generous offer, but I have too many cases I need to explore. And BDF is working with the cases I have looked at so far. Maybe I will try to see what Matlab gives if I can get someone to help with programming. In any case, thanks for taking a look at this.

 

Success!
Luc

 


 

Top Tags