RINEARN
- RINPn User Guide -

This document is the official user guide for the compact scientific calculator software "RINPn."

- Table of Contents -

Introduction

What is "RINPn"?

RINPn is a free scientific calculator software featuring a simple interface. Below is an image of the RINPn window:

As shown, the RINPn window has a common UI found in scientific calculators, making it very easy to use.

Despite its simple interface, RINPn offers powerful features. You can enter complete expressions (formulas) for calculation, and utilize various mathematical functions and parentheses. Additionally, you can define your own functions or automate processes by writing scripts. The processing speed of RINPn —- ranging from hundreds of MFLOPS to several GFLOPS —- is exceptionally fast for a calculator and also competitive within the realm of scripting languages. Moreover, you can invoke processes implemented in Java™ from within calculation expressions and scripts.

To maximize the processing speed of RINPn, raise the optimization level specified in "Settings.txt."

Furthermore, if needed, you can retract the key panel of RINPn as shown below:

It's hard to imagine that such a compact calculator comes packed with such powerful features!

In essence, RINPn combines a "small and easy-to-handle" body with a "powerful engine," making it akin to a lightweight sports car in the world of calculators.

Available for Free - Open Source & MIT License

RINPn is open source software, which means users can access its source code to customize, improve, adapt, and distribute it as needed. The repository hosting the source code is available at: https://github.com/RINEARN/rinpn.

Of course, you are also welcome to use RINPn just like any other conventional software. We welcome users of all types!

RINPn is licensed under the MIT License, a popular open source license. This license allows users to use RINPn freely for both commercial and non-commercial purposes. For more details, search "MIT License" online to find extensive resources explaining the terms.

Additionally, the license document is included in the "License" folder within the distribution package as "MIT_License.txt," and in the source code repository as "LICENSE".

- Disclaimer -

RINPn is provided without any warranties.

The developers assume no responsibility or liability for the results of using RINPn, including any errors, damages, etc.

Please ensure you agree with these terms and the conditions of the MIT License before using RINPn.

Downloading and Preparing to Use RINPn

Download the Latest Version of RINPn from the Official Website

This document is included in the RINPn package, which you might already have. If not, you can download the latest version of the RINPn package at any time from the official website:

The RINPn Official Website
https://www.rinearn.com/en-us/rinpn/

To download, click the "Download Now" button near the top of the page. This will download a compressed ZIP file named rinpn_?_?_?_en.zip (?_?_? are version numbers).

The package available via the "Download Now" button is a pre-built package, ready for immediate use, and is suitable for most users. However, if you prefer to build RINPn yourself, you can obtain the source code from the following repository:
The RINPn Source Code Repository
https://github.com/RINEARN/rinpn
Clone the repository and follow the build instructions in the README.

Extract the Downloaded Package

The downloaded file "rinpn_?_?_?_en.zip" is compressed in ZIP format and must be extracted before use.

For Microsoft® Windows® users, first right-click the ZIP file, select "Properties," and enable the "Unblock" checkbox at the bottom-right of the window under "Security" (this prevents potential security warnings or blockings during extraction or when running RINPn). To extract, right-click the ZIP file again, choose "Extract All," and follow the prompts.

For users of other operating systems (e.g., Linux®), the ZIP file can typically be extracted via the right-click menu.

On Linux, the ZIP file can also be extracted using the command line:

cd (The folder in which the download ZIP file is)
unzip -O cp932 rinpn_?_?_?_en.zip    (?_?_? are version numbers)

This method is particularly useful when using the Japanese edition of RINPn, as extracting via the right-click menu might result in "mojibake" (character corruption).

After extraction, a folder named rinpn_?_?_?_en will be created containing all the contents of the RINPn package. While it is possible to browse the files within the ZIP without extracting, RINPn may not function correctly in this state. Always extract the files before use.

Position the Extracted Folder Conveniently (Available Without Installation)

RINPn does not require installation and can be placed anywhere convenient for you, such as the Desktop or a USB drive. This is especially handy if you plan to use RINPn on multiple computers.

We are now ready to launch and explore RINPn in the following chapters: Step-1 (GUI mode) and Step-2 (CUI mode)!


Step 1 - Using RINPn in GUI Mode

