Convergence Rate Calculator

Convergence Rate Calculator .crc-wrapper { max-width: 800px; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #333; line-height: 1.6; padding: 20px; background: #f9f9f9; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); } .crc-header { text-align: center; margin-bottom: 30px; border-bottom: 2px solid #0073aa; padding-bottom: 15px; } .crc-header h2 { margin: 0; color: #23282d; font-size: 24px; } .crc-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 25px; } @media (max-width: 600px) { .crc-grid { grid-template-columns: 1fr; } } .crc-input-group { display: flex; flex-direction: column; } .crc-input-group label { font-weight: 600; margin-bottom: 8px; font-size: 14px; color: #555; } .crc-input-group input { padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; transition: border-color 0.3s; } .crc-input-group input:focus { border-color: #0073aa; outline: none; } .crc-btn { display: block; width: 100%; background: #0073aa; color: white; border: none; padding: 12px; font-size: 16px; font-weight: bold; border-radius: 4px; cursor: pointer; transition: background 0.2s; margin-bottom: 25px; } .crc-btn:hover { background: #005177; } .crc-results { background: white; padding: 20px; border-radius: 6px; border: 1px solid #e1e1e1; display: none; } .crc-result-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; } .crc-result-row:last-child { border-bottom: none; } .crc-result-label { font-weight: 600; color: #444; } .crc-result-value { font-weight: 700; color: #0073aa; font-size: 18px; } .crc-interpretation { margin-top: 15px; padding: 10px; background-color: #f0f7fb; border-left: 4px solid #0073aa; font-size: 14px; } .crc-article { margin-top: 40px; background: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); } .crc-article h3 { color: #23282d; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-top: 0; } .crc-article p { margin-bottom: 15px; } .crc-article ul { margin-bottom: 15px; padding-left: 20px; } .crc-article li { margin-bottom: 8px; } .crc-formula { background: #f4f4f4; padding: 10px; font-family: monospace; border-radius: 4px; display: block; text-align: center; margin: 15px 0; font-size: 1.1em; }

Convergence Rate Calculator

Estimate the order of convergence from three successive errors.

Order of Convergence (p):
Asymptotic Error Constant (C):

Understanding Convergence Rate in Numerical Analysis

In numerical analysis, the Convergence Rate (or Order of Convergence) measures how quickly a sequence of approximations approaches its limit (the true solution). Understanding the convergence rate is crucial for evaluating the efficiency of iterative algorithms like Newton's Method, Secant Method, or Fixed-Point Iteration.

How the Calculation Works

Generally, if a sequence \( \{x_n\} \) converges to a value \( L \), the error at step \( n \) is defined as \( e_n = |x_n – L| \). If the errors decrease according to the relationship:

lim (n→∞) |en+1| / |en|p = C

Then p is the order of convergence and C is the asymptotic error constant. This calculator estimates these values using three successive error terms (\(e_k, e_{k+1}, e_{k+2}\)) using the logarithmic ratio formula:

p ≈ ln(ek+2 / ek+1) / ln(ek+1 / ek)

Classifying the Results

  • Linear Convergence (p ≈ 1): The error decreases by a constant factor in each step (e.g., Bisection Method).
  • Superlinear Convergence (1 < p < 2): Faster than linear but slower than quadratic (e.g., Secant Method, p ≈ 1.618).
  • Quadratic Convergence (p ≈ 2): The number of correct digits roughly doubles with each iteration (e.g., Newton-Raphson Method).

Usage Tips

Enter absolute errors from three consecutive iterations. If you do not know the exact error (because you don't know the true limit), you can often approximate the error using the difference between successive iterates: \( |x_{n+1} – x_n| \).

function calculateConvergence() { // Get input values var e1 = document.getElementById('error1').value; var e2 = document.getElementById('error2').value; var e3 = document.getElementById('error3').value; // Parse floats var err1 = parseFloat(e1); var err2 = parseFloat(e2); var err3 = parseFloat(e3); // Validation if (isNaN(err1) || isNaN(err2) || isNaN(err3)) { alert("Please enter valid numeric values for all three error steps."); return; } if (err1 <= 0 || err2 <= 0 || err3 <= 0) { alert("Errors must be positive non-zero numbers to calculate logarithmic ratios."); return; } // Logic for Order of Convergence (p) // Formula: p = ln(e3/e2) / ln(e2/e1) var logTop = Math.log(err3 / err2); var logBottom = Math.log(err2 / err1); // Check for division by zero (if e2/e1 = 1, log is 0) if (logBottom === 0) { alert("The ratio between Error 1 and Error 2 is 1, which implies no convergence or divergence. Cannot calculate order."); return; } var p = logTop / logBottom; // Logic for Asymptotic Error Constant (C) // Formula: C = e2 / (e1^p) or derived from limit definition C = e3 / (e2^p) // Using the latest step usually gives a local estimate var c = err3 / Math.pow(err2, p); // Display Logic var resultsArea = document.getElementById('resultsArea'); var orderDisplay = document.getElementById('orderResult'); var constantDisplay = document.getElementById('constantResult'); var interpDisplay = document.getElementById('interpretationText'); resultsArea.style.display = 'block'; orderDisplay.innerHTML = p.toFixed(4); constantDisplay.innerHTML = c.toFixed(4); // Interpretation var interpText = ""; if (p < 0.9) { interpText = "Sublinear or Divergent: The convergence order is less than 1, indicating very slow convergence or potential issues with the method."; } else if (p >= 0.9 && p <= 1.1) { interpText = "Linear Convergence (approx. 1): The error reduces by a constant factor C (" + c.toFixed(2) + ") each step."; } else if (p > 1.1 && p < 1.9) { interpText = "Superlinear Convergence: Faster than linear. A common example is the Secant method (p ≈ 1.618)."; } else if (p >= 1.9 && p <= 2.1) { interpText = "Quadratic Convergence (approx. 2): The number of significant digits roughly doubles with every iteration. Typical of Newton's Method."; } else { interpText = "High-Order Convergence: The method converges extremely fast (Order > 2.1)."; } interpDisplay.innerHTML = interpText; }

Leave a Comment