# How to call define a simple function?

I am new to Mathematica I have a simple question.

I have the following definition:

f[i_,j_] := Integrate[KroneckerDelta[i, j] - ki * kj + Exp[-(kx^2+ky^2)],
{kx, 0, 10}, {ky, 0, 100}]


I would like to write it in a way that if I call f[x,x] it would compute:

f[x,x] = Integrate[KroneckerDelta[x, x] - kx * kx + Exp[-(kx^2+ky^2)],{kx, 0,
10}, {ky, 0, 100}]


or if I call f[x,y] it returns:

f[x,y] = Integrate[KroneckerDelta[x, y] - kx * ky + Exp[-(kx^2+ky^2)],{kx, 0,
10}, {ky, 0, 100}]

• Surely just: f[x_] := A^2 x^2 and f[b_, q_] := A^2 b q? – Feyre Aug 25 '16 at 11:39
• I do not realy get the question: if you call your $f[b,q]$ with the arguments $x,x$ it does what you wanted with $f[x,x]$. You should maybe specifiy your question a bit more. – N0va Aug 25 '16 at 11:44
• It's hard even to formulate the question because I am not familiar with it. I edited it, maybe it's clearer now. – Aroldo Ribeiro Aug 25 '16 at 11:56
• Please always post code as plain text, not LaTeX. Put it in a code block (see ? button in the editing toolbar for help). Make sure that it can be copied and pasted back in to Mathematica. It is hard to tell from what you posted if your function definition is even valid ... – Szabolcs Aug 25 '16 at 11:56
• That is an extremly strange function; I mean you just want to return some powers of ten why dont you just use f[a_, b_: 0] := 10^(a + b). Or why do you even need such a "function"? – N0va Aug 25 '16 at 11:58

You can use $1-\delta_{xy}$ and $\delta_{xy}$ to get your two different terms $a*b$ and $a*a$:
f[x_, y_] := Integrate[KroneckerDelta[x, y] - KroneckerDelta[x, y]*(a*a) - (1
`
This gives for $$f[x,x]=\int_0^{10}da\int_0^{10}db ~e^{-a^2-b^2}-a^2+1=-3232.55$$ and for $$f[x,y]=\int_0^{10}da\int_0^{10}db ~e^{-a^2-b^2}-a b=-2499.21.$$