Skip to main content
added 379 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

Octave with Image Package, 25 bytes

@(d)padarray(e(d-2),+~~d) 

Anonymous function that inputs a vector with the coordinates and outputs an n-dimensional array. Wall and space are respectively 0 and e (equal to 2.71828...)

Note that, when displaying, the first dimension corresponds to the vertical direction.

Try it online!

Explanation

@(d)padarray(e(d-2),+~~d) @(d) % Define anonymous function e(d-2) % N-dim array containing e, with side lengths given by d-2 +~~d % Negate d twice, cast to double: gives vector of N ones (**) padarray( , ) % Add a frame of zeros to (*) with thickness (**) in each dim 

Octave with Image Package, 25 bytes

@(d)padarray(e(d-2),+~~d) 

Anonymous function that inputs a vector with the coordinates and outputs an n-dimensional array. Wall and space are respectively 0 and e (equal to 2.71828...)

Note that, when displaying, the first dimension corresponds to the vertical direction.

Try it online!

Octave with Image Package, 25 bytes

@(d)padarray(e(d-2),+~~d) 

Anonymous function that inputs a vector with the coordinates and outputs an n-dimensional array. Wall and space are respectively 0 and e (equal to 2.71828...)

Note that, when displaying, the first dimension corresponds to the vertical direction.

Try it online!

Explanation

@(d)padarray(e(d-2),+~~d) @(d) % Define anonymous function e(d-2) % N-dim array containing e, with side lengths given by d-2 +~~d % Negate d twice, cast to double: gives vector of N ones (**) padarray( , ) % Add a frame of zeros to (*) with thickness (**) in each dim 
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

Octave with Image Package, 25 bytes

@(d)padarray(e(d-2),+~~d) 

Anonymous function that inputs a vector with the coordinates and outputs an n-dimensional array. Wall and space are respectively 0 and e (equal to 2.71828...)

Note that, when displaying, the first dimension corresponds to the vertical direction.

Try it online!