Jep Extensions Console

Console application with calculation in different fields, structured programming constructs, matrix operations, and statistical functions.

Field selection

This console can perform calculations using various different fields including integers, fractions, decimals with a specific number of decimal places. Use

Notes:

Structured programming

The console allows simple structured programming constructs like loops and if statments. It supports

    for(i=1;i<10;++i) { ... }
    while(i<10) { ... }  while loops
    break;   (inside a loop)
    continue;   (inside a loop)
    if(i<10) { ... } else { ... }
    statement; statement
    { statement; statement }
    print(a,b,c)
    println(a,b,c)

Examples

A simple loop can add the numbers from 1 to 10

sum=0; for(i=1; i<=10; ++i) { sum += i; } 

Symbolic operations

Symbolic assignment

Matrix operations

Statistical functions

Advanced Examples

Using the factorial(x) function to find number of digits of precision

Input
setfield integer
factorial(10)
factorial(20)
factorial(21)
factorial(22)
Result
Setting field INTEGER
3628800
2432902008176640000
51090942171709440000
1.1240007277776077e+21

Doubles work the same

setfield double
factorial(21)
factorial(22)
Setting field DOUBLE
51090942171709440000
1.1240007277776077e+21
BigIntegers allow much larger values
setfield bigint
factorial(20)
factorial(30)
factorial(40)
factorial(50)
Setting field BIGINT
2432902008176640000
265252859812191058636308480000000
815915283247897734345611269596115894272000000000
30414093201713378043612608166064768844377641568960512000000000000

Calculations with fractions

setfield rational
1/6*2/5
1/6+1/2
Setting field RATIONAL
2/3
1/15

Calculation of pi using Ramanujan's formula Ramanujan's formula

s=1103; a =1; c=1; d=1; \\
for(k=1;k<10;++k) {\\
  a*=(4*k-3)*(4*k-2)*(4*k-1)*(4*k);  \\
  b =1103 +  26390*k; \\
  c *= k*k*k*k; d *= 396^4; s+= a*b/(c*d); \\
  v = 9801/(2*sqrt(2)*s); println(v); }
3.141592653589793877998905826306015
3.141592653589793238462649065702759
3.141592653589793238462643383279558
3.141592653589793238462643383279506
3.141592653589793238462643383279506
3.141592653589793238462643383279506
3.141592653589793238462643383279506
3.141592653589793238462643383279506
3.141592653589793238462643383279506

Calculation of e

s=1; f=1; for(k=1;k<30;++k) { f*=k; s+=1/f; println(s) }
2
2.5
2.666666666666666666666666666666667
2.708333333333333333333333333333334
2.716666666666666666666666666666667
2.718055555555555555555555555555556
2.718253968253968253968253968253969
...
2.718281828459045235360287471352545
2.718281828459045235360287471352658

Continued fraction for pi

setfield double
a=zeroVec(20);
n=pi; for(i=1;i<=20;++i) { b=floor(n); n = 1/(n-b); a[i]=b  }
a
Setting field DOUBLE
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
4
[3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3, 3, 23, 1, 1, 7, 4]
Reconstructing values from array representation of a continued fraction
a=[3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2]
for(i=1;i<=20;++i) { \\
  s=a[i]; \\
  for(j=i-1;j>0;--j) { \\
    s = a[j]+1/s } \\
  println(s) }
[3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2]
3
3.142857142857142857142857142857143
3.141509433962264150943396226415094
...
3.141592653589793239014009759199591
3.141592653589793238386377506390380
3.141592653589793238493875058011561
Solving an expression using Newton method. Uses symbolic differentiation and symbolic assignment f:= ...
f := x^2 - x - 1
g := diff(f,x)
x=1
for(i=0;i<10;++i) { x -= f/g; println(x,f); }
f:=x^2-x-1
g:=2*x-1
x=1
2, 1
1.666666666666666666666666666666667, 0.111111111111111111111111111111112
1.619047619047619047619047619047619, 0.002267573696145124716553287981859
1.618034447821681864235055724417427, 0.000001026515933067055100295739241
1.618033988749989097047296779290725, 2.10746819100131229750E-13
1.618033988749894848204586838338167, 8.882845E-27
1.618033988749894848204586834365638, 0E-33
1.618033988749894848204586834365638, 0E-33
1.618033988749894848204586834365638, 0E-33
1.618033988749894848204586834365638, 0E-33