Define a module and module function, mF, that calculate the maximum of xand y, and then find the maximum of the values (34/9, 674/689).
define the Module
mF[x_, y_] := Module[{}, Max[x, y]];
Use it to find the max
mF[34/9, 674/687] (*34/9*)
To use If use this:
If
mF[x_, y_] := Module[{}, If[x > y, x, y]] mF[34/9, 674/687] (*34/9*)
Thanks but i believe i needed to use an IF function which confuses me ???
I updated it to use If
Am i right in thinking I have to create internal variables and use those instead of comparing x and y directly, if so how?
You do not need to create extra variables. Why copy the input arguments to another variables in order to compare them? Waste of memory and CPU time since they will not be changed. You need to make a copy only if you want to modify the input argument inside the Module.
Ok cheers it was suggested to me to do that but forget it Thanks
mF[x, y] := Module[{x0 = x, y0 = y}, If[x0 > y0, x0, y0]];
ended up doing it like as show above