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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Help with summation (converted sheet from MC15 to Prime)

Joaberg
3-Visitor

Help with summation (converted sheet from MC15 to Prime)

Hi,

 

I am converting an old Mathcad 15 sheet to Mathcad Prime 9.0 and am working through it resolving errors that have popped up in the conversion. Currently im stumped by an 

error that comes up with a summation in a program. See attached picture.

 

The program worked perfectly fine in MC15 but in Prime it throws me a "this value must be an integer" error. I've tried backtracking what could be causing the error and the only thing i could come up with is if the error get's thrown in a step where it's trying to summarise from n=460->0... ? However the same formula worked fine in MC15.

 

Kind regards,

Johan

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:MartinHanak)

First: You should always attach the Mathcad/Prime sheet to your problem description.

 

Then to the error message:

I think your problem lies with how you create the value 'n' that you use to index the rows of matrix U.i.netto.

This index n is calculated by taking one of the values in the matrix BA and dividing that by steg, which is defined as 0.01.

Let's take an example. One of the BA values is 4.6; divided by steg (0.01) that should result in 460, isn't it?

Well here is what Prime calculates:

LucMeekes_0-1714757213488.png

OK, that looks like 460, but is it? Let's compare:

LucMeekes_1-1714757259584.png

Gives a 0 (false, so NOT true), indicating that 4.6/steg is NOT equal to 460. Apparently when n is 4.6/steg, it is not an integer value. How much does it differ:

LucMeekes_2-1714757353199.png

(This value is in the order of the numerical resolution, due to digital representation of numbers, internally, with a limited number of bits.) So the difference is not much, but still. Prime notices that n in this case is not an integer and flags the error.

Since Mathcad 15 uses much the same numerical methods, I should think that Mathcad 15 would also see such n as not an integer, and flag an error. You say it worked, I wonder what you changed, going from Mathcad to Prime...

 

What can you do about it? One approach could be:

Increase the values in BA by a factor of 100 and use those, without division by steg, to index the U.i.netto matrix. Everywhere else where you need those 100 times smaller values of the original BA, multiply them by steg.

 

Success!
Luc

View solution in original post

5 REPLIES 5

Hi,

check ui.netto matrix .


Martin Hanák
LucMeekes
23-Emerald III
(To:MartinHanak)

First: You should always attach the Mathcad/Prime sheet to your problem description.

 

Then to the error message:

I think your problem lies with how you create the value 'n' that you use to index the rows of matrix U.i.netto.

This index n is calculated by taking one of the values in the matrix BA and dividing that by steg, which is defined as 0.01.

Let's take an example. One of the BA values is 4.6; divided by steg (0.01) that should result in 460, isn't it?

Well here is what Prime calculates:

LucMeekes_0-1714757213488.png

OK, that looks like 460, but is it? Let's compare:

LucMeekes_1-1714757259584.png

Gives a 0 (false, so NOT true), indicating that 4.6/steg is NOT equal to 460. Apparently when n is 4.6/steg, it is not an integer value. How much does it differ:

LucMeekes_2-1714757353199.png

(This value is in the order of the numerical resolution, due to digital representation of numbers, internally, with a limited number of bits.) So the difference is not much, but still. Prime notices that n in this case is not an integer and flags the error.

Since Mathcad 15 uses much the same numerical methods, I should think that Mathcad 15 would also see such n as not an integer, and flag an error. You say it worked, I wonder what you changed, going from Mathcad to Prime...

 

What can you do about it? One approach could be:

Increase the values in BA by a factor of 100 and use those, without division by steg, to index the U.i.netto matrix. Everywhere else where you need those 100 times smaller values of the original BA, multiply them by steg.

 

Success!
Luc

This is actually exactly what happens. Many thanks!

 

Why does this happen though? I've checked and the values of BA and steg is exactly 4.6 and 0.01 respectively but just like you said the 4.6/0.01 does not equal 460. I solved it by adding rounding to the values in the summation definition. Funny thing is Mathcad 15 also shows that the value of BA/steg (step) is not equal to 460 however that program does not throw an error due to it, see applied picture.

 

About supplying sheets to the problem description: How do people go about this when the sheet could be considered a trade secret?

 

Kind regards,

Johan


@Joaberg wrote:

This is actually exactly what happens. Many thanks!

 

Why does this happen though? I've checked and the values of BA and steg is exactly 4.6 and 0.01 respectively but just like you said the 4.6/0.01 does not equal 460. I solved it by adding rounding to the values in the summation definition. Funny thing is Mathcad 15 also shows that the value of BA/steg (step) is not equal to 460 however that program does not throw an error due to it, see applied picture.

 

About supplying sheets to the problem description: How do people go about this when the sheet could be considered a trade secret?

 

Kind regards,

Johan


Hi,

user creates simple sheet showing the problem and uploads it.


Martin Hanák

I removed my reply. Sorry for confusion.


Martin Hanák
Top Tags