Comments (4)
With the work being done by @kevinbarabash on https://github.com/kevinbarabash/math-ast maybe we could model systems of equations with the "AND" logical operator at the top level? e.g.
y = 2x + 2 AND x = y = 5
We would then have tree-rewriting rules like for the rest which handle this type of structure.
I am unsure on how CAS systems do it these days, @tkosan might have insights on the topic!
from mathsteps.
This is the algorithm I prototyped in MathPiper for solving systems of equations:
equations := MapSingle("MathParse",
["x - 2y + 3z = 7",
"2x + y + z = 4",
"-3x + 2y - 2z = -10"]);
solutions := [];
While(equations !=? []) {
equation := Pop(equations, 1);
solution := Solve(equation, UnderscoreConstants(equation)[1]);
If(solution !=? []) {
variable := solution[1][1];
value := solution[1][2];
equations := Substitute(variable, value) equations;
solutions := Substitute(variable, value) solutions;
Append!(solutions, variable == value);
};
};
MapSingle("MetaToObject", solutions /:: [a_ == b_ <- a == Eval(b)]);
Result: [x == 2, y == (-1), z == 1]
Currently, the algorithm holds the equations in a list. However, flattening an expression with respect to a binary operator is straightforward, so modeling systems of equations with the "AND" logical operator should not cause problems:
In> Flatten(a &? b &? c, "&?")
Result: [a, b, c]
from mathsteps.
@hmaurer I added a List
node in math-ast with the intent of using it for system of equations or multiple solutions (in the case of quadratic formula). Unfortunately, it feels to general. What differentiates a List
of multiple solutions from a List
that's a system of equations?
I like that "AND" indicates that all equations need to hold and "OR" indicates that each of the multiple solutions is valid. I am worried though about overloading logical operators. Logic operators should be used in expression for logic proofs.
Maybe we can introduce any
and all
nodes or add a property to the List
node that indicates any
or all
. Another option is to have an explicit System
node that can contain multiple equations and inequalities. And use List
for multiple solutions.
from mathsteps.
I've added tentative support for system of equation and sequences to math-parser. Here are a couple of test cases:
semantic-math/math-ast#12 has some additional thoughts about converting things like a < x < b
to Bounds
nodes.
(edit: links fixed)
from mathsteps.
Related Issues (20)
- Can mathsteps handle derivative and integral? HOT 6
- x * (x - 1) = 1 ===>> throws 'Math error: No term with symbol: x , returning no steps' HOT 1
- How to run mathsteps on smartphone? HOT 1
- Severe security vulnerability HOT 5
- Missing parentheses when multiplying with a negative number HOT 5
- more things to add to linter
- Current Limitations HOT 1
- Mathsteps cannot handle quadratic equations HOT 4
- Development Status HOT 1
- handling latex input
- Script to browserify mathsteps
- compute a reverse expression HOT 1
- Fails when left node is only a parenthesis (eg "(x+1)=4", "((x)/(4))=4")
- Canceling out first variable throws error
- How to render these steps using Mathjax or something else? HOT 1
- Project Status and inactive email HOT 2
- bug : x-2/3=0
- Another bug : 2/x=3/4 HOT 2
- Adapting to iOS Swift
- Adapt README.md to link to the most active fork
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathsteps.