Skip to main content
15-Moonstone
January 29, 2021
Solved

Symbolic evaluation of max and min

  • January 29, 2021
  • 1 reply
  • 1925 views

Hello!

 

How do I evaluate the statement (attached) symbolically?

I want to get a symbol as answer and not the assigned value of it.

 

Best regards,

Sergey

Best answer by Werner_E

The symbolic does not know anything about units and treats them as unknown variables. Thats the reason why the symbolic can't decide, which variable is bigger. If MPa would be negative, the max would be sigma1, if MPa is positive, the max is sigma2 and if MPa is zero, both are equal (0).

You may tell the symbolic that MPa is positive with the "assume" modifier and also add the "simplify" modifier to get the correct numeric result.

Werner_E_0-1611926677228.png

But its easier to achieve using a simple numeric evaluation.

 

But in case you expect the symbolic answer "sigma2" instead of "300 MPa" - there is no way to achieve this answer.

You could use the if-function or an if-statement with a text result as a workaround:

Werner_E_0-1611927232674.png

In Prime use "else" instead of "otherwise".

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
January 29, 2021

The symbolic does not know anything about units and treats them as unknown variables. Thats the reason why the symbolic can't decide, which variable is bigger. If MPa would be negative, the max would be sigma1, if MPa is positive, the max is sigma2 and if MPa is zero, both are equal (0).

You may tell the symbolic that MPa is positive with the "assume" modifier and also add the "simplify" modifier to get the correct numeric result.

Werner_E_0-1611926677228.png

But its easier to achieve using a simple numeric evaluation.

 

But in case you expect the symbolic answer "sigma2" instead of "300 MPa" - there is no way to achieve this answer.

You could use the if-function or an if-statement with a text result as a workaround:

Werner_E_0-1611927232674.png

In Prime use "else" instead of "otherwise".

 

Sergey15-MoonstoneAuthor
15-Moonstone
January 29, 2021

Hello.

 

I am writing one paper and want to show in context of the example that sigma_1 is the value to use. It is just more convenient in my particular case due the frequent use of sigma_1 and sigma_2 in the text that leads to the example.