Math. Js: An Advanced Mathematics Library For JavaScript



Download 477,21 Kb.
Pdf ko'rish
bet2/7
Sana11.08.2022
Hajmi477,21 Kb.
#846896
1   2   3   4   5   6   7
Bog'liq
MCSE.2018.011111122

Jos de Jong
Teqplay 
Eric Mansfield 
Sustainable Energy Solutions 
20
Computing in Science & Engineering
Copublished by the IEEE CS and the AIP
1521-9615/18/$33 ©2018 IEEE
January/February 2018


COMPUTING IN SCIENCE & ENGINEERING 
JavaScript’s excellent package manager, and has resulted in a very dynamic ecosystem contain-
ing many high-quality software packages. 
ADVANCED MATH IN JAVASCRIPT 
Although JavaScript’s popularity is increasing, it is typically not a programmer’s first choice for 
doing advanced mathematics. Its performance has improved drastically in recent years, but still, 
it is easily outpaced by languages such as C and FORTRAN, especially for performing intensive 
numerical calculations. However, if the programmer’s aim is to reach the largest possible num-
ber of users, he or she must turn to mobile and web apps. The web is powered by JavaScript, so 
writing math-related applications for the web requires an advanced JavaScript math library. 
Math.js aims to make advanced mathematics available for the JavaScript community. Most pro-
gramming languages support only basic mathematics out-of-the-box. For mathematicians, how-
ever, this is not sufficient, as evidenced by the need for powerful tools such as Matlab, 
Mathematica, Maple, and R. Some programming languages, such as Python, do have excellent 
support for mathematics thanks to the numpy and scipy libraries.
7
Until recently, the options for 
advanced mathematics in JavaScript were limited. 
Math.js was not the first—nor is it intended to be the last—JavaScript library for advanced math-
ematics. A number of other great math libraries for JavaScript are worth mentioning.
For vector and matrix calculations, the best-known libraries are ndarray
8
and Sylvester.
9
Calcula-
tions with complex numbers can be done with, for example, Complex.js.
10
Some numerically 
oriented libraries are Numbers.js
11
and Numeric.js,
12
both of which support matrices and com-
plex numbers. Numeric.js especially excels in its support for advanced linear algebra. For com-
puter algebra, there are libraries like Algebrite,
13
which supports symbolic differentials, integrals, 
simplification, and units. There is also algebra.js,
14
which can solve algebraic equations. Expres-
sion parsing can be done with libraries such as expr-eval
15
and jsep.
16
Options for plotting graphs 
are plentiful in the web-application world, from plug-and-play solu-
tions like Chart.js
17
to low-level solutions like d3.js.
18
The JavaScript ecosystem has access to a wide arsenal of high-quality 
math libraries. This is even more impressive considering that most of 
these projects are open source. Two important remarks should be 
made though. First, most of the mentioned libraries are single-purpose 
and can’t work together. They form a set of scattered, uncoordinated 
libraries. Second, most of the libraries are spare-time projects driven 
by a single highly skilled and passionate author. That introduces risk 
to the library’s continuation: if the author can no longer spend time on 
the library or simply loses interest, development and maintenance of 
the library stalls. This reveals a serious challenge that not only the Ja-
vaScript community but also the general open source community must 
tackle: how to ensure the continuation of open source projects that so 
many depend on but so few develop? 
HISTORY OF MATH.JS 
Long before the first public release of math.js, one of the authors cre-
ated a small calculator application named SpeQ Mathematics.
19
This 
project started in 2003 and was written in a Basic language. The aim 
of the project was to create an application to fill the gap between the 
simple calculators included with many OSs, and the heavyweight mathematics applications like 
Since its open 
source start in 
2013, math.js has 
steadily grown into 
one of the most 
popular math 
libraries for 
JavaScript and 
node.js. 
21
January/February 2018
www.computer.org/cise


THE RISE OF JAVASCRIPT 
Matlab and Mathematica. The application featured basic arithmetic, complex numbers, units, 
graphical plotting, numerical integration and differentiation, and more. 
Over time, the application had been rewritten in C++ and Java, and eventually was released as a 
JavaScript web app called Math Notepad.
20
Math Notepad turned out to be much easier and 
faster and more fun to develop than earlier iterations of the application. In 2012, it was realized 
that the math engine inside Math Notepad was very valuable on its own. The math engine was 
separated from the user interface and launched in 2013 as the open source library math.js (see 
Figure 1). 
Figure 1. The math engine powering Math Notepad was released in 2013 as the open source 
library math.js. 
Since its open source start in 2013, math.js has steadily grown into one of the most popular math 
libraries for JavaScript and node.js. It has more than 50 contributors, several of whom have done 
a great deal of work to improve and extend the library. At the time of writing, the library had 
been starred by more than 4,000 GitHub users,
21
and was being downloaded more than 300,000 
times a month via npm.
22
More than 200 other open source libraries use math.js.
23
Math.js is 
used in applications such as numerics.info
24
— the most popular calculator app in Google 
Chrome with almost half a million users
25
—and in the built-in calculator of the search engine 
DuckDuckGo.
26
FEATURES 
The unique value of math.js lies in offering an integrated solution to work with different types of 
data such as complex numbers and matrices, and offering a user-friendly syntax that allows ex-
pressing mathematics in a readable, intuitive way. It has a rich set of built-in functions and has 
support for both linear algebra and computer algebra. We mentioned many excellent JavaScript 
libraries for mathematics. But most of them specialize in one or a few areas and do not work well 
together. Math.js acts as a hub to bring the features of these libraries together using a single syn-
tax. By employing a mathematics-oriented syntax and feature set, it bridges the gap between 
mathematics and programming. 
22
January/February 2018
www.computer.org/cise


COMPUTING IN SCIENCE & ENGINEERING 
There are at least two things that set math.js apart from other libraries. First, it offers an inte-
grated environment where it’s possible to work with all kinds of data types. And second, it offers 
a math-friendly syntax for writing expressions. 
Integrated Environment for Mathematics 
The most important goal of math.js is to be a multi-purpose library offering an integrated envi-
ronment for JavaScript where it’s possible to work with numbers, matrices, complex numbers, 
units, and more. 
This goal has two sides: 

Math.js wants to support various data types. Math.js has had support for numbers, com-
plex numbers, units, and matrices from the beginning. Since that time many new types 
have been added: fractions, bignums, and sparse matrices. 

Math.js wants to be a “batteries included” library offering a broad set of built-in math 
functions, from basic arithmetic to advanced matrix operations out of the box. 
Math.js comes with a broad range of built-in functions and data types, and can easily be ex-
tended with new functions, units, and data types. 
Expressive Math Syntax 
Math.js uses a syntax that extends JavaScript’s mathematical operators to support custom types 
such as complex numbers and matrices. The syntax also includes additional operators that allow 
users to enter mathematics in a more natural way than is possible in JavaScript itself. The table 
below illustrates some of the Math.js operators, and the equivalent function calls using the 
Math.js native JavaScript API, as shown in Table 1. 
Table 1. The two syntaxes of math.js. 

Download 477,21 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish