I can replicate the spelling error by saving the output buffer as text, and 
then using it as input.

You may want to try
M-x describe-coding-system
in emacs.

 Best,

John



________________________________
From: Programming <[email protected]> on behalf of Devon 
McCormick <[email protected]>
Sent: Friday, July 19, 2019 10:41 AM
To: J-programming forum
Subject: [Jprogramming] Program to replicate Ramanujan's methods

Fellow Jedi -

There's a New Scientist article about some people who open-sourced some
code to attempt to accomplish Ramanujan-like discoveries in the area of
continued fractions:
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.newscientist.com%2Farticle%2F2209213-computer-attempts-to-replicate-the-dream-like-maths-of-ramanujan%2F&amp;data=02%7C01%7Crandall%40newark.rutgers.edu%7C87d3200dfc94491f33bc08d70c573a82%7Cb92d2b234d35447093ff69aca6632ffe%7C1%7C0%7C636991441095654092&amp;sdata=LtJ0l8lMLCaWlUDJ0I7SQQrBnoRJ566o1XdxrG1i6xQ%3D&amp;reserved=0
 .

Unfortunately it is paywalled, so I will fair-use a little here:

*The theorems Ramanujan produced often involved continued fractions, which
express a number as the sum of infinitely nested fractions.*

*To mimic this approach, Gal Raayoni at the Israel Institute of Technology
and his colleagues created the Ramanujan Machine
<https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Farxiv.org%2Fabs%2F1907.00205&amp;data=02%7C01%7Crandall%40newark.rutgers.edu%7C87d3200dfc94491f33bc08d70c573a82%7Cb92d2b234d35447093ff69aca6632ffe%7C1%7C0%7C636991441095654092&amp;sdata=f2uDIHb%2FWTpur9r6cXFtuUzInQy7euSlTuEi9BbWWts%3D&amp;reserved=0>.
 It has already come up with tens
of conjectures that use continued fractions to approximate π and e.*

*One method the program uses to search for new conjectures is a “meet in
the middle” approach. This involves generating many mathematical
expressions, computing their value for a limited number of iterations and
eliminating the expressions that give inaccurate results.*
Anyway, the formula for *e* they show in the article renders into J this
way:

   calcRamalikeE=: 13 : '(+`%)/,x:(3+i.y),.->:i.y'"0
   calcRamalikeE
([: +`%`:3 [: , [: x: (3 + i.) ,. [: - [: >: i.)"0
   calcRamalikeE 10 20
9864101r3628800 6613313319248080001r2432902008176640000
   >50j48":&.>calcRamalikeE 10 20
2.718281801146384479717813051146384479717813051146
2.718281828459045235339784490666415886146403434540

All fine and good but when I tried to replicate this from memory at home
tonight, I kept getting a "spelling error" on the "(+`%)" part.  Eventually
I figured out that what I'm typing in is rendering in Unicode and is
failing a spelling test.  I'm running J64 8.07, Library 8.07.26, and, as
always, under Emacs on Windows.

I'm afraid it may just be an Emacs thing as I had saved the problematic
session as "raw-text" earlier but I'd be pleased to hear from anyone who
could replicate or explain this or, even better, make sure it never happens
to anyone else ever again.

Thanks,

Devon

--

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7Crandall%40newark.rutgers.edu%7C87d3200dfc94491f33bc08d70c573a82%7Cb92d2b234d35447093ff69aca6632ffe%7C1%7C0%7C636991441095654092&amp;sdata=mDmvYIur9Wu7LV2jcGWcpkJVp20fq3%2BHqj0OPMRqd7E%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to