How to evaluate user-defined functions with variables?

 How to evaluate user defined functions with variables?

I have an extremely simple question, but I couldn’t find anything anywhere, maybe I didn’t know what to search for, so feel free to mark it as duplicate if there is a duplicate.

Let’s say that I define some function, for example

f[p_Integer] := Sum[k!/(k^2 - 3), {k, 0, p}].

If I want to evaluate it for some integer, for example f[10], it works, as expected. But what if I want to evaluate it for a variable, for example f[n], how do I tell Mathematica to do it? I get f[n] as the result, but that’s not so useful.

I’m interested in the general solution, nevermind my example, I had to use something.

1 Answer

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange