Skip to content

The calculation method for _CriticalSolution seems wrong #109675

@LevisonNN

Description

@LevisonNN

Steps to Reproduce

  1. I was reading the source code of Flutter and found a little mistake in spring_simulation.dart.
  2. It is in line 185. When calculating the critical damping solution, I got a different result.
  3. My calculation steps are as follows: y = (c1 + c2 * t) * e ^(r * t) get: v = c2 * e^(r * t) + (c1 + c2 * t) * r * e ^ (r * t) .
  4. When t = 0, get: y = c1, v = c2 + c1 * r, then c2 = v - c1 * r .
  5. So I think this code should be: "final double c2 = velocity - (r * distance);" , but not "final double c2 = velocity / (r * distance );".
  6. I calculated many times and tried to make sure every step of my calculation was right, always got this result.
  7. Was this a mistake or am I wrong?
  8. Thank you.

Expected results:

Actual results:

Code sample
Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: animationAnimation APIsframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions