title: Make a 4d array, where each point is corresponds to the result of a function
body: <p>So I need an array where each point corresponds to a value of a function on those coordinates. Until now, I was dealing with 2d functions so I just did this:</p>
  
  <pre><code>  x &lt;- seq(a1,b1, length.out = 10000)
    y &lt;- seq(a2,b2, length.out = 10000)
    func &lt;- outer(x,y,FUN)
  </code></pre>
  
  <p>Where I define the domain of my variables above, and below it generates a matrix where each point is the value of my function "FUN" at those coordinates.
  However, now I need to do this for a function that takes in 4 variables.</p>
  
  <p>I want it to be a 4d array but I don't know how to achieve this without resorting to a bunch of 'for' cycles, which I really don't want to.</p>