# Multiple 'x' in policy equations not working

I am trying to mod an effect with the equation, 0.3*x^0.25-0.15*x. It does not work. Plotting software says it should look like this:

What I get is this:

Not only too small, but decaying to 0.

If I remove the ‘0.3’ multiplier ‘eq=x^0.25-0.15*x’ it gives the correct shape:

If I rearrange it to ‘0-(0.5*x)+x^0.25’ I get this, which is laughably wrong:

I cannot figure out for the life of me what’s going on. Help.

1 Like

I assume these are what happened.

It seems using multiple Xs is okay but calculation of equations has an order.

[var0] {operator0} ( [var1] {operator1} [var2] ) {operator2} [var3] …

An equation will be processed in order of op1 - op2 - … - op0. So I guess these were your actual equations.

`0.3 * ( x ^ 0.25 - x ) * 0.15`

`x ^ ( ( 0.25 - x ) * 0.15 )`

`0 - ( 0.5 * x + x ) ^ 0.25`

Therefore, I think you will get what you want by using this equation instead.

`x*(x^-0.75)*0.3-0.15`

1 Like

Therefore, I think you will get what you want by using this equation instead.

``````x*(x^-0.75)*0.3-0.15
``````

Thank you! That worked. A weird way of writing it though!

…well, I thought it worked, but when the policy is set to 0 it shoots to infinity (or more accurately “-1.#J%”) rather than 0. So that’s a fun new problem.

Ohhhhh my bad. forgot that div by zero. the simplest take would be modifying it to `x*(x+0.001)^-0.75*0.3-0.15` but not sure how many operators are allowed so it will need further experimentation.

So if I’m understanding you correctly, the engine doesn’t know order of operations/precedence, and just executes operations in the order they’re presented, unless told otherwise by parentheses?

not exactly. they ignore both the mathematical order of operations AND parentheses. always in order of op1 - op2 - op3 - (possibly) op4 …

also I try not to use many operators in an equation to avoid possible bugs