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

isPolynomialTerm #8

Closed
evykassirer opened this issue Aug 12, 2017 · 7 comments
Closed

isPolynomialTerm #8

evykassirer opened this issue Aug 12, 2017 · 7 comments

Comments

@evykassirer
Copy link

It makes sense that numbers are terms that can be found in a polynomial, but there were a bunch of cases in mathsteps where we used a different "polynomial term" which referred to things like x and 2x and 2x^2 but not 2 which was helpful for symbol manipulation - does it seem reasonable to add a function to query that checks for a type like this? If so, do you have ideas for what to call it?

I was thinking of using it for another update to math-parser that prints 2x^2 without a space similar to 2x

@kevinbarabash
Copy link
Member

I think it makes sense to define custom query functions like this inside of mathsteps as it's linked to the implementation of mathsteps as opposed to a mathematical definition.

@evykassirer
Copy link
Author

Makes sense :)

Should I do a one off piece of code in math parser for identifiers or identifiers with exponents then?

@kevinbarabash
Copy link
Member

Yes, but in mathsteps not math-parser. :)

@evykassirer
Copy link
Author

I can't change the printing in mathsteps though, it'd have to be in math parser. I can just write the check where I need it as a one-off instead of making it a broad use function though.

If you do want to keep spaces between coefficients and identifiers with exponents, I can also just update all the mathsteps tests

@kevinbarabash
Copy link
Member

Sorry... I didn't pick up on:

I was thinking of using it for another update to math-parser that prints 2x^2 without a space similar to 2x

We could print 2 x as 2x, but if there are multiple variables then we go from 2 x y to 2x y which is a little weird. It would be nice to have consistent spacing between implicitly multiplied nodes. We could look at going to 2xy but we'd have to change the parser.

I feel like it probably makes sense to provide a way to change settings in the output of the print function so that mathsteps and other projects don't have to change their tests.

@evykassirer
Copy link
Author

evykassirer commented Aug 13, 2017

we already made the change to print 2x instead of 2 x

my preferred printing would be:

  • 2x
  • 2x^2
  • 2x^y
    -2x^(5+6) (i.e. any identifier with an exponent or not, with a coefficient - no space)
  • 2 x y (if there are three arguments to a multiplication, just put space for all of them since we can't do 2xy)

so the conditions would be

  • implicit multiplication
  • first argument is number
  • second argument is identifier or identifier with an exponent (exponent can be anything)

if you like that, I can update the math-parser print function to do that for now, and we can make it configurable later if you like

if you're not really into that or want to do something different, I'll just update the mathsteps tests - it's not a huge deal

...but if I can print things the way I like without much friction (if you prefer that style or don't mind either way) I'd rather update math-parser ^_^

but yeah, no worries if you want to do something different

@evykassirer
Copy link
Author

this is being addressed in semantic-math/math-parser#68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants