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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Recursion Bug 2021 09 20

StuartBruff
23-Emerald III

Recursion Bug 2021 09 20

Under Mathcad Prime 7.0 and Mathcad Express 7.0, this worksheet causes Mathcad to either lock up or to stop running (just disappears) when the first 2 "integrate" function calls (highlighted in orange) are evaluated.
The 2 regions are disabled upon loading.
 
  • Enabling either region by itself and calculating the worksheet results in an expected message, "This expression cannot be evaluated.  It may have resulted in an overflow or infinite recursion.".
  • Enabling both regions causes Mathcad to fail to respond to user input for a short, but variable period of time, before crashing.   Usually, Mathcad just disappears and is present in neither Task Manager's Process List or Details List.
The regions below (in the worksheet) are an extract from a Mathcad Express 6.0 worksheet, which ran without problem under Mathcad Express 6.0.
 
I'm running Mathcad under Windows 10 Professional on a Lenovo T450p equipped with 16 GiB RAM.
 
2021 09 20 A.png
 
Stuart
7 REPLIES 7
LucMeekes
23-Emerald III
(To:StuartBruff)

Your machine may be too fast, or did you (un-)set simultaneous (multithreading) calculation?

Anyway, if I load your file, select both equations and "Enable Region" I see the left one calculating until the 'infinite loop' error, then the right one follows the same..

Ah, after some playing I found that setting 'Approximate equality' will have Prime find a numerical result. And (un-)setting that and/or multithreading will have Prime trying to calculate both equations simultaneously after which it does crash.

 

And Prime 4 does the same. I didn't test Prime6 (yet). Prime 4 file attached.

I suspect the problem lies fully with 'multithreading'...

 

Success!
Luc

StuartBruff
23-Emerald III
(To:LucMeekes)

Interesting.   Thanks, Luc.

 

It would appear as if the multithreading is the cause of the bug (yes, bug, multithreading shouldn't cause Mathcad to lock up or crash ... unless someone wishes to claim it's an 'undocumented feature'!).   Turning multithreading off 'cured' the problem in my main worksheet, but I regard it as a workaround, not a true solution.   

 

The recursion failures are quite deliberate and demonstrate both the need to take care both with recursion termination and numerical round-off effects.   Consequently, turning on approximate Approximate Equality isn't an option.

 

Cheers,

 

Stuart

 

PS.  My Lenovo's ancient by computer standards.  It's running a 4th-generation, 2-core i5, working with DDR3L RAM.   According to my sons, it should be in a museum ... as should I and the 2012 MacBook Pro I'm writing this response on.

LucMeekes
23-Emerald III
(To:StuartBruff)

I fully agree: It's a bug.

 

By that standard my computer is antique: AMD Athlon 64 X2 dual core 3800+, 2 GHz, 4GB. It initially ran WinXP.

 

Luc

StuartBruff
23-Emerald III
(To:LucMeekes)


@LucMeekes wrote:

I fully agree: It's a bug.

 

By that standard my computer is antique: AMD Athlon 64 X2 dual core 3800+, 2 GHz, 4GB. It initially ran WinXP.

 

Luc


They were good machines in their day.  I hear Noah used one to do CAD work on The Ark.   😈

 

My younger son has taken an interest in industrial archaeology ... starting with the Amstrad 8086 PC I've somehow retained over the decades, along with a Sinclair QL, an Atari 520 and a pristine Sinclair Z88.   Unfortunately, I lost my Nascom Mk 1, Jupiter Ace, Sinclairs ZX-81 & Spectrum, BBC Micro, Acorn Atom and a few other early PCs, in a house move some years ago.   

 

It's strange to think that I used to gloat over my massive 2 KiB RAM or 80 MB HDD when I now moan pitifully about only having a mere 16 GiB RAM and coupe of terabytes of HDD plus half a terabyte of SSD ...  I might have to build a cluster to get at least some computational power.

 

Cheers,

 

Stuart

ttokoro
20-Turquoise
(To:StuartBruff)

X=0 ->    x>= 0  then dx=0.1 is  evaluated.  

 

image.pngimage.pngimage.png

image.pngimage.pngimage.png

image.pngimage.pngimage.png

StuartBruff
23-Emerald III
(To:ttokoro)

Thanks for the comment.  The function form was deliberate to show up the numerical error.   I note that you've hit Mathcad Prime's recursion depth limit for δx = 0.0001 (n=10,000) - the depth limit is about 4,500, hence the error.

 

Stuart

StuartBruff
23-Emerald III
(To:StuartBruff)

Oh, slip of the keyboard, there ... the PC is a T540p, not a T450p.

Announcements

Top Tags