Suppose i have two functions:
$\qquad -2x^2 +5x+3$
and
$\qquad -5x^2 +2x+3$
To solve the point where the functions are at maximum i use the command NMaximize
which gives:
NMaximize[-2 x^2 + 5 x + 3, x]
(* Out: {6.125, {x -> 1.25}} *)
and
NMaximize[-5 x^2 + 2 x + 3, x]
(* Out: {3.2, {x -> 0.2}} *)
However, what if I want to define a function that automatically calculates the difference of the points $x_{max}$ of the two functions?
Now from the example I have given I want to define a function that will somehow automatically calculate $1.25-0.2=1.05$.
[[...]]
is shorthand for thePart
command. Take a look at the documentation forPart
and, more in general, at What the @#%^&*?! do all those funny signs mean?. $\endgroup$