I want to include a function in the objective function that requires the objective to be squared first, multiplied with its probability, and then squared with the inverse again.

I tried the following function to figure it out:

(power((sum(t, CEMUTOTPER(t))),2))**0.5

How can I make sure that I get the same result as sum(t, CEMUTOTPER(t))? The squared function above messes it up even though it should mathematically be the same as sum(t, CEMUTOTPER(t))?

Floating point numbers don’t represent real numbers accurately (https://en.wikipedia.org/wiki/Floating-point_arithmetic). So you get rounding errors. No way to guarantee equality of the two numbers. That’s numerical analysis 101.

Thanks for your replies. So real and floating numbers are not precisely the same, but how can that have such a big effect on the model? If I try to run the model with an exponent of say 1.000001 in the objective function, leaving everything unchanged (I am trying to modify one thing in the DICE2013 model (https://sites.google.com/site/williamdnordhaus/dice-rice) btw), it messes up the whole output. How can that be? And any ideas how to fix that?

That’s a totally different question. If you turn a linear coefficient into a non-linear one this can have all sorts of effects depending on the model, e.g. this want allow the variable to becomes negative. So without specifics it’s hard to say what is going on. Why don’t you be precise and tell us how exactly you changed the DICE-RICE model and what significant changes you see. Then one can try to help.

Basically, I try to replicate a paper by Ackerman et al. (2013) who introduce Epstein-Zin preferences into the model.

For that, I would run the model simultaneously for six different states of climate sensitivity (the code below is only for two states) from period 10 onwards, collapse the first 9 periods and then recursively try to maximize utility in period 1.

That results in a lot of gibberish as output, so I tested it with the (Exp(2))EXP(0.5) objective function example (i.e. UTILITY =E= (((pA * acertainty + pB * bcertainty)**2)**0.5).

But that resulted in a lot of gibberish as well, the result of the objective function simply turns to 0. Even if I did the same thing to the standard DICE2013 model and only changed the objective function with (Exp(2))EXP(0.5). So I don´t know how it messes it up. Any ideas?