RINPn offers two modes of operation: GUI and CUI. The GUI mode provides a simple calculator interface that is user-friendly and suited for general use. Let's start by exploring the GUI mode!

Launching RINPn

The method to launch RINPn depends on your operating system.

For Microsoft® Windows®

To launch RINPn, double-click the batch file "RINPn_?.?.?.bat" (where ?.?.? represents the version numbers). Alternatively, if you have added the "cmd" folder of RINPn to your system's "Path" environment variable, you can start it by entering the "rinpn" command without arguments in the command-line terminal. (» More details)

The first time you launch RINPn, it may perform some initial setup and configuration steps. Please follow the on-screen instructions.

For Other Operating Systems (Linux®, etc.)

Launch RINPn from the command-line terminal as follows:

cd (directory where RINPn is located)
java -jar RINPn.jar

Similarly, if you've registered the "cmd" folder of RINPn in the "PATH" environment variable, you can start it by typing "rinpn" without arguments. (» More details)

If you receive an error message stating that the "java" command is not found, you will need to install the Java® Runtime Environment (JRE).

A common solution across many operating systems is to install OpenJDK, which includes the Java runtime environment. For installation instructions, search online using keywords such as "OpenJDK install (your OS name)." OpenJDK is also beneficial if you plan to design new functions in Java to be called from RINPn, as it allows you to compile Java code.

On some Linux distributions, you may be able to install only the JRE using the "apt" command. For more details, search "JRE install (your OS name)." Note that JRE packages installable via the "apt" command might include versions ending in "-headless," which are not compatible with RINPn.

Calculator Window

Upon successfully launching RINPn, the calculator window below will appear:

You can retract the key panel by clicking "▲KEY-PANEL" switch, and expand by clicking it again. The window color, opacity, font sizes, and so on are customizable by modifying values in "Settings.txt". Simply open the file in a text editor, modify the contents, and save your changes.

How to Calculate

To perform calculations, enter the expression into the "INPUT" text-field and press the Enter key on your keyboard or click the "=" button on the window. The result will then be displayed in the "OUTPUT" text-field. For example:

INPUT:
( 1 + 2 ) / 3 - 4 + 5

OUTPUT:
2

As shown, the calculator correctly handles parentheses "( )" and the order of operations, with multiplication and division taking precedence over addition and subtraction.

* To clear the input field, press the "Esc" key on your keyboard or click the "C" button on the window.

You can also use functions and variables as follows:

INPUT:
sqrt ( sin( PI / 2 ) + 1 )

OUTPUT:
1.414213562

Default available functions and variables are listed in the section: Appendix - List of Built-in Functions/Variables. Additionally, you can create and use new functions and variables as described in Step-4 and Step-5.

- About Precision and Rounding -

In internal processing, RINPn handles numerical values as double-precision (64-bit) binary floating-point numbers. As a result, some numerical errors may be present in the tail digits of calculation results. Therefore, RINPn rounds the results to 10 digits by default (this setting can be customized in "Settings.txt"). When using RINPn, please be aware of these aspects, as the calculator may not be suitable for purposes requiring absolute precision.


Step 2 - Using RINPn in CUI Mode (Command-Line Terminal)

In this section, we will explore how to use RINPn in CUI mode. In CUI mode, calculations are performed directly in the command-line terminal, without launching the calculator window.

How to Calculate in CUI Mode Without Any Settings

To use CUI mode without additional settings, execute "RINPn.jar" by passing an expression as a command-line argument as follows:

cd (The folder of the RINPn)

java -jar RINPn.jar   "(1 + 2 ) / 3 - 4 + 5"
(Result) 2

java -jar RINPn.jar   "sqrt ( sin( PI / 2 ) + 1 )"
(Result) 1.414213562

As shown, you can perform the same calculations as in GUI mode directly from the command-line.

How to Calculate in CUI Mode With Path Settings

Entering the full command-line and setting the current directory to the RINPn folder each time can be cumbersome. To simplify this process, it is useful to add the "cmd" folder of RINPn to your OS's "PATH" (or "Path") environment variable. Once done, you can perform calculations more simply using the "rinpn" command, regardless of the current directory:

rinpn "(1 + 2 ) / 3 - 4 + 5"
(Result) 2

rinpn "sqrt ( sin( PI / 2 ) + 1 )"
(Result) 1.414213562

Modifying the PATH environment variable depends on your operating system. For detailed instructions, search online with keywords like "how to set path (+ your OS name)." Be cautious when modifying the PATH as incorrect changes can cause serious problems on your PC. If you are unfamiliar with these settings and can seek assistance, it is advisable to do so.

Additionally, on Linux and similar systems, you might encounter a permission error the first time you use the "rinpn" command. If this happens, you can grant the necessary permissions as follows:

cd (directory of RINPn)/cmd
chmod +x rinpn      # or, if necessary: sudo chmod +x rinpn

Step 3 - How to Execute Scripts

RINPn can execute scripts written in "Vnano" to perform procedural, algorithmic, or other complex calculations.

What is Vnano?

Vnano is a compact scripting engine and language designed for embedded use in applications. It features a simple C-like syntax. For more details on the syntax of Vnano, visit the "Features of the Vnano as a Language" page on the Vnano Official Website.

To create a Vnano script, you don't need any development environments such as compilers. Simply create a text file with the ".vnano" extension and write your code within.

Example Script

An example script, "Example.vnano," is included in the RINPn folder. This script calculates the numerical integration of cos(x) from 0 to 1:

(The content of "Example.vnano")

// Integration parameters
double A = 0.0;
double B = 1.0;
int N = 100000;

// Integrant function
double f(double x) {
    return cos(x);
}

// Perform integration
double delta = (B - A) / N;
double value = 0.0;
for(int i=0; i<N; ++i) {
    double x = A + i * delta;
    value += ( f(x) + f(x+delta) + 4.0 * f(x+delta/2.0) ) * delta / 6.0;
}

output(value);

For a detailed explanation of the code above, visit: https://www.vcssl.org/en-us/code/archive/0001/7800-vnano-integral-output/.

How to Execute a Script in GUI mode

To execute a script in GUI mode, there are two methods:

Choose the method that you prefer.

For example, to execute the "Example.vnano" script mentioned earlier:

INPUT:
Example.vnano

OUTPUT:
0.8414709848

As shown above, the output value from the script will be displayed in the "OUTPUT" text field. The output "0.8414709848" closely matches the theoretical value of sin(1), which is the integration result of cos(x) from 0 to 1, confirming that the script has executed correctly.

Additionally, if you are using Microsoft Windows, you can hold down the Shift key and right-click the script file to copy its path from the context menu. This is especially handy when you need to enter the path of the script file into the INPUT text field of RINPn.

How to Execute a Script in CUI mode

Similar to GUI mode, you can execute a script in CUI mode by entering the name or the path of the script file.

Assuming the "cmd" folder of RINPn is added to your PC's "PATH" environment variable (» More details), and the "rinpn" command is available, here's how to execute a script file in the current directory:

For executing a script file in the current directory, pass only name of the script file to the "rinpn" command:

cd (the directory where the script file is located)

rinpn Example.vnano
(Result) 0.8414709848

If the script file is in a different directory than the current one, you can specify the relative file path instead of just the file name:

rinpn ../Example.vnano     # Execute a script in the parent directory
rinpn ./example/Example.vnano     # Execute a script in the "example" directory

Additionally, if necessary, you can specify the absolute file path as follows:

rinpn "C:\...\Example.vnano"     # For Microsoft Windows
rinpn "/home/.../Example.vnano"     # For Linux, etc.

About Optimization Levels

When processing a script is particularly demanding, you might find it beneficial to increase the optimization level specified in "Settings.txt" under "acceleratorOptimizationLevel" to enhance processing speed.

While the processing speed at an optimization level of 0 is generally sufficient for standard calculator software use, and hence the default level is set to 0, you might need a higher setting if you frequently execute complex numerical calculations on RINPn.

Get New Scripts from the Code Archive

While you can create scripts from scratch, the code archive on the official VCSSL/Vnano website can also be a valuable resource:

Code Archive » Vnano
https://www.vcssl.org/en-us/code/#vnano

This archive offers a variety of useful scripts, complete with commentary articles that explain the algorithms, background knowledge, and more.

