quasi-polynomials and annotated functions
Nobody has claimed this yet.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
I have a quasi-polynomial given to me as a string from an external program:
```m2
H(x,y) = ((1 + x) + (5/2 + x) * y + 3/2 * y^2) + (-1/2 + x) * floor((x)/3) - 3/2 * floor((x)/3)^2
```
Unfortunately M2 doesn't support defining this as a native polynomial because of the floor, though it would be great if it did. One approach is to store 3 different polynomials, or perhaps 1 common polynomial + 3 small correction terms.
Currently I've resorted to parsing that using regex and defining:
```m2
H = value "(x,y) -> ((1 + x) + (5/2 + x) * y + 3/2 * y^2) + (-1/2 + x) * floor((x)/3) - 3/2 * floor((x)/3)^2"
```
So I can use it to evaluate terms, but ideally I'd like to _see_ it like a polynomial, and `code H` doesn't work, because the source isn't in a file (I just see `FunctionClosure[currentString:1:0-1:82]`).
I resorted to something hacky, like this:
```m2
i62 : setAttribute(H, symbol ReverseDictionary, "((1 + x) + (5/2 + x) * y + 3/2 * y^2) + (-1/2 + x) * floor((x)/3) - 3/2 * floor((x)/3)^2");
i63 : H
o63 = ((1 + x) + (5/2 + x) * y + 3/2 * y^2) + (-1/2 + x) * floor((x)/3) - 3/2 * floor((x)/3)^2
o63 : FunctionClosure
```
But it feels like this might have some unintended consequences. (Sidenote: using the attribute `PrintNames` or `PrintNet` did not have any effect. Why do we have them?!)
Any suggestions?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the value-created FunctionClosure and the code command, then inspect how ReverseDictionary, PrintNames, and PrintNet affect display. Determine whether the intended change is source-backed display or a native quasi-polynomial representation; done requires an agreed design and defined evaluation and printed-output behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100