Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi,
I have been updating a Mathcad sheet and noticed that there are slight discrepancies in the results on the order of 1e-6. I tracked the source of this error and I got to this integral (shown below).
There are two things I do not understand:
1.- Function A and B are the same but for some reason B throws an error "this value must be an integer".
2.- The integral should be equal to 1 when the upper limit is approx higher than 5. But for some reason the solution jumps from 1 to 5e-4 when the upper limit goes from 1.011e4 to 1.013e4, which is wrong. It should be 1.
I am using Prime 8.0
Regards,
Solved! Go to Solution.
@DM_10127316 wrote:
Hi,
I have been updating a Mathcad sheet and noticed that there are slight discrepancies in the results on the order of 1e-6. I tracked the source of this error and I got to this integral (shown below).
There are two things I do not understand:
1.- Function A and B are the same but for some reason B throws an error "this value must be an integer".
2.- The integral should be equal to 1 when the upper limit is approx higher than 5. But for some reason the solution jumps from 1 to 5e-4 when the upper limit goes from 1.011e4 to 1.013e4, which is wrong. It should be 1.
I am using Prime 8.0
Regards,
ad 1.) You used the literal index when you typed B.ii but you should have used the matrix/vector index as you did in A[ii.
ad 2.) Numerical math approx algorithms always are good for strange effects. You can cope with that problem by decreasing the value of the system variable TOL from its default value 10^-3 to something like 10^-6
I won't call this a bug, its simply a a natural side effect of the algorithm used for numerical integration.
If its just this simple integral, I would suggest to replace it by the exact expression 1-e^-t.
We experience the same effect in real Mathcad when using the default tolerance setting of 10^-3. Here a screenshot of Mathcad 15:
Prime 10 also has this bug.
@DM_10127316 wrote:
Hi,
I have been updating a Mathcad sheet and noticed that there are slight discrepancies in the results on the order of 1e-6. I tracked the source of this error and I got to this integral (shown below).
There are two things I do not understand:
1.- Function A and B are the same but for some reason B throws an error "this value must be an integer".
2.- The integral should be equal to 1 when the upper limit is approx higher than 5. But for some reason the solution jumps from 1 to 5e-4 when the upper limit goes from 1.011e4 to 1.013e4, which is wrong. It should be 1.
I am using Prime 8.0
Regards,
ad 1.) You used the literal index when you typed B.ii but you should have used the matrix/vector index as you did in A[ii.
ad 2.) Numerical math approx algorithms always are good for strange effects. You can cope with that problem by decreasing the value of the system variable TOL from its default value 10^-3 to something like 10^-6
I won't call this a bug, its simply a a natural side effect of the algorithm used for numerical integration.
If its just this simple integral, I would suggest to replace it by the exact expression 1-e^-t.
We experience the same effect in real Mathcad when using the default tolerance setting of 10^-3. Here a screenshot of Mathcad 15:
That was it! Thank you for your response, Extremely helpful.
Unfortunately, the integral is part of a bigger one and I cant replace with its exact expression. But changing TOL helps a lot.
OK, but keep in mind that the default value 10^-3 normally is well chosen. Setting TOL at a value too small may result in some numerical calculations like integrals, solve blocks, etc. failing because "the calculation does not converge to a solution". So handle with care 😉
Ans0 is TOL=1
Ans7 is TOL=10^-7.