BeakerX usage - axkr/symja_android_library GitHub Wiki

BeakerX kernel

A Symja MMA mode BeakerX kernel can be found in the Maven artifact:

Auto-complete of a function name is triggered in a SymjaMMA input cell, after the TAB key was pressed (i.e. type Int and get a list of suggestions to complete the function name).

The mode for the output cell format can be set with these "meta command" in a SymjaMMA input cell:

  • /tex - the default output method for results. Creates a cell with mimetype text/latex
  • /input
    • f[x, y] is printed as f[x, y]
    • floating point numbers like 0.75*10^-13 are printed as 7.50000*10^-14
  • /output
    • f[x, y] is printed as f(x, y)
    • floating point numbers like 0.75*10^-13 are printed as 7.500000000000001E-14
  • /traditional
    • f[x, y] is printed as f(x, y)
    • floating point numbers like 0.75*10^-13 are printed as 7.50000*10^-14
  • /java - generate source codes which can be used as input in the Java kernel
  • /timeouton - evaluations are timed out after 60 seconds
  • /timeoutoff - evaluations aren't timed out

The last answer can be reused in the next input cell with the global $ans variable

Installed kernel files:

Lib/site-packages/beakerx/kernel/symjamma/kernel.json 
Lib/site-packages/beakerx/kernel/symjamma/lib/antlr4-runtime-4.7.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/apfloat-1.8.3.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/commonmark-0.12.1.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/commons-csv-1.4.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/guava-27.0-android.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/hipparchus-core-1.4.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/hipparchus-fft-1.4.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/hipparchus-fitting-1.4.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/hipparchus-ode-1.4.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/hipparchus-optim-1.4.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/hipparchus-stat-1.4.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/jas-2.6.5961.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/jsr305.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/log4j-api-2.5.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/log4j-core-2.5.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/logicng-1.4.1.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/matheclipse-beakerx-1.0.0-SNAPSHOT.jar
Lib/site-packages/beakerx/kernel/symjamma/lib/matheclipse-core-1.0.0-SNAPSHOT.jar
Lib/site-packages/beakerx/kernel/symjamma/logo-32x32.png
Lib/site-packages/beakerx/kernel/symjamma/logo-64x64.png
Lib/site-packages/beakerx_magics/symjamma_magic.py
from IPython import get_ipython
from IPython.core.magic import (magics_class, cell_magic)
from .kernel_magic import KernelMagics
from ipykernel.zmqshell import ZMQInteractiveShell


@magics_class
class SymjaMMAMagics(KernelMagics):

    def __init__(self, shell):
        super(SymjaMMAMagics, self).__init__(shell)

    def start(self):
        super(SymjaMMAMagics, self).start('symjamma')

    @cell_magic
    def symjamma(self, line, cell):
        return self.run_cell(line, cell)


def load_ipython_extension(ipython):
    if isinstance(ipython, ZMQInteractiveShell):
        ipython.register_magics(SymjaMMAMagics)


if __name__ == '__main__':
    ip = get_ipython()
    ip.register_magics(SymjaMMAMagics)

Add line

from .symjamma_magic import *

to file Lib/site-packages/beakerx_magics/__init__.py

Lib/site-packages/beakerx_magics/symjamma_magic.py

Run beakerx install again, to get the kernel installed in the share folder:

[InstallKernelSpec] Installed kernelspec symjamma in C:\Users\dev\Anaconda3\share\jupyter\kernels\symjamma

Running BeakerX

Start it with

beakerx

and then use the “New” menu to create a notebook in the SymjaMMA language.