{
  "format": 1,
  "method": "rattle",
  "version": "0.1.0",
  "interface": "step(q, v, h, mass, force, constraints, gradients) returns [q_next, v_next]. Use velocities v, positive diagonal masses and signed h. Each test repeats the step the indicated number of times. Compare components in absolute tolerance.",
  "constraint_formulas": {
    "sphere": "g(q) = [sum(q_i^2)-1], with row [2*q_i].",
    "sphere-plane": "g(q) = [x^2+y^2+z^2-1, x+z-1], with rows [2*x,2*y,2*z] and [1,0,1]."
  },
  "problems": {
    "rotor": {
      "mass": [
        1,
        1
      ],
      "force": [
        0,
        0
      ],
      "constraints": "sphere"
    },
    "pendulum": {
      "mass": [
        1,
        1
      ],
      "force": [
        0,
        -1
      ],
      "constraints": "sphere"
    },
    "intersection": {
      "mass": [
        2,
        1,
        3
      ],
      "force": [
        0.2,
        -0.35,
        0.4
      ],
      "constraints": "sphere-plane"
    }
  },
  "cases": [
    {
      "name": "free rotor",
      "problem": "rotor",
      "q": [
        1,
        0
      ],
      "v": [
        0,
        0.8
      ],
      "h": 0.3,
      "steps": 1,
      "expected": [
        [
          0.9707728879609323,
          0.24
        ],
        [
          -0.1919999999999983,
          0.7766183103687391
        ]
      ],
      "tol": 4e-12
    },
    {
      "name": "pendulum with a normal force component",
      "problem": "pendulum",
      "q": [
        0,
        -1
      ],
      "v": [
        0.9,
        0
      ],
      "h": 0.16,
      "steps": 7,
      "expected": [
        [
          0.7327172345086037,
          -0.6805332131895282
        ],
        [
          0.2859402676852392,
          0.30786647604020606
        ]
      ],
      "tol": 4e-12
    },
    {
      "name": "coupled constraints and unequal masses",
      "problem": "intersection",
      "q": [
        1,
        0,
        0
      ],
      "v": [
        0,
        0.7,
        0
      ],
      "h": 0.17,
      "steps": 6,
      "expected": [
        [
          0.8720241253012441,
          0.47243634532885853,
          0.1279758746987559
        ],
        [
          -0.16871987431973873,
          0.2657198764885225,
          0.1687198743197387
        ]
      ],
      "tol": 4e-12
    },
    {
      "name": "signed reverse step",
      "problem": "intersection",
      "q": [
        1,
        0,
        0
      ],
      "v": [
        0,
        0.7,
        0
      ],
      "h": -0.13,
      "steps": 1,
      "expected": [
        [
          0.9955663367268552,
          -0.0939575,
          0.004433663273144683
        ],
        [
          0.06921137054243817,
          0.7300923366322236,
          -0.06921137054243819
        ]
      ],
      "tol": 4e-12
    }
  ]
}
