- #1
- 908
- 572
In this code, I define a function of x as the sum of the first x integers.
I would like now to take the symbolic formula underlying fnSum, and use it with real arguments. How can I assign that formula to a new real function, such that fnSum[3.5] will return the correct non-integer value instead of just 6 ?
Of course, this is just an example -- I would like to know how to do this in general.
Code:
In[7]:= fnSum[x_] := Sum[k, {k, 1, x}]
In[8]:= fnSum[x]
Out[8]= 1/2 x (1 + x)
In[9]:= fnSum[3.5]
Out[9]= 6
I would like now to take the symbolic formula underlying fnSum, and use it with real arguments. How can I assign that formula to a new real function, such that fnSum[3.5] will return the correct non-integer value instead of just 6 ?
Of course, this is just an example -- I would like to know how to do this in general.