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

Show equation being plotted with Latex #3

Open
wants to merge 2 commits into
base: customization
Choose a base branch
from

Conversation

jeanimal
Copy link

Between the plots and the degree input, there is now another jxgbox-class styled box with a LateX (MathJax-rendered) version of the equation.

For example:
degree...equation
1.............a0 + x = 0
2.............a0 + a1 x + x^2 = 0
3.............a0 + a1 x + a2 x^2 + x^3 = 0

There is sometimes a noticeable delay in rendering (at least when serving locally).

I had the idea to add the equation because I was confused. The coefficient labels on the plot did not obviously match the equation at the top of the "Explanation" section-- e.g. for degree n there is no a_n-- so I thought there was a mistake.

Screen Shot 2019-07-11 at 7 44 22 PM

@duetosymmetry
Copy link
Owner

This is looking nice, thanks.

  • Do you know if there's a way to get the equation centered, like the other Eqs?
  • No need to style the equationBox with jxgbox, it can get its own class if you want to apply some styling
  • Please squash commits down into one

@jeanimal jeanimal force-pushed the latex-equation-being-plotted branch from c7e3a81 to 226e3e0 Compare July 13, 2019 18:04
@jeanimal
Copy link
Author

Ready for review.

  • I created a new css style that centers the equation. It also sets a min height to avoid temporary height changes during re-rendering. Screenshot attached.
  • I left the jxgbox css styling because I feel it makes clear that the equation is output.
  • Commits have been squashed.

Screen Shot 2019-07-13 at 12 30 50 PM

@jeanimal
Copy link
Author

Hang on. Just noticed a bug. I will let you know when it's ready.

For example:
degree...equation
1.............a0 + x = 0
2.............a0 + a1 x + x^2 = 0
3.............a0 + a1 x + a2 x^2 + x^3 = 0

Working version of LateX equation display.

Added equation function

Removed exponent for x^1.  Refactored buildEquationStr.

Documented the two string building functions.

Improved formatting of documentation

Centered the equation.

Added css to center equation.  Removed swp file.

Moved call to updateEquation sooner to increase responsiveness; removed unnecessary calls to updateEquation()

Fixed bug where equation updated before (rather than after) degree view changed
@jeanimal jeanimal force-pushed the latex-equation-being-plotted branch from 898399f to 3890f32 Compare July 13, 2019 18:14
@jeanimal
Copy link
Author

All good now. Ready for review.

@duetosymmetry
Copy link
Owner

Thanks for your superhuman patience! I just edited the PR a little bit, but was not able to push to your branch, so I pushed to the branch named jeanimal/show-equation-being-plotted on my own repo. The main differences are:

  1. Got rid of the Old string building function and changes the CSS a bit.
  2. Changed the order of terms in the string building func so that they are decreasing, which I think is more familiar to HS calculus students
  3. Moved the equation above the two panels. This is because I don't want anything between the interactive panes and the controls at the bottom. Now the equation acts as a title for the panes.

The only thing that's bugging me now is that on mobile, if the degree of the polynomial is ~6 or above, the equation will be wider than most people's devices and will thus be cut off. Can you think of any solution to this problem?

@jeanimal
Copy link
Author

jeanimal commented Aug 2, 2019 via email

@jeanimal jeanimal force-pushed the latex-equation-being-plotted branch from 89a8f68 to e63386b Compare August 5, 2019 14:20
Fixes bug when rendering > 1-digit subscripts and exponents with new "wrap" function.

Allow equation to wrap when too long; also allow height of box to change to accomodate wrapped text.

Gave box min-height to be stable for small equations but expand for big equations.
@jeanimal jeanimal force-pushed the latex-equation-being-plotted branch from e63386b to fd9ec61 Compare August 5, 2019 14:21
@jeanimal
Copy link
Author

jeanimal commented Aug 5, 2019 via email

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

Successfully merging this pull request may close these issues.

2 participants