1
$\begingroup$

I have to define a function which has 1e4 terms added up together.

f(x1, x2) = (sum i, j, k, l from 1 to 10) (C(i) * C(j) * C(k) * C(l) * exp( (alpha(i)+alpha(j)) * x1 + (alpha(k)+alpha(l)) * x2 )

all C and alpha are known and f is a function of x1 and x2.

Is there any easy way(without for loop) to input the function in to mathematica and draw the contour of f depending on x1 and x2?

Thanks.

$\endgroup$
2
$\begingroup$
f[x1_, x2_] := \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(10\)]\(
\*UnderoverscriptBox[\(\[Sum]\), \(j = 1\), \(10\)]\(
\*UnderoverscriptBox[\(\[Sum]\), \(k = 1\), \(10\)]\(
\*UnderoverscriptBox[\(\[Sum]\), \(l = 1\), \(10\)]c[[i]] c[[j]] c[[k]] c[[l]] 
\*SuperscriptBox[\(E\), \(\((\[Alpha][[
           i]] + \[Alpha][[j]] x1)\) + \((\[Alpha][[
           k]] + \[Alpha][[l]] x2)\)\)]\)\)\)\)

ContourPlot[f[x1, x2], {x1, -10, 10}, {x2, -10, 10}]
$\endgroup$
  • $\begingroup$ Thanks! Maybe we need double brackets for the index here? $\endgroup$ – James Feb 18 '16 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.