Skip to content

Commit

Permalink
fix d3#183: Default function parameters are ECMAScript 2015
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil committed Jan 3, 2020
1 parent 1495360 commit 06b2add
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/newton.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ export function solve(f, y, x) {

// Approximate Newton-Raphson in 2D
// Solve f(a,b) = [x,y]
export function solve2d(f, MAX_ITERATIONS = 40, eps = epsilon2) {
return function(x, y, a = 0, b = 0) {
export function solve2d(f, MAX_ITERATIONS, eps) {
if (MAX_ITERATIONS === undefined) MAX_ITERATIONS = 40;
if (eps === undefined) eps = epsilon2;
return function(x, y, a, b) {
var err2, da, db;
a = a === undefined ? 0 : +a;
b = b === undefined ? 0 : +b;
for (var i = 0; i < MAX_ITERATIONS; i++) {
var p = f(a, b),
// diffs
Expand Down

0 comments on commit 06b2add

Please sign in to comment.