# Question:Root Finding again

## Question:Root Finding again

Maple
`I came across this problem while helping another user find the maxima of an expression for various values of a parameter here:`
`http://www.mapleprimes.com/questions/124104-Maximum-Points--Of-Function-With-MoreFor various values of ga, it was required to find the maxima in a range of 0<delta<2. Plots of the expression indicate that one such maxima exists for each value of the parameter.My approach was to find the zeros of the first derivative of the expression, but this failed both with fsolve and RootFinding:-NextZero. I was quite surprised that the latter did not work.I was able find the zeros by wrapping an eval in a procedure and running fsolve against the procedure. This, however, was very slow.I'd be grateful for any comments on this and suggestions for other/better ways to do it. I also tried findindg the maxima with the DirectSearch package, which also did not work.`
```
```
 > f:=int((50-50*delta)*(50+50*delta)*(0.3e-1+(.36*(1-exp(-.39*t)))/(12.00000000*exp(-.39*t)+1))*(1-(1-exp(-.39*t))/(12.00000000*exp(-.39*t)+1))/1.08^t, t = 0 .. -2.564102564*ln((1.+5.*delta)/(53.+5.*delta)))+(500.*(-1.-5.*delta))*(-(1.*(1.+4.*ga))/(-53.+48.*ga))^.197336002905/((-1.+1.*ga)*(1.+delta)*((1.+5.*delta)/(53.+5.*delta))^.197336002905);
 (1)
 > plots:-display(seq(plot(eval(f,ga=m),delta=0..2),m=0.1..0.8,0.1));
 > df:=diff(eval(f,ga=0.1),delta):
 >
 > #find zero of df
 >
 > fsolve(df=0);
 >
 > fdf:=m->eval(df,delta=m):
 > RootFinding:-NextZero(fdf,0.1);
 (2)
 > # Interestingly, RootFinding:-NextZero does work for some values of ga (eg 0.8)
 >
 > pq:=proc(x) global df;return eval(df,delta=x); end proc:
 > fsolve(pq(z)=0,z);
 >
 (3)
 >
 >
```

```