I do not recall having seen this matrix before, but I will not be surprised to learn that somebody else already knows all about it, especially if that person's name is Nick.
Contents
Q
I've been investigating the matrices generated by this elegant one-liner.
Q = @(n) (-n:n).^2 + (-n:n)'.^2;The Q is for "quadratic".
The middle column contains the squares of the integers from -n to n. So does the middle row. The apostrophe summons singleton expansion. The resulting matrix has order 2*n+1. Here is Q(5).
Q5 = Q(5)Q5 = 50 41 34 29 26 25 26 29 34 41 50 41 32 25 20 17 16 17 20 25 32 41 34 25 18 13 10 9 10 13 18 25 34 29 20 13 8 5 4 5 8 13 20 29 26 17 10 5 2 1 2 5 10 17 26 25 16 9 4 1 0 1 4 9 16 25 26 17 10 5 2 1 2 5 10 17 26 29 20 13 8 5 4 5 8 13 20 29 34 25 18 13 10 9 10 13 18 25 34 41 32 25 20 17 16 17 20 25 32 41 50 41 34 29 26 25 26 29 34 41 50I like the contour plot.
contourf(Q(100)) axis square colorbar title('Q(100)')
D
For another blog post under development, I need a logical mask that carves a circular region out of graphic. This disc does the job.
D = @(n) Q(n)