Skip to content

Commit 02adecb

Browse files
committed
update n-body example
1 parent b1660ed commit 02adecb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/n-body.ua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Dt ← 0.01
33
Steps ← 120
44

55
Step ← (
6-
⊞≠.⇡⧻. # Make comparison matrix
6+
⊞≠.°⊏ # Make comparison matrix
77
⊃(≡▽⊙¤)⋅∘ # Make others
88
⊃≡(-¤)∘: # Get diffs
99
÷⍜♭₂(≡/+×.). # Inverse square
@@ -13,12 +13,12 @@ Step ← (
1313
)
1414

1515
[0_60 150_0 30_15 80_110]
16-
⟜(↯:0⊂:2⧻) # Init vels
16+
⟜(↯⊙0⊂⊙2⧻) # Init vels
1717

18-
⁅×0.5⇌[⊙◌⍥(Step ⟜:)Steps] # Run
19-
⍜⊙♭₂-¤/↧♭₂. # Normalize
20-
⬚0≡(°⊚) # Plot
21-
≡(⧈(/↥/↥)3_3) # Upscale
18+
⁅×0.5 ⍥⤚Step Steps # Run
19+
⍜⊙♭₂-¤/↧♭₂. # Normalize
20+
⬚0≡(°⊚) # Plot
21+
≡(⧈(/↥)3_3) # Upscale
2222

2323
&fwa "n-body.gif" gif 16
2424
&p "Wrote gif to n-body.gif"

0 commit comments

Comments
 (0)