Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending Summation and Product Functionality #137

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

emily0622
Copy link

Description

Extends the functionality of summations. Before this pr the summation could only handle a single index in the form var=num in the subscript, now it can handle multiple indexes. It can parse summations that include boxed expressions such as 'Element' and 'Unequal', as well as solve numeric equations.

Fixes

This pr addresses the issues discussed in: #133

Examples

The following are some examples of test cases added from test/compute-engine/latex-syntax/arithmetic.test.ts

Parsing Examples

$$\sum_{n,m} k_{n,m}$$
["Sum", ["Subscript", "k", ["Delimiter", ["Sequence", "n", "m"], "','"]], "n", "m"]

$$\sum_{n=0,m=4}^{4,8}n+m$$
["Sum", ["Add", "m", "n"], ["Triple", "n", 0, 4], ["Triple", "m", 4, 8]]

$$\sum_{n \in N}K_n$$
["Sum", "K_n", ["Element", "n", "N"]]

Evaluating Examples

$$\sum_{n=0,m=4}^{4,8}{n+m} => 200$$

$$\sum_{n=0}^{4}\sum_{m=4}^{8}{n+m} => 200$$

@arnog arnog merged commit 90b426a into cortex-js:main Dec 18, 2023
@arnog
Copy link
Member

arnog commented Dec 18, 2023

Great job on this! Thank you so much for the PR. Super useful and I'm sure many people will enjoy it.

@arnog arnog self-requested a review December 18, 2023 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants