examples to compare tradtional math notations vs APL/J notations [closed]
Asked Answered
G

2

5

I am reading a review to compare Mathematica to APL/J. One question raised in the article seems very interesting to me:

Is Mathematica really the way to go to express our creative thoughts – viz back to a 17th century notation designed for parchment instead of forward to a twentieth-century one designed for computers?

Can one share examples of Iverson's notation vs traditional math notation to demonstrate the edge of APL/J on expressing and solving math problems? This would be greatly helpful for new comers.

Gibby answered 22/1, 2014 at 19:23 Comment(2)
This question appears to be off-topic because it is about alternate mathematical notations rather than a specific programming problem.Bobseine
Keep in mind that the document you linked is rather biased, since the author calls himself an "active APLer".Arizona
G
5

One example: Alternating series.

Alternating sum is very common in mathematics. But it is cumbersome to put the sign before each term:

\sum_{k=1}^n (-1)^k a_k

in APL and J, because of the order of operations, it is

-/a
Gibby answered 23/1, 2014 at 15:10 Comment(0)
F
5

I recommend reading Iverson's paper Notation as a Tool of Thought, kindly provided by the J folks. It deals precisely with this issue.

In it you'll find many Math proofs derived using APL instead of the classical notation, along with accompanying commentary. Here's a redacted example, proving Gauss's formula for the arithmetic series:

+/⍳n    
+/⌽⍳n               ⍝ as + is associative and commutative
((+/⍳n)+(+/⌽⍳n))÷2  ⍝ as x=(x+x)÷2
(+/(⍳n)+(⌽⍳n))÷2    ⍝ as + is associative and commutative
(+/(n/n+1))÷2       ⍝ summing each respective x∊⍳n and y∊⌽⍳n, y=n+1-x → (x+y)=n+1
(n×n+1)÷2           ⍝ per definition of × (times)

Other articles by Iverson, Hui and friends are also illuminating. Again, the J folks provide a notable library.

Floccus answered 25/1, 2014 at 15:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.