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

Enabling Summation Subscript Equations #133

Open
emily0622 opened this issue Dec 6, 2023 · 4 comments
Open

Enabling Summation Subscript Equations #133

emily0622 opened this issue Dec 6, 2023 · 4 comments
Assignees
Labels
feature New feature or enhancement

Comments

@emily0622
Copy link

The summation is unable to parse a group containing more than a single argument in the subscript.

Error Examples
1)
latex: \sum_{n,m} k_{n,m}
["Sum",["Subscript","k",["Delimiter",["Sequence","n","m"],"','"]],["Error",["ErrorCode","'incompatible-domain'","Symbols","Undefined"],["Delimiter",["Sequence","n","m"],"','"]]]

latex: \sum_{n \in N}K_n
["Sum","K_n",["Error",["ErrorCode","'incompatible-domain'","Symbols","Undefined"],["Element","n","N"]]]

Would like the parser to insert the mathjson of the equation in place of the subscript/superscript.

Proposed Solution to Examples Above
1)
["Sum",["Subscript","k",["Delimiter",["Sequence","n","m"],"','"]],["Hold",["Delimiter",["Sequence","n","m"],"','"]]]
2)
["Sum","K_n",["Hold",["Element","n","N"]]]

@emily0622 emily0622 added the feature New feature or enhancement label Dec 6, 2023
@emily0622
Copy link
Author

Hi, can I implement it?

@arnog
Copy link
Member

arnog commented Dec 6, 2023

Sure! That would be great. You'll want to extend the canonicalIndexingSet function in src/compute-engine/library/utils.ts and then the evalSummation and evalMultiplication function to make use of the extended indexing set.

The correct output should be ["Sum", ..., "n", "m"] for \sum_{n, m} or ["Sum", ..., ["Pair", "n", 1], ["Pair", "m", 1]] for \sum_{n=1, m=1}...

@arnog arnog assigned arnog and emily0622 and unassigned arnog Dec 6, 2023
@emily0622
Copy link
Author

Hi @arnog , some follow-up questions:

  1. Why would \sum_{n,m} -> ["Sum",...,"n","m"] instead of ["Sum",...,["Hold","n"],["Hold","m"]]?
  2. would \sum_{n,m}^{j,k} x -> ["Sum", "x", ["Triple","n",1,"j"], ["Triple","m",1,"k"]]
  3. and would \sum_{d \in D;d \ne 5}{} d -> ["Sum", "d", ["Element","d","D"], ["NotEqual","d","5"]]

@arnog
Copy link
Member

arnog commented Dec 9, 2023

  1. The Hold is not actually necessary since the Sum is already 'hold: "all"` (I know it's generated right now, but it could be removed).
  2. yes, presumably
  3. yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or enhancement
Development

No branches or pull requests

2 participants