- Examples of Scripts Available in the Code Archive -
Solve The Lorenz Equations Numerically

This script solves the Lorenz equations and outputs data to plot the solution curve, famously known as the "Lorenz Attractor," on a 3D graph.
Output Data of Numerical Integration For Plotting Graph

An example script that computes integrated values numerically and outputs data for graph plotting.
Compute Integral Value Numerically

This script calculates integral values using the rectangular method, trapezoidal method, and Simpson's rule, suitable for numerical integration.

Step 4 - How to Add Functions/Variables by Scripts (Library Scripts)

You can define variables and functions in script files within the "lib" folder and use them in expressions from Step-1 and Step-2, as well as in scripts from Step-3. These scripts are referred to as "library scripts" in both RINPn and Vnano.

How to Use Library Scripts

An example library script, "ExampleLibrary.vnano," is located in the "lib" folder and is set to be loaded by default. Here is the content of this script:

(Content of "ExampleLibrary.vnano" in the "lib" folder)

float libvar = 2.0;

float libfun(float x) {
    float result = libvar * x + 1;
    return result;
}
Important Note: In Vnano, the precision of the "float" type is 64-bit, the same as "double."

In the expressions or scripts entered into RINPn (as outlined in Step-1, 2, and 3), you can use the variables and functions defined in "ExampleLibrary.vnano" as shown below:

INPUT:
1 + libvar

OUTPUT:
3

INPUT:
libfun(1.23)

OUTPUT:
3.46

How to Add New Library Scripts

If desired, you can create additional library script files and define new functions and variables within them.

When you create or add new library script files, include their file paths in "VnanoLibraryList.txt" within the "lib" folder to ensure they are loaded.


Step 5 - Implement Functions/Variables in Java™ (Plug-in Development)

You can implement new built-in variables and functions using the Java® programming language. Within RINPn and Vnano, we refer to Java® programs that provide built-in functions or variables as "plugins."

Utilizing Java offers advanced functionality compared to defining variables/functions in script code (as in step-4).

However, implementing code in Java requires the Java Development Kit (JDK) to compile the code. We assume that JDK is installed on your PC and that the "javac" command is available. For installation details, you can search online with keywords like "OpenJDK install (your OS name)".

How to Use Plugins

To use plugins with RINPn, place them in the "plugin" folder of RINPn. A simple example of a plugin, "ExamplePlugin.java," is located in this folder:

(Content of "ExamplePlugin.java" in the "plugin" folder)

public class ExamplePlugin {

    public double pivar = 1.0;

    public double pifun(double arg) {
        return arg * 2.0;
    }
}

This plugin is compiled by default and set to be loaded (details on setting this up will be explained later).

The variable "pivar" and the method "pifun(arg)" can be used as built-in variables/functions in the calculator (see Step-1 and 2) and in script code (see Steps-3 and 4).

For example:

INPUT:
1 + pivar

OUTPUT:
2

INPUT:
pifun(2)

OUTPUT:
4

How to Compile Plugins

When you modify a plugin's code, it needs to be recompiled as follows:

cd (directory of RINPn)
javac ExamplePlugin.vnano

Some compiled class files of special plugin interfaces (XFCI1, XNCI1, etc.) supported by the Vnano Engine are included in the "plugin/org/vcssl/connect" folder. You can import these interfaces in your plugin (see "Plugin Development" in the Vnano documentation) and compile them similarly.

How to Add New Plugins

To add a new plugin, place it in the "plugin" folder and compile it. Then, add the path of the compiled class file to the "VnanoPluginList.txt" file within the "plugin" folder. All plugins listed in "VnanoPluginList.txt" will be loaded by RINPn.

Vnano Standard Plugins

In the "plugin/org/vcssl/nano/plugin" folder, "Vnano Standard Plugins," which provide basic features like math and utility functions, are bundled and loaded by default (as specified in "VnanoPluginList.txt"). You can use their functions and variables by default.

For a comprehensive list and detailed specifications of Vnano Standard Plugins, visit the "Vnano Standard Plugins" page on the official Vnano website.

Additionally, the RINPn frequently uses functions/variables, and simplified explanations of these are listed in the section: Appendix - List of Built-in Functions/Variables..


