Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improve complex numbers #8

Closed
nooodl opened this Issue · 4 comments

3 participants

nooodl ngn jayfoad
nooodl

There are some issues with the current implementation of complex numbers. Many operations -- like ×, |, *, , -- don't support complex arguments, and complex division is completely broken:

0j2 ÷ 0j1   ⍝ returns 0.5 instead of 2

(This issue is caused by line 89 of src/complex.coffee:

 d = @re * @re + @im * @im

should be:)

 d = x.re * x.re + x.im * x.im
ngn ngn referenced this issue from a commit
ngn fixed complex division, issue #8 5a6d92a
ngn
Owner
ngn commented

Thanks for hunting down the division bug for me.

As for the other operations, I wanted to avoid doing my own implementation. I'd rather refactor complex.coffee and use a lib like mathjs. So, I'm keeping this issue open until then.

ngn
Owner
ngn commented

Now that I had a better look at mathjs, I think it's an overkill. Going ahead with a custom implementation...

jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement floor and ceiling on complex numbers, following the
Extended APL standard ISO/IEC 13751.
e816cec
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement ¯9○. 74d4bfe
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement ¯8○. c108258
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement 0○, including an obvious extension to the ISO
standard when the result is complex.
acc43a0
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement 4○. 159dd84
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement 8○. c98c49f
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement 9○. 58ad3cc
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement 10○. 6f30372
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement 11○. 48ee773
jayfoad jayfoad referenced this issue from a commit
jayfoad jayfoad Issue #8: implement 12○. f02c3c5
jayfoad
Collaborator

I've added complex support to all of the circular functions except for (inverse) (hyperbolic) sin, cos and tan.

ngn
Owner

Awesome! I'll take care of the rest.

ngn ngn referenced this issue from a commit
ngn Issue #8: implement ¯1○. b874d40
ngn ngn referenced this issue from a commit
ngn Issue #8: implement ¯2○. f3e4b57
ngn ngn referenced this issue from a commit
ngn Issue #8: implement ¯3○. 0af595a
ngn ngn referenced this issue from a commit
ngn Issue #8: implemented ¯5○. f14ae83
ngn ngn referenced this issue from a commit
ngn Issue #8: implement ¯6○. fd1e56b
ngn ngn referenced this issue from a commit
ngn Issue #8: implement ¯7○. 4cfe1d0
ngn ngn closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.