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
- :
- Mathcad 15 stuck due to loop

Options

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

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

Showing results for

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

05-02-2013
03:51 AM

05-02-2013
03:51 AM

Mathcad 15 stuck due to loop

Hi,

My program implements a loop, when I increase my loop size , mathcad get stuck

doent show any output neither save anything. Kindly anyone could guide about this issue.

Thanks and Regards.

4 REPLIES 4

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

05-02-2013
04:39 AM

05-02-2013
04:39 AM

Re: Mathcad 15 stuck due to loop

Could you please upload a worksheet.

Mike

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

05-02-2013
05:51 AM

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

05-02-2013
06:40 AM

05-02-2013
06:40 AM

Re: Mathcad 15 stuck due to loop

It looks like the program is very slow due to the reallocation of memory for the delay_err array.

Try the attached snippets. (You will need to enable the debug window to see the 'trace' output.)

Regards

Andy

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

05-02-2013
11:09 AM

05-02-2013
11:09 AM

Re: Mathcad 15 stuck due to loop

Find attached some remarks. and comments. E.g. I'm not sure if you really want your vector Preamble to be constructed the way you did.

As Andy pointed out, it will not be necessary to initialize a Matrix element by element to zero. Most of the time you will not need to initialize at all. mathcad will create/enlarge a Matrix as needed and fills in zeros itself.

As written the number of cycles of the m-loop is dependend exponentially by the upper value of the L-range. To find out which routine is the most promising candidate for optimizing you will have to use trace, as Andy pointed out.

EDITED: I additionally attached an streamlined version "updated_3") and hope its correct. The different result are mainly (I think) because you did not reset your vector Binary and so got vectors of wrong length. Again, still read the comments in "updated_2".

The main question now is: Why do you need the L-loop and a 2-dimensional matrix? The row for the largest L will always include all the others. The value of L is used only to determine the largest value for m in the inner loop, so the results should be (and are) the same. L is also used as max-digits for the decimal to binary conversion but has no effect there, as the values converted alway have less than L bits in their full representation.