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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Expression is to large to be calculated

mbeaumont
6-Contributor

Expression is to large to be calculated

Hello,

I am trying to write a programme in Mathcad Prime 3.1. I am using the programme to compute the global stiffness matrices of bars in a structural system (just a 6x6 matrix). However Mathcad is returning an error message saying that the expression is too large to be calculated (see attached image). Surely Mathcad shouldn't have any trouble with such an expression. It was outputting correct values until the 4th row at which point it started returning this message.

Has anyone encountered this before and know how to work around it?

Cheers,

Mike

1 ACCEPTED SOLUTION

Accepted Solutions

I just grabbed a machine with P3.1 and played with your file.

In my opinion its clearly a bug and you may consider reporting it (if you are under maintenance)

I set i:=1 for test purpose and your 6 x 6 matrix still failed. This means, that the problem is not the vector of matrices but the matrix itself.

Also symbolic evaluation of the matrix throws the same error. This may indicate that the error occurs before any routine (numeric or symbolic) tries to evaluate.

I created a 6x6 matrix filled with 1's and evaluated it. Then I copied one expression after the other and for a while all was OK until about two thirds of the matrix was filled with your expressions. Then eventually after adding an additional expressions from your matrix, evaluation failed. It did not matter which expression I copied - its not a specific expression throwing the error. So there is nothing wrong with your sheet and your approach - its a bug in Prime.

It would be interesting to see if the same approach works in Mathcad 15 but I could not be bothered retyping the whole sheet and there is no way to convert the sheet.

So far the only workaround is to split your matrix in halves, generate it and then stack the halves together using "stack". interestingly enough this approach worked OK:

Regards

Werner

View solution in original post

14 REPLIES 14

Unfortunately I can't read 3.1 files (just 3.0) and so I don't see what you are doing.

But I guess you are using the symbolic solve command when you run in this annoying "the expression is too large to display..." problem.

Do you really need symbolic solutions? Maybe a numeric solve block would do the job as well with less troubles.

EDIT: Sorry - just realized that you attached a picture, not a worksheet. Its sure hard to debug a picture and we miss some information about the variables in play.

Whats the exact error message? Its probably not the one I had in mind when I typed the above answer.

Maybe you could post the sheet so someone with P3.1 can have a look at it.

Not sure if this may cause the problem you are experiencing, but I noticed that some of the indices "i" are in italic, some are not. So I assume they are labeled differently.

Do you have a second range defined somewhere above using an italic "i" ?

When I assume that A, I and E are also vectors of scalars, it looks like you simply expect K to be a vector consisting of 3 (n.b seems to b 3 in your screenshot) 6 x 6 matrices and you are right - this should not be a problem.

WE

mbeaumont
6-Contributor
(To:Werner_E)

"But I guess you are using the symbolic solve command when you run in this annoying "the expression is too large to display..." problem.

Do you really need symbolic solutions? Maybe a numeric solve block would do the job as well with less troubles."

I haven't used the symbolic solver at all in this worksheet, the error manifests upon simple assignment. You are right, a screenshot is not ideal, I will upload the native worksheet and a .pdf of the whole sheet tomorrow when I am at work.

"Whats the exact error message? Its probably not the one I had in mind when I typed the above answer."When I assume that A, I and E are also vectors of scalars, it looks like you simply expect K to be a vector consisting of 3 (n.b seems to b 3 in your screenshot) 6 x 6 matrices and you are right - this should not be a problem."

It's not, I've encountered that one plenty of times haha The error message is 'The expression is too large to be calculated'.

"Not sure if this may cause the problem you are experiencing, but I noticed that some of the indices "i" are in italic, some are not. So I assume they are labeled differently.

Do you have a second range defined somewhere above using an italic "i" ?"

I hadn't noticed this, I assumed it was just a quirk of Mathcads formatting as I generally havemy maths set to be 'un-italicised' but I think copy-and-pasting some expressions messes with this. Will investigate. As far as another 'i' range, there is no other defined outside of local block assignments.

"When I assume that A, I and E are also vectors of scalars, it looks like you simply expect K to be a vector consisting of 3 (n.b seems to b 3 in your screenshot) 6 x 6 matrices and you are right - this should not be a problem."

