Tag Info

Hot answers tagged

4

The reason is because you define your function p[x,y] differently. When you write p[#,#]&, Mathematica sees it as Function[{x},p[x,x]], whereas the preferred option in your case would be p[#1,#2]&, or, in other words, Function[{x,y},p[x,y]]. This being said, try: pd2[x_, y_, i_, j_] := Derivative[i, j][p[#1, #2] &][x, y]; And your results ...


1

If I understand you correctly, the main idea of the procedure can be outlined as follows. Call the vector gg and let it have k components g[i]: gg[k_] := Array[g, k] Then your expression can be written as V[n_, k_] := Sum[(y[i, gg[k]] - z[i])^2, {i, 1, n}] Example n = 3, k = 2 V[3, 2] (* Out[32]= (y[1, {g[1], g[2]}] - z[1])^2 + (y[2, {g[1], g[2]}] - ...


1

Seeing as you're trying to evaluate hydrogen wavefunctions, note that the necessary special functions are already built-in, so you can skip the step of defining the special functions entirely, and just do this: ψ[n_, l_, m_, ρ_, θ_, ϕ_] := Sqrt[(2/(n a0))^3 (n - l - 1)!/(2 n (n + l)!)] Exp[-ρ/2] ρ^ l LaguerreL[n - l - 1, 2 l + 1, ρ] ...



Only top voted, non community-wiki answers of a minimum length are eligible