Complex examples

Here we plot the sin function

test = Plot[Sin[x], {x, 0, 2 π}] ;

[Graphics:../HTMLFiles/MATH5_TUT1_129.gif]

Now we look at the input form

InputForm[test] ;

But it is quite long so we use the function Short

Short[InputForm[test], 6]

argument // pure function[#]&

InputForm[test]//Short[#, 6] &

pure function[#]& @ argument

Short[#, 6] & @ InputForm[test]

Try  /@ instead of @

Short[#, 6] & /@ InputForm[test]

We first define a function

f[c_, x_] = c + x

c + x

and a set of vlaues

val = {1, 3, 4}

{1, 3, 4}

Calculate the function for val

f[5, val]

{6, 8, 9}

Pipe the velues

val // f[c, #] &

{1 + c, 3 + c, 4 + c}

apply a pure function form to val

 f[c, #] & @ val

{1 + c, 3 + c, 4 + c}

Here is the same @ or /@

f[5, #] & /@ val

{6, 8, 9}


Created by Mathematica  (September 7, 2006) Valid XHTML 1.1!