Interpreter with language syntax like MATLAB®/Octave
This is a scientific calculator based on MATLAB®/Octave syntax written in Javascript (Typescript). It uses the Jison parser generator to create an AST (Abstract Syntax Tree). It also uses the decimal.js API to do calculations with arbitrary precision and displays the computed math expressions in a user-friendly manner (MathML). To render MathML in browsers without support, it uses the MathJax polyfill.
The calculations can be made in a batch processing or in an interactive prompt.
The code in this repository is published in lindau-calculator.netlify.app using Netlify hosting service.
Get a minified version from a CDN. To embed in a webpage using jsDelivr CDN copy the following HTML code:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sergiolindau/calculator/calculator.min.css" type="text/css" media="screen" charset="utf-8">
<script src='https://cdn.jsdelivr.net/gh/sergiolindau/calculator/calculator.min.js'></script>
<div id="panel"></div><script>Shell.init("panel", evalPrompt, linesArray);</script>
This project is a free software under the terms of MIT License.
Some Math knowledge to code this project were noted in the math.html file.
Some links accessed to carry out this work:
- Octave website
- Octave scripts source
- GNU Octave at Wikipedia
- Octave Forge - Extra packages for GNU Octave
- GNU Octave at Free Software Foundation
- GNU Octave (version 6.4.0) Online Manual
- Octave lexer
- Octave parser
- MATLAB® parser by Tegala Sravani
- The Design and Implementation of a Parser and Scanner for the MATLAB® Language in the MATCH Compiler
- MATLAB® grammar from Grammar Zoo
- IBM - Write text parsers with yacc and lex
- University of Cambridge - Parsing arithmetic expressions - Bison and Flex
- Wikipedia - Comparison of parser generators
- A COMPACT GUIDE TO LEX & YACC by Tom Niemann
- YACC program to recognize string with grammar { a^nb^n | n≥0 }
- Bison and Flex Assignments - Matrix Dimension Checker
- stackoverflow - Matrix parser with Lex and Yacc
- stackoverflow - Where can I find a formal grammar for MATLAB?
- stackoverflow - YACC grammar for arithmetic expressions, with no surrounding parentheses
- Unofficial page of the course "Compiladores e Intérpretes" (Compilers & Interpreters Construction) UCSE (Argentina)
- Jison
- decimal.js
- MathJax
- Modernizr
- texinfo-js
- Marked
- CodeMirror
- archlinux user repository: texinfo-js
- itsravenous/gaussian-elimination
- At Wolfram Mathworld:
- Complex Number
- Imaginary Unit
- Complex Addition
- Complex Subtraction
- Complex Multiplication
- Complex Division
- Euler Formula
- Complex Modulus
- Complex Argument
- Complex Conjugate
- Complex Exponentiation
- Square Root
- de Moivre's Identity
- Absolute Square
- Indeterminate
- Complex Infinity
- Conjugate Matrix
- Conjugate Transpose
- At functions.wolfram.com
- math.stackexchange.com - Why does Wolfram Alpha say that n/0 is complex infinity?
- At Wikipedia:
- At developer.mozilla.org
- At Science Direct topics:
- At Wikipedia:
- At developer.mozilla.org
- DEVMEDIA: Apresentando a biblioteca JavaScript Modernizr
- Matrix Inverse with JavaScript
- Understanding Destructuring, Rest Parameters, and Spread Syntax in JavaScript
- The Complete Guide to Using Arrays in JavaScript
- LU decomposition at RosettaCode.org
- A Note on PA = LU in Javascript
- math.js
- mljs/matrix
- JaHIY/toArray.js
- themadcreator/luqr
- Learning JavaScript Design Patterns
- infusion/complex.js - C in JavaScript at GitHub
- infusion/complex.js - C in JavaScript at npm
- pilogb/jit - Complex.js
- patrickroberts/complex at GitHub
- patrickroberts/complex at at npm
- W3Schools - Artificial Intelligence
- W3Schools - JavaScript Tutorial
- Linear algebra libraries
- geeksforgeeks.org - Determinant of a Matrix
- rosettacode.org - Determinant and permanent
- JSMatrix project
- Compreendendo a diferença entre Object.create () e new SomeFunction ()
- Matrix Methods in JS
- System of Linear Equations and Inverse Matrix With JavaScript
- TensorFlow
- TensorFlow Playground
- TensorFlow - latest
- TensorFlow - Tensors and operations
- TensorFlow - Setup
- TensorFlow Blog - A Gentle Introduction to TensorFlow.js
- Visualizing training with tfjs-vis
- TensorFlow - latest - erf
- Tensorflow.js tf.erf() Function
- stackoverflow - tensorflow matrix multiplication
- Tensorflow.js tf.complex() Function
- Tensorflow.js tf.complex() Function
- stackoverflow - TensorFlow.js and complex datasets?
- TensorFlow Basics: Tensor, Shape, Type, Sessions & Operators
- Project References
- TypeScript for JavaScript Programmers
- DOM Manipulation
- More on Functions
- Introdução a Typescript: o que é e como começar?
- TypeScript static classes
- Importing untyped JS modules
- Complex TypeScript definitions made easy
- Advanced TypeScript 4.2 Concepts: Classes and Types
- Type Casting
- www.npmjs.com/package/tyson
- EcmaScript Modules: Módulos nativos no JavaScript http server
- tutorialspoint - MathML Tutorial
- W3C Recommendation 10 April 2014 - Mathematical Markup Language (MathML) Version 3.0 2nd Edition
- W3C Math Home
- MDN Web Docs moz://a - Mathematical Markup Language (MathML)
- GeeksforGeeks - HTML5 | MathML Introduction
MIT License
Copyright © 2016-2022 Sergio Lindau
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.