Skip to main content
8-Gravel
September 20, 2022
Solved

Symbolic solution

  • September 20, 2022
  • 3 replies
  • 4911 views

How can I get only the positive solution for symbolic evaluated equation. I want to use the function "Z(a,s,x) in the equation for Max and return only result.

Best answer by Werner_E

@JB_10220769 wrote:

How can I get only the positive solution for symbolic evaluated equation. I want to use the function "Z(a,s,x) in the equation for Max and return only result.


Prime cannot do so because the sign depends on the values of a and s. How should Prime decide for the symbolic expression to be positive or negative? Depending on a and s its sometimes the first and sometimes the second entry.

Werner_E_1-1663701322871.png

 

But if you are sure that both a and s will be only positive values you can tell the symbolics so using the "assume" modifier. Ever so often the symbolics will happily ignore it, but in  case of your example you are lucky and it works. Because we assume that a, s as well as x are positive, we can use "assume, ALL>0".

Werner_E_2-1663702847323.png

You may consider turning Max.T into a function of a and s.

The assume modifier was applied to the calculation of Max.T as well to avoid a result like

Werner_E_0-1663701731304.png

 

EDIT: Ah, I see that Valery was bit faster by suggesting the same modifier but in a different example. In his example, "assume, c>0" would probably have sufficed.

 

3 replies

24-Ruby IV
September 20, 2022

May be it is help

All.png

Werner_E25-Diamond IAnswer
25-Diamond I
September 20, 2022

@JB_10220769 wrote:

How can I get only the positive solution for symbolic evaluated equation. I want to use the function "Z(a,s,x) in the equation for Max and return only result.


Prime cannot do so because the sign depends on the values of a and s. How should Prime decide for the symbolic expression to be positive or negative? Depending on a and s its sometimes the first and sometimes the second entry.

Werner_E_1-1663701322871.png

 

But if you are sure that both a and s will be only positive values you can tell the symbolics so using the "assume" modifier. Ever so often the symbolics will happily ignore it, but in  case of your example you are lucky and it works. Because we assume that a, s as well as x are positive, we can use "assume, ALL>0".

Werner_E_2-1663702847323.png

You may consider turning Max.T into a function of a and s.

The assume modifier was applied to the calculation of Max.T as well to avoid a result like

Werner_E_0-1663701731304.png

 

EDIT: Ah, I see that Valery was bit faster by suggesting the same modifier but in a different example. In his example, "assume, c>0" would probably have sufficed.

 

8-Gravel
September 23, 2022

Thanks @Werner_E  for the information But when I try to use the program  it does not let me evaluate conditional statement. Any thoughts?  

23-Emerald IV
September 23, 2022

Yes, use the Heaviside step function, also known as the unit step function:

LucMeekes_0-1663943875807.png

LucMeekes_2-1663943892515.png

To test if, e.g. x>5, use:

LucMeekes_4-1663943971839.png

If x<5 it will produce 0 (FALSE), if x>5 it will produce 1 (TRUE).

Be prepared for some strange results, since

LucMeekes_1-1663943884134.png

 

Hmm, that was before looking at your sheet. After taking a peek, it would seem:

LucMeekes_0-1663945311377.png

and

LucMeekes_1-1663945323298.png

But this also gives no result.

 

Incidentally, what did you define R.R for? It is not used, you only use R.L...

 

Success!
Luc

ttokoro
21-Topaz I
21-Topaz I
October 20, 2022

In this case Prime 8 can do.

image.png

 

t.t.