mathigon / hilbert.js Goto Github PK
View Code? Open in Web Editor NEWJavaScript expression parsing, MathML rendering and CAS.
Home Page: https://mathigon.io/hilbert
License: MIT License
JavaScript expression parsing, MathML rendering and CAS.
Home Page: https://mathigon.io/hilbert
License: MIT License
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
, esbuild
, eslint
, eslint-plugin-import
).github/workflows/codeql.yml
actions/checkout v3
github/codeql-action v2
github/codeql-action v2
.github/workflows/test.yml
actions/checkout v3
actions/setup-node v3
bahmutov/npm-install v1
package.json
@mathigon/core 1.1.10
@mathigon/fermat 1.1.9
@types/tape 5.6.0
@typescript-eslint/eslint-plugin 6.2.1
@typescript-eslint/parser 6.2.1
esbuild 0.18.17
eslint 8.46.0
eslint-plugin-import 2.28.0
tape 5.6.6
ts-node 10.9.1
tslib 2.6.1
typescript 5.1.6
node >=14
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/workflows/codeql.yml
actions/checkout v4
github/codeql-action v3
github/codeql-action v3
.github/workflows/test.yml
actions/checkout v4
actions/setup-node v4
bahmutov/npm-install v1
package.json
@mathigon/core 1.1.19
@mathigon/fermat 1.1.20
@types/tape 5.6.4
@typescript-eslint/eslint-plugin 8.0.0
@typescript-eslint/parser 8.0.0
esbuild 0.23.0
eslint 8.57.0
eslint-plugin-import 2.29.1
tape 5.8.1
ts-node 10.9.2
tslib 2.6.3
typescript 5.5.4
node >=16
The unary minus operator can't be used after other operators!
Each of these examples throws a SyntaxError
during the call to collapse
:
Expression.parse("1 * -1").collapse(); // SyntaxError: This expression is invalid.
Expression.parse("1 + -1").collapse(); // SyntaxError: A “+” cannot be followed by a “−”.
Expression.parse("x = -1").collapse(); // SyntaxError: A “=” cannot be followed by a “−”.
The first example being different might be because of special behaviour for implicit multiplication?
Hi, I'm trying to chase down what I regard as a bug - please forgive me if this isn't the right repository.
On the Mathigon circles course, the surface area of a cylinder rejects the solution 2πr(r+h)
. hilbert.js interprets this as a function:
> hilbert.Expression.parse("2πr(r+h)")
ExprTerm {
items: [ ExprNumber { n: 2 }, ExprFunction { fn: 'πr', args: [Array] } ]
}
which I think is totally reasonable without any context. What I'd suggest is that once you are aware of the context, if fn
isn't a valid function, you fall back to trying to parse it as identifiers times the (
"function". I think the right place to do that is here
https://github.com/mathigon/boost.js/blob/aa980832146a48978f57e047258911a096122915/src/eval.ts#L438
but I'm not sure :)
Suggested failing test:
test.equal(compile('r(a)')({r: 2, a: 2}), 4); // Fails - returns undefined
One thing I haven't been able to track down so far is how 2rh
gets turned into 2*r*h
- compile
gives me
> compile('2rh')
/home/olie/projects/boost.js/src/eval.ts:72
throw new Error(`${message} at character ${index} of "${expr}"`);
^
Uncaught Error: Variable names cannot start with a number (2r) at character 1 of "2rh"
but this does currently work in Mathigon. Wherever that happens might be the place to handle function composition if you felt like a challenge (probably: check if whole word is a function, if not, from right to left, compose functions if each character is a function; if it isn't, switch to parsing as identifiers from then).
PS: Mathigon is very cool :)
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.