No MATL answer here yet! yay!
{n←⍺⋄P5.G.circle 3⍴30⋄{P5.G.ln↑30×1+2 1○ᑈ1n×⍵×○2÷k}¨⍳k←⍵}
Draws a 30x30 circle with the times table for n
and k
.
Function submission which takes arguments as n f k
, and will display properly on a default sized canvas.
This uses the formula from user58543's answer.
You can test this out using this file and dzaima's APLP5 engine.
Explanation:
{n←⍺⋄P5.G.circle 3⍴30⋄{P5.G.ln↑30×1+2 1○ᑈ1n×⍵×○2÷k}¨⍳k←⍵}
{n←⍺⋄ k←⍵} store left arg in n and right arg in k
P5.G.circle 3⍴30⋄ Draw circle of radius 30
⍳k generate range 1..k
{ }¨ Execute the following for each number i:
1n×⍵×○2÷k Multiply [1,n] with i×2π/k
2 1○ᑈ Take cos and sin of each of those
30×1+ Multiply 30, add 30 to them
↑ Convert to matrix
P5.G.ln Plot a line using those coordinates
Output for n=5, k=10
: