Skip to content

Fix sign consistency in Newton method 2D code#157

Open
Chessing234 wants to merge 1 commit intomitmath:Fall24from
Chessing234:fix-newton-method-sign-consistency
Open

Fix sign consistency in Newton method 2D code#157
Chessing234 wants to merge 1 commit intomitmath:Fall24from
Chessing234:fix-newton-method-sign-consistency

Conversation

@Chessing234
Copy link
Copy Markdown

Fixes #112

The Julia code for Newton's method in 2D (newton2D_step) used δ = J \ T(x) and return x - δ, while the LaTeX equations define J · δ = -T(x₀) and x₁ = x₀ + δ. The signs cancel so the computation was correct, but the mismatch is confusing for students.

Changed the code to match the equations:

  • δ = J \ -T(x) (was J \ T(x))
  • return x + δ (was x - δ)

The LaTeX defines δ = J⁻¹·(-T(x₀)) and x₁ = x₀ + δ, but the code had
δ = J⁻¹·T(x₀) and x₁ = x₀ - δ. The signs cancel so the result was
correct, but the code was inconsistent with the equations shown to
students. Now the code matches the math.

Fixes mitmath#112

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Code in "Newton method in 2D" doesn't match the latex equation

1 participant