Serving the Quantitative Finance Community

 
User avatar
Antonio
Topic Author
Posts: 8
Joined: June 30th, 2004, 3:13 pm
Location: Imperial College London
Contact:

Mathematica : Problem with valid variable

March 6th, 2007, 2:14 pm

Hello,I have the following problem in Mathematica : if I define the following functionsT[x_] := D[x, {x, 1}];u[x_] = Sqrt[2]*x;T[u[x]]I get : General::ivar : x is not a valid variable.∂_{x, 1}Sqrt(2)x)Why ? Thanks a lot.
 
User avatar
mohamedb
Posts: 2
Joined: December 16th, 2004, 4:07 pm

Mathematica : Problem with valid variable

March 6th, 2007, 2:31 pm

Maybe its getting confused because(a) x is both the function and argument for the differientation(b) the function argument is not supplied in D[...]. I.e it expects f[x]TryT[f_] := D[f[x], {x, 1}]u[x_] = Sqrt[2]*xT
 
User avatar
mohamedb
Posts: 2
Joined: December 16th, 2004, 4:07 pm

Mathematica : Problem with valid variable

March 6th, 2007, 2:34 pm

last line should have readT(not T)
 
User avatar
mohamedb
Posts: 2
Joined: December 16th, 2004, 4:07 pm

Mathematica : Problem with valid variable

March 6th, 2007, 2:36 pm

damm it seems that something is being escaped when i type it in. last line should beTee OpenBracket U CloseBracketArghhh
 
User avatar
MCarreira
Posts: 64
Joined: January 1st, 1970, 12:00 am

Mathematica : Problem with valid variable

March 6th, 2007, 3:00 pm

You're asking T to perform D[ _ , {Sqrt[2]*x,1}], and Sqrt[2]*x is not a valid variable to perform the derivative ... x would be, Sqrt[2]*x would not.BTW, you want u defined as u[x_] = Sqrt[2]*x or u[x_]:= Sqrt[2]*x ?
 
User avatar
Antonio
Topic Author
Posts: 8
Joined: June 30th, 2004, 3:13 pm
Location: Imperial College London
Contact:

Mathematica : Problem with valid variable

March 6th, 2007, 3:29 pm

Thanks a lot. mohamedb's method works. MCarreira, I want u:=I'm new with Mathematica, so still things to learn.