Step 6 - How to Embed into Other Software

You can integrate the scripting and calculation engine used in RINPn, known as the "Vnano Engine," into your own Java™ applications. Let's get started!

Example Code

Here is an example code that calculates the value of the expression "1.2 + 3.4" using settings similar to those in RINPn:

import org.vcssl.nano.VnanoEngine;
import org.vcssl.nano.VnanoException;
import org.vcssl.nano.interconnect.ScriptLoader;
import org.vcssl.nano.interconnect.PluginLoader;
import java.util.Map;
import java.util.HashMap;

public class EmbedUseExample {
    public static void main(String[] args) throws VnanoException {

        ////////// Preparation of Vnano Engine: Begin //////////

        // Initialize the Vnano Engine
        VnanoEngine engine = new VnanoEngine();

        // Configure engine options (for details, see Settings.txt)
        Map<String, Object> optionMap = new HashMap<String, Object>();
        optionMap.put("EVAL_INT_LITERAL_AS_FLOAT", true);
        optionMap.put("EVAL_ONLY_FLOAT", true);
        optionMap.put("EVAL_ONLY_EXPRESSION", true);
        optionMap.put("UI_MODE", "CUI");      // For CUI applications
        // optionMap.put("UI_MODE", "GUI"); // For GUI applications
        optionMap.put("ACCELERATOR_ENABLED", true);
        optionMap.put("ACCELERATOR_OPTIMIZATION_LEVEL", 0);
        engine.setOptionMap(optionMap);

        // Set permissions for plugins that support permission features
        Map<String, String> permissionMap = new HashMap<String, String>();
        permissionMap.put("DEFAULT", "ASK");   // For asking to users by default
        // permissionMap.put("DEFAULT", "DENY"); // For denying by default
        // (Here add permission items you want to allow, as follows)
        // permissionMap.put("FILE_READ", "ALLOW");
        engine.setPermissionMap(permissionMap);

        // Load plugins
        PluginLoader pluginLoader = new PluginLoader("UTF-8");
        pluginLoader.setPluginListPath("./plugin/VnanoPluginList.txt");
        pluginLoader.load();
        for (Object plugin: pluginLoader.getPluginInstances()) {
            engine.connectPlugin("___VNANO_AUTO_KEY", plugin);
        }

        // Load library scripts
        ScriptLoader scriptLoader = new ScriptLoader("UTF-8");
        scriptLoader.setLibraryScriptListPath("./lib/VnanoLibraryList.txt");
        scriptLoader.load();
        String[] libPaths = scriptLoader.getLibraryScriptPaths(true);
        String[] libScripts = scriptLoader.getLibraryScriptContents();
        int libCount = libScripts.length;
        for (int ilib=0; ilib<libCount; ilib++) {
            engine.registerLibraryScript(libPaths[ilib], libScripts[ilib]);
        }

        ////////// Preparation of Vnano Engine: End //////////

        // Calculate and output the result
        String input = "1.2 + 3.4";
        double x = (double) engine.executeScript(input + ";");
        System.out.println("Output of the Vnano Engine: " + x);

        // Unload resources
        engine.unregisterAllLibraryScripts();
        engine.disconnectAllPlugins();
    }
}

How to Compile and Execute

To compile the example code, add the Vnano Engine's JAR file, "Vnano.jar" (included in the RINPn package), to the classpath:

# For Microsoft Windows
javac -cp ".;Vnano.jar" -encoding UTF-8 EmbedUseExample.java

# For Linux and other systems
javac -cp ".:Vnano.jar" -encoding UTF-8 EmbedUseExample.java

Once compiled successfully, the "EmbedUseExample.class" file will be generated. Execute it with the following command:

# For Microsoft Windows
java -cp ".;Vnano.jar" EmbedUseExample    

# For Linux and other systems
java -cp ".:Vnano.jar" EmbedUseExample    

The result will display:

Output of the Vnano Engine: 4.6

This confirms the correct calculation of the expression "1.2 + 3.4", which results in "4.6". Within the expression, you can utilize functions from libraries or plugins. Additionally, instead of just an expression, you can pass Vnano script content to the "eval(...)" method of the script engine.

