Coder Social home page Coder Social logo

evaluatex's People

Contributors

arthanzel avatar whatl3y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

evaluatex's Issues

Lexer error: can't match any token

Whenever I evaluate anything with this library that has a -: in it, it breaks and gives me the error in the title, please help me. For example, if I try to evaluate 1(1)/(5)-:-1(1)/(3) it throws Lexer error: can't match any token.

Get equation's unknown variables

Given an equation string like "x^2 + y", I need to find out the list of its unknown variables such as ["x", "y"] in this example. I feel this is something already being done somewhere in evaluatex code, but I couldn't find a public function or the correspondent internal code. This function should work with any valid evaluatex expression. Is that something useful to add to the interface? If not, could you point me out the file where I can find this logic so I can abstract that in my codebase?

[Issue] LaTeX commands

First off,

This library seems great! ~80 commits, all by one person, and works really well! I don't know why this isn't getting more attention!

On a 'not quite there yet' note, despite the partial LaTeX support (the reason why I am here). There seem to be some issues with very basic functionality. See below.

>>> evaluatex('a \\times b', options={latex: true})
Thrown: Parsing error: Expected end of input, but got COMMAND undefined

I haven't done any sort of entensive testing yet, but I had hoped that I would be able to use this to make a VS Code extension that evaluates lines of math in LaTeX code.
I still hope I will, since this seems to have all the groundwork done, but would be all the better for an extra few steps ๐Ÿ˜

Latex \pi

How can I make \pi a constant in evaluatex? I get a weird error:

evaluatex("\\pi", { "\\pi": 3.14 }, {latex: true});

Uncaught TypeError: this.value.apply is not a function

Error when running build NPM script

The following error occurs when running the build script. I've tried Node 14.5.0 and 12.x and same error occurs. It looks like index.js falls back to src/evaluatex so it might still work fine, but figured we should get this build script working if it needs to remain.

evaluatex$ npm run build

> [email protected] build /Users/lancewhatley/nodejs/evaluatex
> babel -d dist src && webpack dist/minifier.js -o dist/evaluatex.min.js

src/Node.js -> dist/Node.js
src/Token.js -> dist/Token.js
src/evaluatex.js -> dist/evaluatex.js
src/lexer.js -> dist/lexer.js
src/minifier.js -> dist/minifier.js
src/parser.js -> dist/parser.js
src/util/arities.js -> dist/util/arities.js
src/util/isNumber.js -> dist/util/isNumber.js
src/util/localFunctions.js -> dist/util/localFunctions.js
src/util/replaceToken.js -> dist/util/replaceToken.js
/Users/lancewhatley/nodejs/evaluatex/node_modules/webpack-cli/bin/config-yargs.js:89
				describe: optionsSchema.definitions.output.properties.path.description,
				                                           ^

TypeError: Cannot read property 'properties' of undefined
    at module.exports (/Users/lancewhatley/nodejs/evaluatex/node_modules/webpack-cli/bin/config-yargs.js:89:48)
    at /Users/lancewhatley/nodejs/evaluatex/node_modules/webpack-cli/bin/webpack.js:60:27
    at Object.<anonymous> (/Users/lancewhatley/nodejs/evaluatex/node_modules/webpack-cli/bin/webpack.js:515:3)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `babel -d dist src && webpack dist/minifier.js -o dist/evaluatex.min.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/lancewhatley/.npm/_logs/2020-07-12Txxxxxxxxx-debug.log

arctan from asciimath does not map to atan in Math

hey,

First off, was overjoyed to find this lib.

(2*arctan((36/(2*85))))*(180/PI) = Error!

(2*atan((36/(2*85))))*(180/pi) = Error!

(2*atan((36/(2*85))))*(180/PI) = 23.913

ideally:

(2*arctan((36/(2*85))))*(180/pi) = 23.913

Using the http://asciimath.org/ reference, arctan would ideally be mapped to the correct function, along with all of the others: sin, cos, tan, sec, csc, cot, arcsin, arccos, arctan, sinh, cosh, tanh, sech, csch, coth, exp, log, ln, det, dim, mod, gcd, lcm, lub, glb, min, max, f, g.

Thanks!

Nth Square root

\sqrt[n]{expression}
creates the nth root syntax but the program is producing a wrong output for the nth root

Support all LaTeX (equation) typesetting

I have been using evaluatex for evaluating expressions written in LaTeX through MathQuill. I have noticed some generated expressions such as ones involving the \times and \cdot operators like "2\\times3" or "4\\cdotx" are not supported (attempting to compile them will throw a Parsing error), while "\\frac{1}{x}" works fine. Is it the goal of the project to eventually support all valid LaTeX constructs? If so, what would be the process of adding more of them?

How use string values instead of numbers

Tried this

var evaluatex = require("evaluatex")
exp_function = evaluatex("a*(x+b)")
exp_function({a:10,x:"x",b:"10"})

and got

/home/simha/maths_testing/node_modules/evaluatex/dist/Node.js:90
                    throw new Error("Symbol " + this.value + " is undefined or not a number");
                    ^

Error: Symbol x is undefined or not a number
    at Node.evaluate (/home/simha/maths_testing/node_modules/evaluatex/dist/Node.js:90:27)
    at /home/simha/maths_testing/node_modules/evaluatex/dist/Node.js:83:44
    at Array.reduce (<anonymous>)
    at Node.evaluate (/home/simha/maths_testing/node_modules/evaluatex/dist/Node.js:82:44)
    at /home/simha/maths_testing/node_modules/evaluatex/dist/Node.js:78:48
    at Array.reduce (<anonymous>)
    at Node.evaluate (/home/simha/maths_testing/node_modules/evaluatex/dist/Node.js:77:44)
    at fn (/home/simha/maths_testing/node_modules/evaluatex/dist/evaluatex.js:33:20)
    at evalmachine.<anonymous>:1:1
    at Script.runInThisContext (vm.js:124:20)

I am creating various expressions with some variables. to show for students.

eg:

10*x + 100

How can i do this

Also Sometime i only want to substitute

i.e

10*(x + 10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.