Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'programming help' topicStudent Support Forum > General > "programming help"

Next Comment >Help | Reply To Topic
Author Comment/Response
Mikel
04/19/07 12:07pm

Hi, I am programming an expected value function, so far I have entered this:

e/:e[x_+y_]:=e[x]+e[y]
e/:e[a_*x_]:=a*e[x]/;NumericQ[a]==True
e/:e[a_]:=a/;NumericQ[a]==True
m/:NumericQ[m]=True

but when I evaluate e[x^3-3*x^2*m+3*x*m^2-m^3] I get -3*m*e[x^2]+e[x^3]+3*e[x*m^2]-e[m^3]

what am I missing in the programming?
my guess is that Mathematica is not assuming m^3 as a numerical value despite I programmed m to be one

URL: ,

Subject (listing for 'programming help')
Author Date Posted
programming help Mikel 04/19/07 12:07pm
Re: programming help yehuda ben-s... 04/22/07 00:28am
Next Comment >Help | Reply To Topic