phetsims / curve-fitting

"Curve Fitting" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 3 forks source link

formulae for polynomials #83

Closed pixelzoom closed 8 years ago

pixelzoom commented 8 years ago

Representation of first, second and third degree polynomials is usually presented like this (e.g. from https://en.wikipedia.org/wiki/Curve_fitting):

y = ax + b y = ax2 + bx + c y = ax3 + bx2 + cx + d

But the curve-fitting sim currently presents them like this (note coefficients for first and second order polynomials):

y = cx + d y = bx2 + cx + d y = ax3 + bx2 + cx + d

Is there a design reason for this, or did someone slip this in as a programming convenience?

pixelzoom commented 8 years ago

The Java version was even more unusual:

y = a + bx y = a + bx + cx2 y = a + bx + cx2 + dx3 y = a + bx + cx2 + dx3 + ex4

ariel-phet commented 8 years ago

@pixelzoom this is specified in the design doc so it was a conscious decision

It does not look like the discussion was captured in the meeting notes ever (we were not as thorough at that time)...

I believe this approach was chosen so that "d" for instance never changed meaning.

I vaguely recall suggesting something like C_3, C_2, C_1, C_0 (where the numbers are subscripts) but that was definitely shot down.

We can certainly revisit this question, but generally I will defer to @amanda-phet

It seems like the big question is....does the consistency of the interaction (the "d" slider for instance always being the constant) outweigh bucking convention.

pixelzoom commented 8 years ago

Perspective from someone new to the sim...

As a user, when I first tried this sim, I started with "linear", and was very surprised to see "y = cx + d". What happened to "a" and "b"? As I progressed to "quadratic" and "cubic", I figured out what was going on. So it resulted in initial confusion, followed by "ok, this isn't the representation I've seen a million times before, but I can work with it".

As a programmer, my hypothesis was that this was either (a) a compromise to make the implementation easier, or (b) a very subtle attempt to use the same letter for the same order term in all equations. Since (b) seemed extremely subtle and not worth bucking such a well-established convention, my guess was (a). But apparently it's actually (b). Deferring to @amanda-phet of course, but breaking with convention in this case seems to have dubious benefit, and the potential for confusion.

pixelzoom commented 8 years ago

Looking at the code... Changing the current behavior is going to require some serious changes. In the longterm those changes would be good, because the current architecture is brittle and inflexible. But it's going to be a big chunk of work. The alternative is to live with things "as is" (including the presentation of the equations), get the sim published, and hope that it doesn't need maintenance or new features in the future.

amanda-phet commented 8 years ago

I'm not sure I understand... changing the coefficients to a standard representation would require serious changes to the code? If that's the case, let's just keep it "as is" with the format that was decided on by the design team.

I understand it is unconventional- trust me! We had many conversations about it, and the less conventional format seemed to satisfy the learning goals quite a bit better. In this sim, a goal is to understand that adding a term to the polynomial increases the quality of the fit (if you are using X^2 as your measure of quality). If the coefficients change when a term is added, it's harder to see the additional term as the only change to the equation.

pixelzoom commented 8 years ago

Yes, changing the coefficients to a standard representation would require serious changes to the code. For example, coefficient 'a' is currently impossible to use with any term other than x3. Similarly for the other coefficients. Imo, this is a really bad internal design - there should be no direct tie between the coefficients in the model and how they are presented to the user. And changing that bad internal design is a big project.

pixelzoom commented 8 years ago

Btw... This also implies that adding a Quatric curve (which was present in the Flash version) would be very difficult and costly -- since (for example) the 'a' coefficient would need to be associated with the x4 term. So if some teacher pops up who was relying on the Quartic feature in the Flash version, we'll be in trouble.

amanda-phet commented 8 years ago

I see. That does sound like bad design. It's probably not worth it for this sim to redo the internal design, since I don't think it's widely used and will probably not need new features in the future. But I will leave that to you and Ariel to decide.

As for adding a quartic curve, we decided that the learning goals associated with the higher degree functions were satisfied with only going to cubic. So it's unlikely that a teacher is relying on that feature.

pixelzoom commented 8 years ago

OK. So the answer to this question is to leave the presentation 'as is'. I'll decide separately whether to clean up the internals.

Closing.