I have the function fun[x_,y_, t_] = Cos[x] + Exp[I y] Sin[x] Sin[t];
such that $0\le {\rm x}\le \pi$, $0\le {\rm y}\le 2\pi$, and $0\le {\rm t} \le 10$. I compute the derivative of the real part of this function as derivativefun[x_,y_, t_] = D[Re[fun[x,y, t]], t];
. Now I want to write the following algorithm to be executed on Mathematica:
Step1: Select a value of x
and y
say x=0
and y=0
, find derivativefun[0,0, t]
; Integrate over those intervals of t
for which derivativefun[0,0, t]
is positive (The integral will be a function of t
).
Step2: Select another value of x
and y
say x=0.5
and y=0.5
find derivativefun[0.5,0.5, t]
;Integrate over those intervals of t
for which derivativefun[0.5,0.5, t]
is positive (again, the integral will be a function of t
).
Step3: Do the same for the entire range of $0\le {\rm x} \le\pi$ and $0\le {\rm y} \le 2\pi$.
Step4: Finally, choose that integral (as a function of t
) which is the maximum of all.
To sum up, I need to compute the integral of the derivative of the real part of fun[x_,y_, t_]
over the range of ${\rm t}$ where the derivative is an increasing function. This is to be done for all values of parameters ${\rm x}$ and ${\rm y}$ within their given ranges. Finally that integral is to be chosen which is the maximum of all.
Edit: The derivative is to be taken of the absolute value of the function fun[x_,y_, t_]
.
Edit2: Since there are issues with the derivative of the Abs[]. It turns out that real part of the function fun[x_,y_, t_]
would also work for me. Therefore, I have edited the question, changing Abs[] to Re[].