1 Pages (3 items)
Reusing variable results in wrong result - Messages
#1 Posted: 3/16/2014 1:21:17 PM
Hi,
Not sure if it is a bug or a usage error on my side, please kindly move if not posted correctly.
I am using a formula to compute a breaking tension and a safety factor. So far so good, now as a penultimate step I want to go through multiple materials.
As a last step I, redefine the computation method for the tension and go again through all materials. However the results are the SAME as before. I checked manually and they should be different. When I use a vector for all materials, the correct values are shown.
attached are the two minimal examples
Edit: win7x64 and SMath 0.97.5154
minimal_novect.sm (15 KiB) downloaded 36 time(s).
Not sure if it is a bug or a usage error on my side, please kindly move if not posted correctly.
I am using a formula to compute a breaking tension and a safety factor. So far so good, now as a penultimate step I want to go through multiple materials.
As a last step I, redefine the computation method for the tension and go again through all materials. However the results are the SAME as before. I checked manually and they should be different. When I use a vector for all materials, the correct values are shown.
attached are the two minimal examples
Edit: win7x64 and SMath 0.97.5154
minimal_novect.sm (15 KiB) downloaded 36 time(s).
#2 Posted: 3/16/2014 1:41:57 PM
If you let the mouse hover over the definition of S, then you see that there is no reference to [MATH]σ_v[/MATH] any more, because it has been replaced by the already known numerical value.
What you can do is
You might wonder why the formula is stored as it is if you request numeric evaluation and all known values are stored if you request symbolic optimization. The reason is, that numeric optimization fails due to [MATH]σ_b[/MATH] not defined and no optimization is done at all -> the formula is stored as it was input.
BTW, you might consider replacing names like [MATH]σ_v[/MATH] by [MATH]σ,v[/MATH] using literal subscipts. You get them by typing a dot.
What you can do is
- either shift the definition of [MATH]S[/MATH] above the definition [MATH]σ_v[/MATH] or
- switch the definition of [MATH]S[/MATH] to numeric optimization in the context menu.
You might wonder why the formula is stored as it is if you request numeric evaluation and all known values are stored if you request symbolic optimization. The reason is, that numeric optimization fails due to [MATH]σ_b[/MATH] not defined and no optimization is done at all -> the formula is stored as it was input.
BTW, you might consider replacing names like [MATH]σ_v[/MATH] by [MATH]σ,v[/MATH] using literal subscipts. You get them by typing a dot.
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 Pages (3 items)
-
New Posts
-
No New Posts