Skip to content

Commit

Permalink
Merge pull request #333 from Kyarigwo/UpdateNBodyExample
Browse files Browse the repository at this point in the history
Updated n-body example
  • Loading branch information
kaikalii committed Dec 26, 2023
2 parents e1049df + 4bd8994 commit 84aa831
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions examples/n-body.ua
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ Dt ← 0.01
Steps ← 120

Step ← (
⊞≠.⇡⧻. # Make comparison matrix
⊃(≡▽⊙¤)⋅∘ # Make others
⊃≡(-¤)∘: # Get diffs
÷⍜(☇1|≡/+×.). # Inverse square
≡/+×G # Get accs
⟜+⋅∘ ×Dt # Apply accs
⊃(+×Dt)∘ # Apply vels
⊞≠.⇡⧻. # Make comparison matrix
⊃(≡▽⊙¤)⋅∘ # Make others
⊃≡(-¤)∘: # Get diffs
÷⍜(☇1|≡/+×.). # Inverse square
≡/+×G # Get accs
(+⊙⋅∘)(⋅∘)×Dt # apply accs
⊃(+×Dt)∘ # Apply vels
)

[0_60 150_0 30_15 80_110]
⊃∘(↯:0⊂:2⧻) # Init vels

⁅×0.5⇌[⊙;⍥(Step ,:)Steps] # Run
⍜⊙(☇1)-¤/↧☇1. # Normalize
⍜⊙(☇1)-¤/↧☇1. # Normalize
⬚0≡(°⊚) # Plot
≡(⍜(☇2)≡(/↥/↥) ◫3_3) # Upscale

Expand Down

0 comments on commit 84aa831

Please sign in to comment.