Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Your Friends List is a way to easily have access to the community members that you interact with the most!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Dec 02, 2022
09:09 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 02, 2022
09:09 AM

Creating function to solve for Consolidation Settlement

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.

Labels:

ACCEPTED SOLUTION

Accepted Solutions

Dec 02, 2022
09:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 02, 2022
09:50 AM

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:

3 REPLIES 3

Dec 02, 2022
09:11 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 02, 2022
09:11 AM

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..

Dec 02, 2022
09:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 02, 2022
09:50 AM

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:

Dec 05, 2022
12:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 05, 2022
12:10 AM

Thank you for your great help and time, I really appreciate that.