Jep

Jep Examples

Extensions examples

Singular Systems

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

The factorial(x) function can be used to test the range of the various types. In a webbrowser with the javascript version:

Integer factorials upto 21 can be calculated:
> setfield integer
Setting field INTEGER
> factorial(10)
3628800
> factorial(20)
2432902008176640000
> factorial(21)
51090942171709440000
> factorial(22)
1.1240007277776077e+21
Doubles work the same
> setfield double
Setting field DOUBLE
> factorial(21)
51090942171709440000
> factorial(22)
1.1240007277776077e+21
BigIntegers allow much larger values
> setfield bigint
Setting field BIGINT
> factorial(20)
2432902008176640000
> factorial(30)
265252859812191058636308480000000
> factorial(40)
815915283247897734345611269596115894272000000000
> factorial(50)
30414093201713378043612608166064768844377641568960512000000000000

Calculations with fractions

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

Calculation of pi using Ramanujan's formula $${\displaystyle {\frac {1}{\pi }}={\frac {2{\sqrt {2}}}{9801}}\sum _{k=0}^{\infty }{\frac {(4k)!(1103+26390k)}{(k!)^{4}396^{4k}}}} $$

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); } v

Calculation of e

 s=1; f=1; for(k=1;k<50;++k) { f*=k; s+=1/f; println(s) }
 

Continued fraction for pi

a=zeroVec(20);
n=pi; for(i=1;i<=20;++i) { b=floor(n); n = 1/(n-b); a[i]=b  }
a
Reconstructing values from array rep of 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) }