Correct, A, I and E are vectors (currently defined as 3x1's) so the computation of K should be a vector of 3 6x6's.

In previous versions on Mathcad (haven't gotten 3.1 yet) the in-line evaluation has often caused confusion.  Try not typing the evaluation equals "=" after the definition of c and s; that may solve you problem.  As Werner says, this should not be a problem.

mbeaumont
6-Contributor
(To:mbeaumont)

Find attached a .pdf of the worksheet and a native .mcdx for prime 3.1.

RichardJ
19-Tanzanite
(To:mbeaumont)

Unfortunately, I can't read a Prime 3.1 file, and I don't see anything in the pdf that would cause this problem (other than, perhaps, the different i subscripts noted by Werner). Try deleting one row (or column) of the matrix. If it still does not calculate, delete another, etc. See if you can get it to work with a smaller matrix.

I just grabbed a machine with P3.1 and played with your file.

In my opinion its clearly a bug and you may consider reporting it (if you are under maintenance)

I set i:=1 for test purpose and your 6 x 6 matrix still failed. This means, that the problem is not the vector of matrices but the matrix itself.

Also symbolic evaluation of the matrix throws the same error. This may indicate that the error occurs before any routine (numeric or symbolic) tries to evaluate.

I created a 6x6 matrix filled with 1's and evaluated it. Then I copied one expression after the other and for a while all was OK until about two thirds of the matrix was filled with your expressions. Then eventually after adding an additional expressions from your matrix, evaluation failed. It did not matter which expression I copied - its not a specific expression throwing the error. So there is nothing wrong with your sheet and your approach - its a bug in Prime.

It would be interesting to see if the same approach works in Mathcad 15 but I could not be bothered retyping the whole sheet and there is no way to convert the sheet.

So far the only workaround is to split your matrix in halves, generate it and then stack the halves together using "stack". interestingly enough this approach worked OK:

Regards

Werner

RichardJ
19-Tanzanite
(To:Werner_E)

its a bug in Prime.

Or an arbitrary limitation imposed by some programmer who decided either that nobody would ever need this, or that it would get people into some sort of trouble so we had better be "saved from ourselves".

Richard Jackson wrote:

its a bug in Prime.

Or an arbitrary limitation imposed by some programmer who decided either that nobody would ever need this, or that it would get people into some sort of trouble so we had better be "saved from ourselves".

Rather I bug I would guess. One which has to do with ranges, probably, as my second workaround with the utility function and its vectorized call works without any problems.

RichardJ
19-Tanzanite
(To:Werner_E)

Perhaps, but it works for smaller matrices, and the error message is rather reminiscent of the "too large to display" message. That is certainly an arbitrary limitation imposed by someone that decided we should not be allowed to view large, complicated expressions. Perhaps to protect our mental health?

The problem seems not to be the display but occurs rather even before the expression is handed to a numeric or symbolic routine to process. Maybe it was done on purpose  which then would be the cause for the (still) bug.

Protect our mental health? Sure not. PTC does not care about our mental health. After all they gave us Prime.

mbeaumont
6-Contributor
(To:Werner_E)

Thanks Werner, I'm glad I wasn't making a silly error somewhere at least what a strange bug.

I noticed the same thing, that it would evaluate fine until the matrix was 60% populated but all components worked in isolation or in smaller combination.

I'll use your recommendation to split the matrix and stack them to make the complete matrix. Not the most elegant looking thing but if it works it works

I wish I was more familiar with 15 as it seems, from reading this forum, to have a lot of features that prime is lacking (3d plotting being something I feel Prime sorely lacks in).

Thanks again for finding a solution.

Mike.

Michael Beaumont wrote:

Thanks Werner, I'm glad I wasn't making a silly error somewhere at least

No, you didn't. But I guess that using functions and calling them vectorized often is the better approach anyway. See my second solution below for this.

According to Mathcad 15 - yes, its still superior compared to Prime in many ways and thats really a shame. Mathcad never was famous for beautiful plots in presentation quality and its amazing the PTC still was able to go back so many steps when implementing plotting in Prime.

But even though Mathcad15 is a dead end and will die sooner or later, you may consider downloading it and giving it a try. Your Prime license is valid for Mathcad, too.

Looking at what you did in your sheet one drawback in using mathcad15 comes to my mind: you cannot create a matrix with elements of different dimensions. So I guess your matrix K would have to be unit less in MC15. So sometimes, on rare occasions, Prime rules over MC15.

WE

Here is a second and I think better workaround doing without range variables - just using an auxiliary function to create one matrix which then is called vectorized:

mbeaumont
6-Contributor
(To:Werner_E)

Ah brilliant, this looks much cleaner. Thanks so much. Appreciate your help with this.

Top Tags