Question: procedures: how do I assign an algebraic argument as the range of a function

Hi there!

I want to have a procedure, which takes as one of it's arguments an algebraic, say sin(x) for instance. So far thats easy, I just type:

proc(arg)

Within this proc I would like to define a function now, which has this expression on it's image side. So it should look like f:=x->sin(x). What I tried is:

 

minexample := proc(arg)

  local f:

  f := x -> arg:

  f(pi)

  end proc:

minexample(sin(x));

 

But this code would produce sin(x), as a result and not 0, as I would expect. Could anyone tell me what I do wrong, and how I can get it right please? : )

What I would also like to know is, what kind of data type expressions such as sin(x), or algebraic expressions are, so I can specify that in the definition already to make the proc more transparent to use.

 

Thanks!

Please Wait...