Questions tagged [mathjs]

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

Math JS Site

An extensive math library for JavaScript and Node.js

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices. Powerful and easy to use.

Features

-Supports numbers, big numbers, complex numbers, units, strings, arrays, and matrices.

-Is compatible with JavaScript’s built-in Math library.

-Contains a flexible expression parser.

-Supports chained operations.

-Comes with a large set of built-in functions and constants.

-Has no dependencies. Runs on any JavaScript engine.

-Is easily extensible

98 questions
10
votes
1 answer

Import dependencies in ember-cli (e.g., import math.js)

I am puzzled about importing dependencies in ember-cli, especially about the standard AMD case, as mentioned in the official Ember Cli document. The document doesn't provide much of examples, and seems to me it assumes the readers have good…
JBT
  • 8,498
  • 18
  • 65
  • 104
5
votes
1 answer

Getting the touched position in local coordinates of a transformed element

I have an element which has been transformed with a matrix3d to give it perspective. It represents the screen of a handheld device. There's a background image showing the handheld device itself, and this is not transformed. The element which holds…
tremby
  • 9,541
  • 4
  • 55
  • 74
4
votes
1 answer

Defining Infix Operators in Mathjs

I want to be able to write a J-like language using the mathjs math.parser() function result. Let's say I want to define an operator # that returns the length of an array. Ideally it would work like this: a = [1, 2, 3] #a // yields…
Conor O'Brien
  • 987
  • 2
  • 16
  • 40
3
votes
0 answers

mathjs number-only with typescript?

I'm trying to use mathjs in a typescript project. I'd like to use the "number-only" part (avoiding BigNumbers and Fractions). I've done yarn add mathjs and yarn add @types/mathjs. In my code, I tried to import it like this: import * as math from…
GaryO
  • 5,873
  • 1
  • 36
  • 61
3
votes
2 answers

Update math equation using MathLive and Vue

I have been struggling to use Vue and MathLive to handle typesetting randomly generated numbers and their squares. The function of the program is to generate a random integer from 1 to 35, calculate the square, and typeset it with MathLive. There…
1028
  • 129
  • 7
3
votes
2 answers

How to inject mathjs into Angular.js?

How can I inject mathjs into Angular.js? I can't get it to work - I used bower install mathjs --save to install it. Update: The JS min file is properly injected into index.html Do I need to inject it into the main module or into the controller? I…
Stephan Kristyn
  • 15,015
  • 14
  • 88
  • 147
2
votes
1 answer

How do you initiate mathjs library on your code

I want to find the inverse of a matrix with javascript; how can i do that?? I already tried downloading the mathjs library but i dont know how to initiate it
Zee_Corp
  • 21
  • 1
2
votes
1 answer

Getting TypeError: undefined is not an object (evaluating '_mathjs.default.fraction'), React-Native

I get this error whenever I use 'mathjs' TypeError: undefined is not an object (evaluating '_mathjs.default.fraction') Basically my code is this import React from 'react'; import {View, Button} from 'react-native'; import mathjs from 'mathjs'; const…
Some Dev
  • 185
  • 1
  • 9
2
votes
0 answers

mathjs parser.evaluate doesn't work on react js

I'm using mathjs for my project on React , my goal is to create string math function 'f(X)' and each time I give a number of X and received the result of the function but It doesn't work, this is the code import "./styles.css"; import maths from…
Amenangelo
  • 39
  • 5
2
votes
3 answers

Get element from math.matrix in Javascript

I'm using the matrix element from the math.js library. I create a matrix: let eye = math.matrix([ [1, 0, 0], [0, 1, 0], [0, 0, 1] ]); But when I try to access an element of the matrix, it is always undefined. console.log(eye[0][0])…
blackbrandt
  • 2,010
  • 1
  • 15
  • 32
2
votes
1 answer

Process/Calculate two objects values and generate output from them

I have two objects - one containing formulas and other array object contains values. I want to club and do calculate output shown below. Object-1 { SI : (PxTxR)/100, ratio: P1/P2 } Object-2 [ { P1:34053, P2:45506 }, …
Gunjan Anshul
  • 103
  • 1
  • 7
2
votes
2 answers

making React work together with math.js library

for some reason my React component seems not to be working with the math.js library. Whenever I try to get the output of the following code on the console (without resetting the state it seems to be working fine and correct value gets outputted in…
Konstantink1
  • 575
  • 1
  • 8
  • 26
2
votes
0 answers

Convert LaTeX to String that can be evaluated (by MathJS)

Say I have the following LaTeX code \frac{5+5}{\left (3+2 \right )*1} is there a JS module that allows me to convert this code into a plain text string like ( 5+5 ) / ( (3+2) * 1 ) (this string can be evaluated by MathJS - which the LaTeX code…
Norfeldt
  • 8,272
  • 23
  • 96
  • 152
2
votes
3 answers

How to get value form Input as numbers to calculate gcd?

I use math.js to calculate gcd for a series of numbers wich are taken from input. Among the tested options I mention: parseInt() and parseFloat() IaNr=document.getElementById("nrs").value…
ChrisGP
  • 427
  • 1
  • 4
  • 11
1
vote
1 answer

I'm trying to write regex in javascript that validates if a user has input a valid BODMAS string before evaluating

I'm trying to render a react input element that can either take in a number or a string with BODMAS operations like (5*3)+8 and evaluate it. I would like to first valid the BODMAS string so I'm trying to come up with a regular expression that…
ayesigwar
  • 11
  • 2
1
2 3 4 5 6 7