-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
New proposed model, needs some fixes
complexMultiplyModel←{
(⎕FR≡1287) ∧ case≡'Hcmplx': ⍺×⍵ ⍝ Skipping cmplx for ⎕FR←1287
a c b d←∊(9 11○⊂)⍺ ⍵
⍝ using formula (a+bi)(c+di)=(ac−bd)+(ad+bc)i
x←((a model c)-(b model d))
y←((a model d)+(b model c))
x(⊣+¯11○⊢)y
}
⍝ model←{*(⍟⍺)+⍟⍵}
model←{⍺{
⍝ ⍺ or ⍵ being 0 will give 0
0≡⍵:0
0≡⍺:0
⍝ isCmplx
⍝ ((⊢≠+)⍺)∨((⊢≠+)⍵): r←*(⍟⍺)+⍟⍵
(1289≡⎕DR ⍵) ∨ (1289≡⎕DR ⍺): ⍺ complexMultiplyModel¨ ⍵
⍝ ⎕←(⌹¨÷/×⍺ ⍵)
r←*(⍟|⍺)+⍟|⍵
⍝ if 1 negative number negate the output
1≡+/¯1⍷×⍺ ⍵:-r⋄r
}¨⍵
}
Could you use {*(⍟⍺)+⍟⍵} as the model (using logarithms instead)? This would remove the need to handle complex numbers specifically.
Or, alternatively, could you use multiple models for redundancy?
Originally posted by @definitelyprobably in #76 (comment)
Reactions are currently unavailable