69 Commits

Author SHA1 Message Date
jos
17f07ec098 Fixed incompatibility with v4 (index.js file) 2018-06-13 14:02:50 +02:00
jos
b3b96749bf Refactored var into const/let, and removed a lot of semicolons 2018-06-13 12:21:14 +02:00
jos
024b2a9e26 Fix most lint errors using npx standard --fix 2018-06-10 20:28:27 +02:00
jos
635cd0b574 Revert using /lib/ in tests, use /src/ again. Fixed coverage testing. WIP 2018-06-06 22:11:52 +02:00
jos
79071b5e4f Fixed npm run test:browser not working (WIP) 2018-06-06 21:30:41 +02:00
jos
0c084b8e20 npm test working now 2018-06-06 15:36:36 +02:00
jos
7fefa33d84 Fixed #1077: Serialization/deserialization to JSON with reviver not being supported by nodes 2018-04-04 22:09:43 +02:00
jos
82b41e696a - Implemented OperatorNode.isUnary and OperatorNode.isBinary.
- Explicit checks for number of arguments everywhere working with `OperatorNode` and `FunctionNode`.
- Fixed #1014: derivative silently ignoring additional arguments.
2018-01-31 11:00:39 +01:00
jos
0b6c0c13f7 Merge branch 'v4' into v4_constant_node
# Conflicts:
#	HISTORY.md
2018-01-27 16:58:17 +01:00
Harry Sarson
332ecf3d5d
adds failing test when implicit product is mapped 2018-01-27 14:21:36 +00:00
jos
924299c42b Changed ConstantNode(valueStr, valueType) to ConstantNode(value) (breaking change) 2018-01-23 12:08:29 +01:00
Max Bruckner
b2857392bd OperatorNode: Fix implicit multiplication
Fixes implicit multiplication when parenthesis is 'auto' and operands
are ConstantNodes.

