JXN User Notes

    Repetition of Commands     Arithmetic     Autocomplete

Repetition of Commands

  1. Clicking on a line in the output list transfers the line to the input field where it can be modified and executed again with the [↵] key.

  2. The cursor keys [ ↑ ] and [ ↓ ] scroll through the command history and show the commands in the input field. [ ↓ ] [↵] [ ↓ ] [↵] … repeats a sequence of commands.

  3. name=[↵] repeats the most recent assignment to variable name.

  4. Menu: File > Edit…  transfers the output list into an editor window. In the editor the commands can be modified and executed again with Menu: Run > replace & close.

Differences of the Arithmetic compared to Java

    see also JXN_versus_Java, JxnSimplifiedSyntaxTable and JXN_EBNF_Syntax
  • The multiplication operator '*' may be omitted
    e.g.:   a b ≡ a * b, 2t ≡ 2 * t, 2(a+3b) ≡ 2 * ( a + 3 * b )

    Please note:   a / b c ≡ a / b * c ≡ ( a / b ) * c   ≠   a / ( b c ) ≡ a / ( b * c ) ≅ a / b / c

  • Function calls with exactly one parameter can be written without brackets
    e.g.:   sqrt 3 ≡ sqrt(3), sin 2 t ≡ sin( 2 * t ), but  exp 2 * t ≡ exp(2) * t

  • The syntactical ambiguity  a b  is resolved as follows:
    a b is interpretered as
        a * b   if variable a is defind
        a(b)    if method a is defined for b
        else error message: identifier a undefined


  • JXN uses '^' or alternatively "**" as the exponentiation operator
    e.g.:   y^x ≡ y**x ≡ pow( y, x )

    The exponentiation operator is of higher priority than '*', '/' and the ommited '*'-operator
    i.e.   a y^x b ≡ a * pow( y, x ) * b
    Caution: avoid the missleading notation e.g.: 2y^3x ≡ 2 y^3 x ≡ 2 * pow( y, 3 ) * x

    The exponentiation operator also is of higher priority than the unary '-'-operator (→ Wikipedia)
    i.e.   -y^x ≡ -(y^x) ≡ -pow( y, x )


  • @ClassName(…) calls the constructor:  @ClassName(…)  in JXN stands for  new ClassName(…)  in Java.


  • The predefined variable  $ contains the result of the most recent statement.
    Example:
       sqrt(2)
        = 1.4142135623730951 (double)
       $^2
        = 2.0000000000000004 (double)
      
  • Further examples (see also JxnSimplifiedSyntaxTable):
      y = x^2 + p x + q  ≡  y = pow( x, 2 ) + p * x + q
      z = y^sqrt 2x  ≡  z = pow( y, sqrt( 2 * x ) )
    
      x = exp( -0.5 t^2 ) cos( 2 PI f ( t - t0 ) )
        = exp  -0.5 t^2 * cos  2 PI f ( t - t0 )  ≡  x = exp( -0.5 * pow( t, 2 ) ) * cos( 2 * PI * f * ( t - t0 ) )
    
    but
      x = exp  -0.5 t^2   cos  2 PI f ( t - t0 )  ≡  x = exp( -0.5 * pow( t, 2 )   * cos( 2 * PI * f * ( t - t0 ) ) )
    
    
    Avoid the missleading notation using the exponentiation operator (Irrespective of the notation '^' is of higher priority than the omitted '*'-operator):
      exp -2x^2t  ≡  exp -2 x^2 t  ≡     exp( -2   * pow( x, 2 ) * t )
        y^-2x^2t  ≡    y^-2 x^2 t  ≡  pow( y, -2 ) * pow( x, 2 ) * t
    
      exp -2(x+1)                     ≡     exp( -2   * ( x + 1 ) )
        y^-2(x+1)  ≡  y^-2 ( x + 1 )  ≡  pow( y, -2 ) * ( x + 1 )
    
      sqrt(2+3)^-2x  ≡  sqrt(2+3)^-2 x  ≡  pow( sqrt( 2 + 3 ), -2 ) * x
         y(2+3)^-2x  ≡    y (2+3)^-2 x  ≡    y * pow( 2 + 3,   -2 ) * x
    

  • Method calls:
    f x.g y ≡ f(x.g(y)) ≠ f(x).g(y)  ( ≡ (f x).g y )
    
    f (x).g() ≡ f(x).g() ≠ f( (x).g() )
    
       sqrt ( 2.5 2.5 ).intValue()  ! avoid
        = 2 (int)
       sqrt( 2.5 2.5 ).intValue()      ! = sqrt( 2.5 * 2.5 ).intValue() => sqrt( 6.25 ) > 2.5 (double) > 2 (int)
        = 2 (int)
       sqrt 2.5 ( 2.5 ).intValue()     ! = sqrt( 2.5 * (2.5).intValue() ) => sqrt( 5.0 )
        = 2.23606797749979 (double)
       sqrt( ( 2.5 2.5 ).intValue() )  ! = sqrt( ( 2.5 * 2.5 ).intValue() ) => sqrt( 6.0 )
        = 2.449489742783178 (double)
       (sqrt 2.5 * 2.5).intValue()     ! = ( sqrt(2.5) * 2.5 ).intValue()
        = 3 (int)
       sqrt 2.5 * (2.5).intValue()     ! = sqrt(2.5) * (2.5).intValue()
        = 3.1622776601683795 (double)
    

  • Constructor calls:
      @class_name object.method_name single_argument
    ≡ @class_name(object.method_name(single_argument))
    ≠ @class_name(single_argument1).method_name(single_argument2)
    
    

Autocomplete

  • autocomplete is initialized with the [Page↓] or the [Page↑] key in the input field and shows suggestions based on the text already entered according to the following patterns:
    - [Page↓] or part_of_name[Page↓] selects from the known variable names (starting width part_of_name)
    - identifier.[Page↓] or identifier.part_of_name[Page↓] selects from public methods and fields of the object or class given by identifier
  • [Page↓] shows the next suggestion, [Page↑] shows the previous suggestion, [Esc] resets to the original, text entry or [→] accept the suggestion