Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Questions on the finer points.
Posted:
Jul 24, 1996 7:14 PM


There are some things in Mathematica that seem to be the same, but I suspect that they are some different. Could someone enlighten me about the difference between the following:
1) What is the difference (if any) between f and g? Are there any circumstances where f will work, but g won't. Is g always faster than f? Does anyone prefer one definition to the other for another reason?
1a)
f[x_] := x^2 g = #^2 &
1b) f[x_] := 1 /; x > 0 f[x_] := 0 /; x <= 0 g[x_] := If[ x>0, 1, 0]
2) Hold and HoldForm
3) Block and Module



