Question: Defining multivariate functions - don't understand this error message

Hello everyone,

I need to write a procedure which takes a function as an input, differentiate it wrt x, multiply the result with x/y, and then evaluate the resulting function of (x,y) in a loop at different (x,y) pairs and return the results. 

I have a problem at the very first step though:

Suppose my function is

y := x->-(x-6)-0.01*(x-6)^3;

hence the new function I want to use in my procedure is

g := (x,y) -> diff(y(x),x)*x/y;

When I look at g(x,y) it looks fine, as I wanted. But when I want to evaluate it at a point with the command g(6,7) Maple returns:

"Error, (in g) invalid input: diff received 6, which is not valid for its 2nd argument"

g(x,y) should read (-1-0.03*(x-6)^2)*x/y. When I separately assign this to, say, f:

f  := (x,y) -> (-1-0.3e-1*(x-6)^2)*x/y;

and then run the command

f(6,7)

I get the result!

Can anyone clarify this?

Thank you in advance.

Ozgur

 

Please Wait...