Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi everyone,
I trying to program conditions to solve the calculate the settlement which is base of some conditions but i could not, every trial has a new wrong outputs or errors, I will be thankful for your help if possible,
- if initial eff. stress equal to pre-consolidation stress then use eq1 than
otherwise check if
initial eff. stress bigger than pre-consolidation stress AND init. stress + changes in stress smaller than pre-con then use eq 2
other wise check if
initial eff. stress bigger than pre-consolidation stress AND init. stress + changes in stress Bigger than pre-con then use eq 3
then use eq2 than
Solved! Go to Solution.
With the input values you provide all four sets of values would trigger case 3 (EQ3).
So I can not understand your "Correct answer".
You can't vectorize a boolean operator, so the best solution IMHO is to set up all calculations for single scalars as functions in the variables you'd like to vary and then call these functions vectorized if you want provide vectors of input rather than single scalar values.
Of course you could/should rename that function and instead of using the expression directly you may also turn EQ1 and EQ2 into functions and call them as I have shown with EQ3 only.
You may also note that you can, but you must not use the names of your later defined data vectors for your formal function arguments.
And because a "return" quits a program you may do the whole thing without any "else" and also add an error if none of the three cases applies:
I used the values in vector form, I thought this is the best way, I am not sure if that has a relation to the wrong solutions..
With the input values you provide all four sets of values would trigger case 3 (EQ3).
So I can not understand your "Correct answer".
You can't vectorize a boolean operator, so the best solution IMHO is to set up all calculations for single scalars as functions in the variables you'd like to vary and then call these functions vectorized if you want provide vectors of input rather than single scalar values.
Of course you could/should rename that function and instead of using the expression directly you may also turn EQ1 and EQ2 into functions and call them as I have shown with EQ3 only.
You may also note that you can, but you must not use the names of your later defined data vectors for your formal function arguments.
And because a "return" quits a program you may do the whole thing without any "else" and also add an error if none of the three cases applies:
Thank you for your great help and time, I really appreciate that.