License and Detailed Information about the Vnano Engine

The Vnano Engine is open source software released under the MIT License, allowing free use for both commercial and non-commercial purposes, similar to RINPn.

For more detailed information, including guides and specification documents, visit the official Vnano website:

Vnano Official Website
https://www.vcssl.org/en-us/vnano/

Appendix - List of Built-in Functions/Variables

RINPn comes equipped with a variety of built-in functions and variables. Below is a list of some of the most frequently used ones, provided primarily through Vnano Standard Plugins.

For a comprehensive list and detailed specifications, please refer to the specification documents of Vnano Standard Plugins.

Built-in Functions

rad( degree )

Converts degrees to radians.

Example: rad( 180.0 )

deg( radian )

Converts radians to degrees.

Example: deg( 2.0 * PI )

sin( x )

Calculates the sine of x, where x is in radians.

Example: sin( PI / 2.0 )

cos( x )

Calculates the cosine of x, where x is in radians.

Example: cos( 2.0 * PI )

tan( x )

Calculates the tangent of x, where x is in radians.

Example: tan( PI / 4.0 )

asin( x )

Returns the arc-sine of x in radians.

Example: asin( 1.0 )

acos( x )

Returns the arc-cosine of x in radians.

Example: acos( 1.0 )

atan( x )

Returns the arc-tangent of x in radians.

Example: atan( 1.0 )

sqrt( x )

Calculates the square root of x.

Example: sqrt( 4.0 )

ln( x )

Calculates the natural logarithm (base e) of x.

Example: ln( 10.0 )

log10( x )

Calculates the logarithm (base 10) of x.

Example: log10( 1000.0 )

pow( x, exponent )

Returns x raised to the power of "exponent".

Example: pow( 2.0, 3.0 )

exp( exponent )

Returns e raised to the power of "exponent". The function which returns the value of "e" (napier number) to "exponent"-power.

Example: exp( 1.2 )

abs( x )

Returns the absolute value of x.

Example: abs( -1.23 )

sum( ... )

Calculates the sum of all given arguments

Example: sum( 1.23 ,   4.56 ,   7.89 )

mean( ... )

Calculates the arithmetic mean of all given arguments.

Example: mean( 1.23 ,   4.56 ,   7.89 )

van( ... )

Calculates the variance (denominator n) of given arguments.

Example: van( 1.23 ,   4.56 ,   7.89 )

van1( ... )

Calculates the variance (denominator n-1) of given arguments.

Example: van1( 1.23 ,   4.56 ,   7.89 )

sdn( ... )

Calculates the standard deviation (denominator n) of given arguments.

Example: sdn( 1.23 ,   4.56 ,   7.89 )

sdn1( ... )

Calculates the standard deviation (denominator n-1) of given arguments.

Example: sdn1( 1.23 ,   4.56 ,   7.89 )

length( array, dim )

Returns the length of the specified ("dim"-th) dimension of an array.

Example: length( array, 0 )

output( value )

This function displays the calculated value from scripts. In GUI mode, the value is displayed in the "OUTPUT" text field and will be overwritten if the function is called multiple times. In CUI mode, the value is output to the standard output as a single line each time it is called.

Example: output( 1.23 )

print( value )

This function is designed to display long texts and multiple lines for general purposes. It can display content consisting of any number of values or arrays, separated by tab spaces. In GUI mode, the content is appended to a text area in an independent window without line breaks. In CUI mode, the content is output to the standard output without line breaks.

Example: print( 1.2 , 3.4 , 5.6 )

println( value )

Similar to print, but includes line feedings.

Example: println( 1.2 , 3.4 , 5.6 )

Built-in Variables

PI

Stores the value of π.

Value: 3.141592653589793


About Us

This software is developed by RINEARN, a software studio based in Japan specializing in data analysis, visualization, and computation. The author of this software is Fumihiro Matsui.

If you have any questions or feedback about this software, please do not hesitate to contact us.

RINEARN Official Website
https://www.rinearn.com/
Contact Us
https://www.rinearn.com/en-us/#contact

Trademarks/Credits


RINPn User Guide
Text & Illustration:  Fumihiro Matsui