1 страниц (10 вхождений)
[SS-1249] Summation in For Loop - Error when using summation in for loop - Сообщения
#1 Опубликовано: 30.11.2014 18:25:47
See attached calculation.
I seem to have an issue with the 4 term summation inside the for loop. I can't figure out the issue. Does anyone know the correct way to solve this?
Thanks!
Analysis - Lateral - Rigid.sm (23 КиБ) скачан 65 раз(а).
I seem to have an issue with the 4 term summation inside the for loop. I can't figure out the issue. Does anyone know the correct way to solve this?
Thanks!
Analysis - Lateral - Rigid.sm (23 КиБ) скачан 65 раз(а).
#2 Опубликовано: 30.11.2014 18:40:01
The problem is in the sum under "Torsional Shear force". The sum in the denominator runs from 1 to # of columns in your data matrix. However, the quantities under the sum are known only up to current n. If you replace n for the upper sum limit then you get a result. However, I don't know if that is what you want.

Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Опубликовано: 30.11.2014 20:12:34
Martin,
You show "n" in your image however in the calculation I use "cols(MWallinfo#)" so it should sum from 1 to 6 (which happens to be the number of columns in MWallinfo#).
Unless I'm missing something?
Is there a better way to do this? Basically the denominator should be the sum of R*r^2. I've tried placing this sum elsewhere, etc. and nothing seems to work. Not sure what I'm doing wrong. Even if I replace "cols(MWallinfo#)" (above the summation) with 6 I still receive an error.
You show "n" in your image however in the calculation I use "cols(MWallinfo#)" so it should sum from 1 to 6 (which happens to be the number of columns in MWallinfo#).
Unless I'm missing something?
Is there a better way to do this? Basically the denominator should be the sum of R*r^2. I've tried placing this sum elsewhere, etc. and nothing seems to work. Not sure what I'm doing wrong. Even if I replace "cols(MWallinfo#)" (above the summation) with 6 I still receive an error.
#4 Опубликовано: 01.12.2014 01:31:55
Well,
the problem is in dimensions of R,w# and r,w#.
The summation needs them both to have at least cols(MWallinfo#) items in 1st row.
But they are filled along the iterations.
At first iteration, first member of r,w# is zero. (All members of R,w# are non-zero). SMath seem to stop evaluating when the dividend is zero...? Maybe it uses some (incorrect) optimisation?
Second iteration follows the same path, but on third iteration the third element of r,w# is 8*10^-14 m, so the calculation of divider starts and gives the error.
Try to pot trace(n,R.w#,r.w#) just before the summation line in your calculation, and see the trace window result.
the problem is in dimensions of R,w# and r,w#.
The summation needs them both to have at least cols(MWallinfo#) items in 1st row.
But they are filled along the iterations.
At first iteration, first member of r,w# is zero. (All members of R,w# are non-zero). SMath seem to stop evaluating when the dividend is zero...? Maybe it uses some (incorrect) optimisation?
Second iteration follows the same path, but on third iteration the third element of r,w# is 8*10^-14 m, so the calculation of divider starts and gives the error.
Try to pot trace(n,R.w#,r.w#) just before the summation line in your calculation, and see the trace window result.
С уважением,
Михаил Каганский
#5 Опубликовано: 01.12.2014 11:20:49
Mike,
I see. What you're saying makes sense. So really I should break the for loop before the summation. And then I can start another for loop after.
Thanks.
I see. What you're saying makes sense. So really I should break the for loop before the summation. And then I can start another for loop after.
Thanks.
#6 Опубликовано: 01.12.2014 12:06:25
While the calculation still has a ways to go, I've pushed believe I pushed past the summation issues. Mayme there is a better way though...
Attached is the updated routine.
Analysis - Lateral - Rigid.sm (25 КиБ) скачан 59 раз(а).
Attached is the updated routine.
Analysis - Lateral - Rigid.sm (25 КиБ) скачан 59 раз(а).
#7 Опубликовано: 01.12.2014 15:43:26
I know have a very long run time for this particular set of information.
Description:
Stopped working
Problem signature:
Problem Event Name: APPCRASH
Application Name: SMathStudio_Desktop.exe
Application Version: 1.1.27.0
Application Timestamp: 53f63c27
Fault Module Name: KERNELBASE.dll
Fault Module Version: 6.1.7601.18015
Fault Module Timestamp: 50b8479b
Exception Code: e053534f
Exception Offset: 0000000000009e5d
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Also I have a separate function outside of the main function. Is it better to put this function inside the main function or leave it separate? Does it matter?
Analysis - Lateral - Rigid-T1.sm (57 КиБ) скачан 56 раз(а).
Description:
Stopped working
Problem signature:
Problem Event Name: APPCRASH
Application Name: SMathStudio_Desktop.exe
Application Version: 1.1.27.0
Application Timestamp: 53f63c27
Fault Module Name: KERNELBASE.dll
Fault Module Version: 6.1.7601.18015
Fault Module Timestamp: 50b8479b
Exception Code: e053534f
Exception Offset: 0000000000009e5d
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Also I have a separate function outside of the main function. Is it better to put this function inside the main function or leave it separate? Does it matter?
Analysis - Lateral - Rigid-T1.sm (57 КиБ) скачан 56 раз(а).
#8 Опубликовано: 03.12.2014 11:38:55
Any idea on why this won't converge to an answer? Seems to work for other input but something is going on that I can't seem to figure out.
Thanks again!
Thanks again!
#9 Опубликовано: 03.12.2014 12:16:49
Basically, you have to place an eval() outside each sum() - thus when you made calculations of rigidities.
Without, SMath output very high numbers and so "result is above max allowed positive number" errors are triggered in the functions.
I suspect this is because units with high powers are involved.
You can see what happens in the 3 last images attached.
Maybe the numbers of not evaluated R.totY# are correct, but further calculation not allowed (if you copy the output from the trace window, and you try to get a result, you get the error).
Also, all the optimizations are set to "numeric" in the attached worksheet (average calculation time on opened worksheet: 0.45s).
BTW, debugged with the trace() function.
Best regards,
Davide
P.S.: issue opened (SS-1249)
Analysis - Lateral - Rigid-T1 (dbg).sm (59 КиБ) скачан 53 раз(а).
Without, SMath output very high numbers and so "result is above max allowed positive number" errors are triggered in the functions.
I suspect this is because units with high powers are involved.
You can see what happens in the 3 last images attached.
Maybe the numbers of not evaluated R.totY# are correct, but further calculation not allowed (if you copy the output from the trace window, and you try to get a result, you get the error).
Also, all the optimizations are set to "numeric" in the attached worksheet (average calculation time on opened worksheet: 0.45s).
BTW, debugged with the trace() function.
Best regards,
Davide
P.S.: issue opened (SS-1249)
Analysis - Lateral - Rigid-T1 (dbg).sm (59 КиБ) скачан 53 раз(а).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#10 Опубликовано: 03.12.2014 19:38:49
Thanks you!
1 страниц (10 вхождений)
-
Новые сообщения
-
Нет новых сообщений