Skip to content

Commit

Permalink
feat: clean complex numbers and FFT.
Browse files Browse the repository at this point in the history
  • Loading branch information
Panadestein committed Jan 25, 2025
1 parent 260e3f3 commit 853c305
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/bqn/ns.bqn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cn ← {
z ← {
_p ⇐ {(-´𝔽¨)(+´𝔽¨)}
Cis(•math.Cos≍•math.Sin)¯π×↕÷
CE-´˘, •math.Cos≍•math.Sin
}
FFT ← {𝕊: -´˘{≠÷˜·𝔽𝔾𝔽}𝕊𝕩; (1=≠)⟨(+∾-)(⊢×cn._p˘cn.Cis)´(𝕊¨⊢⊔˜2|⊒˜), 𝕩}
FFT ← {𝕊: z.C{≠÷˜·𝔽𝔾𝔽}𝕊𝕩; (1=≠)⟨(+∾-)(⊢×z._p˘·z.E-π×↕÷)´(𝕊¨⊢⊔˜2|⊒˜), 𝕩}
8 changes: 4 additions & 4 deletions src/ns.org
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ in two dimensions for an incompressible fluid, imposing periodic boundary condit
The numerical solution will be obtained using this zero-dependency BQN code:

#+begin_src bqn :tangle bqn/ns.bqn :exports code
cn ← {
z ← {
_p ⇐ {(-´𝔽¨)⋈(+´𝔽¨)⟜⌽}
Cis(⍉•math.Cos≍•math.Sin)¯π×↕⊸÷
C‿E⟨⋈⟜-´˘, ⍉•math.Cos≍•math.Sin
}
FFT ← {𝕊⁼: ⋈⟜-´˘{≠÷˜·𝔽𝔾∘𝔽}𝕊𝕩; (1=≠)◶⟨(+∾-)⟜(⊢×cn._p˘cn.Cis∘≠)´(𝕊¨⊢⊔˜2|⊒˜), ⊢⟩𝕩}
FFT ← {𝕊⁼: z.C{≠÷˜·𝔽𝔾∘𝔽}𝕊𝕩; (1=≠)◶⟨(+∾-)⟜(⊢×z._p˘·z.E∘-π×↕⊸÷∘≠)´(𝕊¨⊢⊔˜2|⊒˜), ⊢⟩𝕩}
#+end_src

#+RESULTS:
: (function block)
: 1

#+BEGIN_EXPORT html
<div style="text-align: center; font-size: 2em; padding: 20px 0;">
Expand Down

0 comments on commit 853c305

Please sign in to comment.