I'm having a little crysis over here. What I basically want to do is some sort of 3D-Plot, but I'm only interested in the resulting values. I have two vectors x and p:
x={x1,x2}; p={p1,p2};
and I want to calculate the value of the function f depending on 2 variables, for example
f[x_,p_]=x*p;
The input
f[x,p]
however does only calculate the diagonal elements and not all terms f[x1,p1], f[x1,p2], f[x2,p1] and f[x2,p2] what I would intuiveley expect from it.
I tried some "Map" commands but didn't get the desired result. Could someone please help me out? And if possible even share some insight of why Mathematica is doing only the diagonal elements by default? I would be very interested in it because I have the feeling that my way of thinking is often quite perpendicular to the way Mathematica does -.-
Outer[Times, x, p]
in your function. Just multiplying lists in the fashion of your example will give the respective elements multiplied, e.g.,{a,b,c}*{d,e,f}
results in{ab,be,cf}
. $\endgroup$a
$\endgroup$