joelahoover / mathjs-simple-integral Goto Github PK
View Code? Open in Web Editor NEWExtends Math.js to be able to compute simple integrals.
License: Apache License 2.0
Extends Math.js to be able to compute simple integrals.
License: Apache License 2.0
I tried:
Code:
var math = require('mathjs')
var math2 = math.create(math.all)
math2.import(require('mathjs-simple-integral'));
But this returned:
Error: Cannot import "factory": already exists
What can i do?
How do you import mathjs-simple-integral into a React Native project? I already imported mathjs into my React Native project and it works beautifully, and now I would like to import the mathjs-simple-integral extension too.
The way I imported mathjs is
import { derivative, evaluate, parse, format, unit, simplify, math, max, min, complex, add, multiply, equal, sort, sqrt, exp, log, sin, cos, tan, sec, csc, cot, asin, acos, atan, acot, sinh, cosh, tanh, coth, asinh, acosh, atanh, acoth } from 'mathjs';
and this works. This is how I usually import things into React Native.
I tried to import mathjs-simple-integral similarly by inserting,
import { integral } from 'mathjs-simple-integral';
or just
import integral from 'mathjs-simple-integral';
which by itself did not return any error, but when I tried to compute
const a = integral('x^2', 'x')
I get an error
(0,_mathjsSimpleIntegral.integral) is not a function. (In ‘(0,_mathjsSimpleIntegral.integral)(‘x^2’, ‘x’)’, ‘(0,_mathjsSimpleIntegral.integral)’ is undefined)
However, computing
const a = derivative(‘x^2', 'x')
works well (because derivative comes with mathjs, which I managed to import well).
I also tried inserting
math.import(require('mathjs-simple-integral'));
and
require('mathjs-simple-integral')
into my React Native project but that did not help either. The former gives me an error undefined is not an object (evaluating '_mathjs.math.import')
and the latter gives me the error Can't find variable: integral
Because this is an extension to mathjs, all this makes me think that mathjs-simple-integral probably needs to be imported differently than usual libraries. Any help would be greatly appreciated!
Why not make this extension a part of mathjs(since integrals are really important/used nowadays)?
Hello!
I'm very new to mathjs, but this looks like an amazing library
I need to compute and use an integral for one of my projects, but it looks to me like there is a small bug with this lib:
Doing this:
math.integral('x^2', 'x').compile();
raises a arg._compile is not a function
exception
But this:
math.parse(math.format(math.integral('x^2', 'x'))).compile();
works fine
I've tried tracking the problem down, and by comparing the json
representations of these two:
math.integral('x^2', 'x')
math.parse(math.format(math.integral('x^2', 'x')))
I can only find one difference:
// math.integral output
{"name":"x"}
// serialized then parsed output
{"mathjs":"SymbolNode","name":"x"}
I hope that was clear, and that I'm not missing something obvious (as I said, this is the first time I use both your lib and mathjs)
Cheers!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.