# Numerical optimization

I want to find the numerical maximum for I and then substitute the result in UU, but I cannot obtain the numerical value of I in the following code

```
var("U,X,alpha,W0,W1,W2,pp,I, bb")
U= X^.5
b=1.2 # pouvoir de monopole
p=0.5 # probabilité qu'il ne se produise rien
w0=8 # richesse initiale
D=6 # coût du dommage
a= .5
W1=w0-(1-p)*b*I
W2=w0-D+(1-(1-p)*b)*I
UU= p*U(W1)+(1-p)*U(W2)
show(UU)
UU_I = UU.diff(I)
show(UU_I)
solve(UU_I==0, I)
```

Please format the code properly, after a copy+paste of the code mark this block and press that button with

on it. (This is the button after the

Bfor "bold face", theIfor italic, and that link button...)Then please try to isolate a minimal instance of your problem, rather than giving a code with a lot of parameters, where only one parameter matters. Please try to isolate also the programming issue(s). For instance, if we have to solve an equation, then extract one particular solution as an expression in some other variable, then plug in some specific value for this variable, then please describe these steps. (It may be a "simpler way" to plug in that special value, then solve. So please explain why the "complicated way" is really needed.)