Bernoulli numbers


உலகின் முதல் நிரல் இயற்றிய அரசி அடா லவ்லேஸ், (Bernoulli numbers) பெர்னொல்லீ எண்களை கணக்கிட்டார்!

Bernoulli number’s have the historic significance in computer programming – Lady Ada Lovelace’s “first” computer program for the Babbage Analytical engine calculated the Bernoulli number sequence. Here we do the same operations using a slightly easier method of recursion using the recurrence relation:

 \begin{align}   B_m(n) &= n^m-\sum_{k=0}^{m-1}\binom mk\frac{B_k(n)}{m-k+1} \\   B_0(n) &= 1. \end{align}


You can see the full code listing at Ezhil-Language repository

# பெர்னொல்லீ எண்களை கணக்கிடு
நிரல்பாகம்  பெர்னொல்லீ_எண் ( m, n  )
  @( m == 0 ) ஆனால்
    # பெர்னொல்லீ_எண்( 0, n ) = 1
    பின்கொடு  1.0
    பெர்னொல்லீ = 0.0
    மொத்தம் = 0.0
    எண்கள் = range(0,m)
    @(எண்கள் இல் இவ்வெண்) ஒவ்வொன்றாக
        மொத்தம் = மொத்தம் + binomial_coeff(m,இவ்வெண்)*பெர்னொல்லீ_எண்(இவ்வெண்,n)/(m - இவ்வெண் + 1.0)	
        #பதிப்பி இவ்வெண், மொத்தம்
    பெர்னொல்லீ = n^(m*1.0) - மொத்தம்
    பின்கொடு    பெர்னொல்லீ


You can run the code to verify the first few Bernoulli numbers:

B1 = பெர்னொல்லீ_எண்(1,0)
பதிப்பி "B1 = B(1,0)", B1
assert( (B1 - 0.5) < 1e-3 )

பதிப்பி "B2 = B(2,0)", பெர்னொல்லீ_எண்(2,0)
பதிப்பி "B4 = B(4,0)", பெர்னொல்லீ_எண்(4,0)

B6 = பெர்னொல்லீ_எண்(6,0)
பதிப்பி "B6 = B(6,0)", B6
assert( (B6 - 0.02380) < 1e-3 )

பதிப்பி "B4 = B(4,1)", பெர்னொல்லீ_எண்(4,1)

Credits: Photo from Flickr user.

எழில் மொழி மேம்பாடு கோவை – 3

Ezhil Language Tamil Programming

Happy Thanksgiving holiday 2015, to all readers. Quoting from Tamil adage,
“நன்றி மறப்பது நன்றன்று; நன்றல்லது அன்றே மறப்பது நன்று”.

This weekend Ezhil language got a
semantic analyzer framework, ‘execute’ function, Bernoulli number example; see more

0) add visit_binary_expr for the transformer
1) add semantic type check for string concat via + and string comparisons
2) add semantic type check test cases and driver script updates
3) Python3 compat of
4) unittest for pprint needs to be updated; TBD

11) add code for execute file and copy variables into local scope
12) add unittest for 1; resolves issue Language feature – execute / இயக்கு #101
13) add semantic validation step following parser
14) update visitors for Array and Dict
15) update test to relative paths

21) Bernoulli numbers : demoed in Ezhil

31) Update Python3 Interpreter loading by avoiding NoClobber errors
32) __init__ to use relative imports
33) __main__ module added to Python for style “python -m ezhil” to start interrpreter
34) testcases added for hexadecimal.n
35) updated to load on Python3 (print statements esp in new style)
36) envchecks, foo, ifparse, ifparse2 Ezhil programs are added to test suite

எழில் மொழி மேம்பாடு கோவை – 2

Ezhil - Tamil Programming Language

எழில் மொழி மேம்பாடு கோவை – 2

0) Enable profiling of Ezhil code.
1) Add tracebacks where necessary.
2) Add unittest and examples for profiling -gcd, fact,
3) Refactor the env behavior with runtime
4) test sentinel fixup to run goldenratio.n and array_wr.n
5) accept parameter called stacksize to Ezhil CLI
6) make exprs code to return a 255 exit code upon exception
7) make unittests for failing exprs code to run fast and less verbose
8) exprs code fails properly now

10) Add profiling information to any program on the fly; '-profile'
11) add entry/exit calls to profile("begin") and profile("results") as we go.
12) API update to raw_input to be i/p exception safe to Interpreter state
13) Handle exceptions better during raw_input calls
14) add capability to  QuietTest unittest class
15) update hello.n to not break the prettyprinter test
16) HTML API update

21) Mathematics series + sequence operations for Ezhil programs
22) Ezhil Interpreter - ezhili
23) update test script

31) Add ezhil test for interactive programs using echo
32) simple demos
33) enable the programs stored in Tamil/unicode file names to be executed correctly
34) file_close failed due to serializing env - we wont attemp this from now on
35) hanoi.n - dont mix str and unicode
36) test - recover the filerw.n as well
37) down to 15 failures
38) update str.x methods to string.x which are encoding compatible;

40) unittest for running Python2 and 3 versions
41) Python3 recognizes Ezhil code; we are at starting line.
42) Code can be optimistically ported between 2-3
43) improve profiling output formatting;
44) update yinyang to skip the pause
45) input stream should not be opened in UTF-8 for Python2 nor Python3
46) dump_file is the name we use within tests
48) Fix call-stack and local scoped variable unwinding of interpreter if any exceptions were thrown.
49) This resolves issue #60. "After runtime error local variables are trashed; #60"
50) Python3 testing for Ezhil; unittest3 is not ready;
51) fixup the unittest and error stack during the file execution

51) make profiling work in Python3
52) update list/dictionary key/value retval in Python2/3 barriers
53) update test3 sentinel to use suffix 3 log files during test.

61) failures only in Python3

More at Ezhil Lang development site.

எழில் மொழி மேம்பாடு கோவை

Ezhil Language – Interpreter Updates : github

Ezhil - Tamil Programming Language
Ezhil – Tamil Programming Language
0) Output of expr evaluator returns base Python elements; this seems to show a good speedup in the interpreter

1) Assertions return a exit code 255 - issue #99 resolved
2) Add support for binary operators >> and << ; right and left shifts
   Language feature and issue #98
3) Add support for unary operator bit complement ~
4) Update logical not operator to return (T) / (F) along with poi-mei in its str representation
5) Builtin str in Python is used directly in Ezhil
6) scanner symbols have to be in sequence with the
   length of token types, otherwise odd things can happen
7) use x-platform coding in Ezhil; Windows platform returns "win32" for call sys_platform()
8) updated known failure list for testing.

9) add xor operation as a Ezhil builtin function; & add unittest
10) golden ratio
11) ezhil support for Python3
12) ezhil staircase light example
13) kludge of eval builtin
14) mathipeedu

If you are interested in contributing, please check our issues on github and send a pull-reqest.

Ezhil-Lang accepts input in UTF-8 or TSCII

Ezhil-Lang accepts input in UTF-8 or TSCII

Today I am submitting a change that enables the support for multiple encoding files in Ezhil interpreter. Primary motivation is to address some thinly veiled announcement of a new programming language – and simultaneously – a criticism of Ezhil interpreter published as part of INFITT 2014 proceedings. This change should put things to rest.

 We will accept programs written in other encoding like TSCII to demonstrate Ezhil is not limited by encoding.

Our internal encoding will continue to be UTF-8.

Ideally we may support any encoding capable of conversion into Unicode, via the open-tamil library or other freely available sources.