This is handled by detecting that case and printing parentheses for
ParenthesisNodes even though they normally wouldn't with parenthesis
set to 'auto'.
2017-08-13 20:57:41 +02:00
Max Bruckner
493bd7f6b0 OperatorNode: Support more than two operands in toTex/String
Only for multiplication and addition though.
2016-11-13 15:50:32 +07:00
Max Bruckner
ed86eedf32 test cloning of implicit multiplication 2016-11-11 13:20:57 +07:00
jos
4306200c4c Implemented method Node.equals(other) for all nodes of the expression parser 2016-11-05 16:27:23 +01:00
Max Bruckner
c72071dfb7 OperatorNode: toTex support for implicit multiplication
Use the option `implicit` with the value `hide` to not show the
multiplication sign for implicit multiplication. This is the default.
Use `show` otherwise.
2016-03-19 19:09:14 +01:00
Max Bruckner
65817dbf03 OperatorNode: toString support for implicit multiplication
Use the option `implicit` with the value `hide` to not show the
multiplication sign for implicit multiplication. This is the default.
Use `show` otherwise.
2016-03-19 18:48:54 +01:00
jos
f4b794100e Replaced tabs with spaces 2016-03-03 20:29:08 +01:00
Max Bruckner
49e3fb7fad ConditionalNode: simplify LaTeX by using the 'cases' environment 2016-01-05 10:53:11 +01:00
jos
a92b978036 Merged develop into v2 2015-06-07 15:57:41 +02:00
jos
c810981238 Method Node.compile() no longer needs math to be passed as argument. 2015-05-27 13:30:35 +02:00
Max Bruckner
3f217cefdd toTex: no global configuration. Only pass around one local object 2015-05-16 13:30:25 +02:00
Max Bruckner
c0e1b2d268 toString: no global configuration. Only pass around one local object 2015-05-16 13:29:55 +02:00
Max Bruckner
8d3b3bbe35 Tests for custom toString 2015-05-16 13:29:20 +02:00
Max Bruckner
291d620972 Pass local configuration to toTex functions 2015-05-16 13:27:48 +02:00
Max Bruckner
aa7ca9178f Implement 'all' parenthesis option 2015-05-08 09:07:15 +02:00
Max Bruckner
c6f22e3663 unskip tests that were broken by parsing parenthesis nodes 2015-05-07 12:06:37 +02:00
Max Bruckner
5767f1f912 OperatorNode: Fix bug from wrong use of getIdentifier
1+(1+1) with parenthesis set to 'auto' triggered a bug because
getPrecedence gets the precedence of the content of a node, but
getIdentifier still returns the 'ParenthesisNode' identifier in case of
a ParenthesisNode.
2015-05-07 12:04:53 +02:00
Max Bruckner
dd0a5e3a68 Parse parentheses into ParenthesisNodes 2015-05-07 10:12:41 +02:00
jos
f7c5381a13 Fixed Node.transform not recursing over replaced parts of the node tree (see #349). 2015-05-02 17:27:14 +02:00
Max Bruckner
390a0060b4 Add is<NameOfNode> property to enable type checking across constructors 2015-04-28 09:14:53 +02:00
jos
d3d3212633 Refactored all nodes into factory functions (see #342) 2015-04-26 21:25:31 +02:00
Max Bruckner
55a66aeaaf OperatorNode.toTex: get rid of unnecessary curly braces 2015-04-19 09:49:09 +02:00
Max Bruckner
8db07e23ad OperatorNode.toTex: BUGFIX: make clear where the exponent belongs to
Without proper parentheses it's impossible to decide whether an exponent
belongs to the numerator of a fraction or to the entire fraction.

For ConditionalNode, the exponent is hard to see without parentheses.
2015-04-19 02:11:20 +02:00
Max Bruckner
f2bcfed89f LaTeX: no spaces between operands and operators 2015-04-17 14:18:24 +02:00
Max Bruckner
7c1c9c0cef Show less unnecessary parentheses in LaTeX output
OperatorNodes with exponentiation, fractions and conditions use less
parentheses.
2015-04-16 22:31:02 +02:00
Max Bruckner
dacf9fba46 OperatorNode: bugfix: toTex creates invalid LaTeX
toTex has been creating invalid LaTeX for fractions where the operands
are in parenthesis, see '(1+1)/2' for example
2015-04-05 14:29:15 +02:00
Max Bruckner
5dcb87aeaa util/latex: Remove unused functions
* toArgs
* addBraces
* dots and curly functions

util/latex.js: Remove Function addBraces

util/latex.js remove dots and curly functions
2015-04-05 14:29:09 +02:00
Max Bruckner
13e35217b7 Latex restructure 2015-04-05 14:25:54 +02:00
Max Bruckner
47f76f35ac Limit custom toTex with multiple callbacks to FunctionNodes
Now only FunctionNode's toTex can be overwritten mit a map of callbacks
2015-03-17 18:14:14 +01:00
Max Bruckner
0fee9173c8 Enable custom toTex functions 2015-03-13 21:23:14 +01:00
Max Bruckner
b2d868c2ed Update OperatorNode's toTex to better handle parens
Use the new infrastructure in OperatorNode's toTex
2015-03-01 16:34:09 +01:00
Max Bruckner
1ac3319656 OperatorNode: validate input 2015-03-01 10:35:03 +01:00
Max Bruckner
0e5a6e5a38 New generic toString for OperatorNode 2015-03-01 10:35:03 +01:00
Max Bruckner
d593e749e9 New function getIdentifier() for Nodes
getIdentifier() returns a String that contains the name of the node and
the function associated with it ( in case of FunctionNode and
OperatorNode ).
2015-03-01 10:35:03 +01:00
Max Bruckner
e587f0ce00 New tests for Operator mode
* Factorial of Operator node
* Test unaryMinus with sums and differences
* Test OperatorNode that substracts an OperatorNode
2015-02-14 16:31:05 +01:00
jos
309bf3938d Added proper error messages to Node.map 2014-11-15 13:32:02 +01:00
jos
9257ec3c33 Added unit tests for Node.map and Node.forEach 2014-11-15 13:16:32 +01:00
jos
a1f60db0d1 Created Node.map, changed traverse to use Node.map 2014-11-14 11:25:48 +01:00
jos
be9a8629ea Node.transform does not create a clone of the tree anymore 2014-11-13 22:01:48 +01:00