Weighted Average Discount Rate for Leases Calculator
Accurately determine the implied discount rate for lease agreements to understand true financing costs.
Lease Discount Rate Calculator
The fixed amount paid periodically (e.g., monthly, annually).
The total count of payments over the lease term.
The expected value of the asset at the end of the lease term.
The initial cost or fair market value of the asset being leased.
Calculation Results
—
Total Lease Payments Value—
Present Value of Residual Value—
Implied Interest Rate per Period—
Formula Used: The Weighted Average Discount Rate (WADR) is essentially the internal rate of return (IRR) of the lease cash flows. This calculator uses an iterative numerical method (like the Newton-Raphson method or a financial solver approximation) to find the discount rate 'r' that satisfies the equation: PV = Σ [PMT / (1+r)^t] + RV / (1+r)^n. Where PV is Present Value, PMT is Periodic Payment, RV is Residual Value, n is Number of Periods, and t is the payment period.
Cash Flow vs. Discount Rate
Lease Cash Flow Schedule
Period
Beginning Balance
Lease Payment
Residual Value Payment
Ending Balance
Enter values and click Calculate to see schedule.
What is the Weighted Average Discount Rate for Leases?
The weighted average discount rate for leases, often referred to more broadly as the implied discount rate or the lease's implicit interest rate, is a crucial metric for financial analysis. It represents the effective rate of return that the lessor (owner of the asset) earns on the lease investment, or conversely, the effective cost of financing for the lessee (user of the asset). In essence, it's the single interest rate that equates the present value of all future lease payments and the expected residual value of the asset to its initial cost or fair market value at the commencement of the lease. Understanding this rate is vital for both parties to assess the economic viability and fairness of the lease agreement. It's not a simple interest calculation; it accounts for the timing and magnitude of all cash flows associated with the lease.
Who should use it:
Lessor (Financiers/Owners): To determine the profitability of the lease and ensure it meets their required rate of return objectives.
Lessee (Businesses/Individuals): To understand the true cost of financing the use of an asset over the lease term, enabling comparison with other financing options like outright purchase or loans.
Accountants and Financial Analysts: For accurate financial reporting, asset valuation, and lease accounting compliance (e.g., under IFRS 16 or ASC 842).
Investment Professionals: To evaluate lease investments and compare them against other investment opportunities with similar risk profiles.
Common Misconceptions:
It's the same as the stated interest rate: Many leases don't explicitly state an interest rate. The WADR is *implied* by the lease structure, not always declared.
It's just the sum of payments divided by cost: This ignores the critical time value of money principle.
It's only relevant for complex leases: Even simple leases have an implied discount rate that reflects the cost of capital or required return.
Weighted Average Discount Rate for Leases Formula and Mathematical Explanation
The core principle behind calculating the weighted average discount rate for leases lies in finding the Internal Rate of Return (IRR) for the lease's cash flows. The IRR is the discount rate at which the Net Present Value (NPV) of all cash flows equals zero. For a lease, the cash flows typically include the periodic lease payments made by the lessee and the residual value received (or paid) by the lessor at the end of the lease term. The present value side is usually represented by the initial cost or fair market value of the leased asset.
The fundamental equation is derived from the present value of an annuity formula combined with the present value of a single future sum:
PV = Σ [ PMT / (1 + r)^t ] + RV / (1 + r)^n
Where:
PV = Present Value (Initial Cost or Fair Market Value of the asset)
PMT = Periodic Lease Payment
RV = Residual Value (Expected value of the asset at lease end)
n = Total Number of Periods (or payments)
t = The specific period number for each payment (from 1 to n)
r = The discount rate per period (this is what we are solving for – the WADR)
Mathematical Explanation:
Present Value of Lease Payments: The first part of the equation, Σ [ PMT / (1 + r)^t ], calculates the present value of all the future lease payments. Each payment (PMT) is discounted back to the present using the discount rate (r) raised to the power of the payment period (t).
Present Value of Residual Value: The second part, RV / (1 + r)^n, calculates the present value of the expected residual value of the asset at the end of the lease term. This single future sum is discounted back 'n' periods.
Equating to Initial Cost: The sum of these two present values should equal the initial present value (PV) or cost of the asset.
Solving for 'r': The equation is typically a polynomial of a high degree and cannot be solved directly for 'r'. Financial calculators and software use iterative numerical methods (like the Newton-Raphson method, bisection method, or built-in IRR functions) to approximate the value of 'r' that makes the equation true. Our calculator employs such a method.
Variables Table:
Lease Variables Explained
Variable
Meaning
Unit
Typical Range
Periodic Lease Payment (PMT)
The regular amount paid by the lessee to the lessor.
Currency (e.g., USD, EUR)
Positive value, determined by lease terms.
Total Number of Payments (n)
The total count of payments throughout the lease term.
Count (Integer)
1 to many (e.g., 12 for 1 year monthly).
Residual Value (RV)
The estimated market value of the asset at the end of the lease.
Currency (e.g., USD, EUR)
0 to asset's initial cost. Often a percentage of initial cost.
Present Value / Initial Cost (PV)
The initial cost or fair market value of the asset being leased.
Currency (e.g., USD, EUR)
Positive value, benchmark for lease cost.
Weighted Average Discount Rate (r)
The implied rate of return/financing cost per period.
Percentage (%)
Typically positive, e.g., 2% to 20% annually.
Practical Examples (Real-World Use Cases)
Example 1: Equipment Lease
A company is leasing a piece of specialized manufacturing equipment. The lease terms are:
Periodic Lease Payment: $2,500 per month
Total Number of Payments: 60 months (5 years)
Estimated Residual Value: $15,000
Initial Cost (Fair Market Value) of Equipment: $100,000
Using the calculator:
Inputs: Lease Payment = 2500, Number of Periods = 60, Residual Value = 15000, Present Value = 100000.
Calculated Weighted Average Discount Rate (Annualized): Approximately 7.45%
Financial Interpretation: This means the lease effectively represents a financing cost of about 7.45% per year for the lessee, assuming the residual value is accurately estimated. The lessor is earning an approximate annual return of 7.45% on their investment in the equipment.
Example 2: Vehicle Lease
An individual leases a car with the following terms:
Periodic Lease Payment: $400 per month
Total Number of Payments: 36 months (3 years)
Estimated Residual Value: $20,000
Initial Cost (MSRP) of Vehicle: $35,000
Using the calculator:
Inputs: Lease Payment = 400, Number of Periods = 36, Residual Value = 20000, Present Value = 35000.
Calculated Weighted Average Discount Rate (Annualized): Approximately 9.12%
Financial Interpretation: The implied annual financing rate for this car lease is 9.12%. The lessee can compare this rate against personal loan rates or other financing options to see if leasing is the most cost-effective choice. The lessor expects to earn a 9.12% annual return on this lease.
How to Use This Weighted Average Discount Rate for Leases Calculator
Our calculator simplifies the complex process of determining the implied financing rate of a lease agreement. Follow these steps for accurate results:
Gather Lease Information: Collect the precise details of your lease agreement. You'll need the amount of each regular payment (Periodic Lease Payment), how many payments you will make in total (Total Number of Payments), the expected value of the asset at the end of the lease term (Estimated Residual Value), and the asset's initial cost or fair market value (Present Value or Initial Cost of Asset).
Input Data: Enter each value into the corresponding field in the calculator. Ensure you use consistent currency units for all monetary values. Specify the number of periods accurately (e.g., if payments are monthly for 3 years, enter 36).
Validate Inputs: The calculator performs real-time validation. Check for any error messages below the input fields. Ensure payments and values are non-negative and the number of periods is at least 1.
Calculate: Click the "Calculate Rate" button. The calculator will perform the iterative calculation to find the implied discount rate.
Interpret Results:
Primary Result (Weighted Average Discount Rate): This is the main output, shown as an annualized percentage. It represents the effective cost of financing for the lessee or the return for the lessor.
Intermediate Values: These provide insights into the components of the calculation:
Total Lease Payments Value: The sum of all periodic payments (PMT * n).
Present Value of Residual Value: The value of the residual amount discounted back to today.
Implied Interest Rate per Period: The calculated rate before annualization.
Formula Explanation: Read the brief explanation of the underlying formula to understand the financial principles at play.
Chart: The chart visualizes how changes in the discount rate affect the present value of the lease cash flows relative to the initial cost.
Cash Flow Table: This table breaks down the lease into periods, showing the movement of the asset's value and the allocation of payments.
Decision Making: Compare the calculated Weighted Average Discount Rate against benchmark rates, such as your company's cost of capital, other loan offers, or your required rate of return. A significantly higher WADR than expected might indicate an unfavorable lease term for the lessee, while a lower-than-expected rate could signal a profitable deal for the lessor.
Copy Results: Use the "Copy Results" button to easily transfer the key figures and assumptions to your reports or analyses.
Reset: Click "Reset" to clear all fields and start over with new lease data.
Key Factors That Affect Weighted Average Discount Rate Results
Several elements significantly influence the calculated Weighted Average Discount Rate (WADR) for a lease. Understanding these factors helps in negotiating better lease terms and accurately assessing financial implications:
Lease Term (Number of Periods): A longer lease term generally means more payments and a larger impact of compounding. For a fixed payment amount, longer terms can sometimes lead to higher effective rates if the residual value doesn't proportionally increase. The timing of cash flows is critical in time value of money calculations.
Periodic Payment Amount (PMT): Higher periodic payments, while reducing the ultimate principal paid down over time, increase the present value of cash outflows for the lessee. This generally leads to a higher implied WADR, assuming other factors remain constant.
Residual Value (RV): This is a major determinant. A higher estimated residual value significantly reduces the effective financing needed from the periodic payments, thus lowering the implied WADR. Conversely, a low or pessimistic residual value increases the WADR. Accurate residual value estimation is key.
Initial Cost / Fair Market Value (PV): The basis against which all cash flows are measured. A higher initial cost for the same set of payments and residual value will result in a lower WADR, as the lessor's required return is spread over a larger asset base.
Market Interest Rates and Risk Premium: The WADR is heavily influenced by prevailing market interest rates for similar types of financing and assets. Lessors will incorporate a risk premium into their required rate of return based on the lessee's creditworthiness, the asset's volatility, and general economic conditions. Higher perceived risk leads to a higher WADR.
Inflation Expectations: While not always explicit, inflation expectations can be baked into the lease payment and residual value assumptions. Higher expected inflation might lead lessors to demand higher nominal rates to protect the real value of their returns, thus increasing the WADR.
Lease Structure Complexity: Leases with step-up payments, balloon payments, or unusual residual value guarantees can alter the cash flow timing and magnitude, requiring careful calculation of the WADR.
Fees and Other Costs: While not directly in the basic formula, upfront fees, early termination penalties, or maintenance responsibilities not factored into the base payment can effectively increase the overall cost of the lease, which is related to the implied WADR.
Frequently Asked Questions (FAQ)
Q1: What's the difference between the WADR and the stated interest rate on a loan?A loan typically states an explicit interest rate. The WADR for a lease is *implied* by the lease terms (payments, residual value, asset cost) and represents the effective financing rate. Many leases do not state an explicit interest rate, making the WADR crucial for understanding cost.Q2: Can the WADR be negative?In standard lease agreements, the WADR is typically positive. A negative rate would imply the lessor is paying the lessee to use the asset, which is highly unusual outside of specific promotional or subsidized financing scenarios. Our calculator assumes positive inputs leading to a positive rate.Q3: How does the residual value assumption affect the WADR?A higher estimated residual value lowers the WADR because it means a larger portion of the asset's value is expected to be recovered at the end, reducing the risk and financing burden during the lease term. A lower residual value increases the WADR.Q4: Is the WADR the same as the lease's Internal Rate of Return (IRR)?Yes, for practical purposes in lease analysis, the Weighted Average Discount Rate calculated from the lease payments and residual value is equivalent to the Internal Rate of Return (IRR) of the lease's cash flows relative to the asset's initial cost.Q5: Should I use monthly or annual rates in the calculator?The calculator handles this internally. Ensure your 'Periodic Lease Payment' and 'Total Number of Payments' correspond (e.g., if payments are monthly, use the monthly amount and the total number of months). The calculator then annualizes the resulting per-period rate for easier comparison.Q6: What if the lease has upfront fees?Standard WADR calculations often simplify by assuming no upfront fees, or by including them in the initial 'Present Value / Initial Cost'. For a more precise analysis including fees, you might need to adjust the PV input or use more advanced IRR functions that can handle uneven cash flows.Q7: How is the WADR used in lease accounting?For lessees, the WADR (or a comparable incremental borrowing rate) is used to discount future lease payments to calculate the lease liability and right-of-use asset under standards like IFRS 16 and ASC 842. For lessors, it impacts revenue recognition and net investment calculations.Q8: Can I compare the WADR of different leases?Yes, comparing the WADR across different lease offers for similar assets is a primary use case. It allows for a standardized comparison of the financing cost, irrespective of varying payment structures or residual values.
// Function to validate input and show errors
function validateInput(id, errorMessageId, minValue = null, maxValue = null) {
var input = document.getElementById(id);
var errorDiv = document.getElementById(errorMessageId);
var value = parseFloat(input.value);
var isValid = true;
errorDiv.style.display = 'none'; // Hide error by default
if (isNaN(value)) {
if (input.value.trim() === ") {
errorDiv.textContent = 'This field cannot be empty.';
} else {
errorDiv.textContent = 'Please enter a valid number.';
}
errorDiv.style.display = 'block';
isValid = false;
} else if (minValue !== null && value maxValue) {
errorDiv.textContent = 'Value cannot be greater than ' + maxValue + '.';
errorDiv.style.display = 'block';
isValid = false;
}
return isValid;
}
// Function to update chart
function updateChart(ratePerPeriod, pv, pmt, n, rv) {
var canvas = document.getElementById('cashFlowChart');
if (!canvas) return; // Exit if canvas element not found
var ctx = canvas.getContext('2d');
if (!ctx) return; // Exit if context not available
canvas.width = canvas.parentElement.offsetWidth * 0.9; // Responsive width
canvas.height = 300; // Fixed height, adjust as needed
var rates = [];
var npvValues = [];
var baseNpv = pv; // Start with the initial cost/PV
// Calculate NPV for a range of rates around the calculated rate
var minRate = Math.max(0, ratePerPeriod – 0.05);
var maxRate = ratePerPeriod + 0.05;
var step = (maxRate – minRate) / 10; // 10 data points
if (step < 0.001) step = 0.001; // Ensure a minimum step size
for (var i = 0; i <= 10; i++) {
var currentRate = minRate + i * step;
rates.push(currentRate * 100); // Store as percentage for label
var npvCalc = pv; // Start with initial PV
// Subtract PV of payments
for (var t = 1; t = 0 && zeroLineY <= canvas.height) {
ctx.beginPath();
ctx.moveTo(0, zeroLineY);
ctx.lineTo(canvas.width, zeroLineY);
ctx.strokeStyle = '#dc3545';
ctx.lineWidth = 1;
ctx.stroke();
}
// Draw chart using basic canvas API (simplified rendering)
var padding = 40;
var chartAreaWidth = canvas.width – 2 * padding;
var chartAreaHeight = canvas.height – 2 * padding;
// Find max and min NPV values for scaling
var maxNpv = Math.max(…npvValues);
var minNpv = Math.min(…npvValues);
var valueRange = maxNpv – minNpv;
if (valueRange === 0) valueRange = 1; // Avoid division by zero
// Y-axis scale (NPV)
var getYPos = function(npvValue) {
return padding + chartAreaHeight – ((npvValue – minNpv) / valueRange) * chartAreaHeight;
};
// X-axis scale (Rate %)
var getXPos = function(index) {
return padding + (index / (rates.length – 1)) * chartAreaWidth;
};
// Draw data points and lines
ctx.beginPath();
for (var i = 0; i < chartData.datasets[0].data.length; i++) {
var x = getXPos(i);
var y = getYPos(chartData.datasets[0].data[i]);
if (i === 0) {
ctx.moveTo(x, y);
} else {
ctx.lineTo(x, y);
}
}
ctx.strokeStyle = chartData.datasets[0].borderColor;
ctx.lineWidth = 2;
ctx.stroke();
// Draw points
for (var i = 0; i padding) ctx.fillText(maxNpv.toFixed(0), padding – 10, yLabelPos1 + 5);
if (yLabelPos2 < canvas.height – padding) ctx.fillText(minNpv.toFixed(0), padding – 10, yLabelPos2 + 5);
// Zero line label
ctx.fillText('0', padding – 10, zeroLineY + 5);
ctx.fillStyle = '#dc3545';
ctx.fillText('NPV = 0', padding + 10 , zeroLineY – 10);
}
// Function to calculate WADR using a simple financial solver approximation
function calculateWeightedAverageDiscountRate() {
var pmt = parseFloat(document.getElementById('leasePayment').value);
var n = parseInt(document.getElementById('numberOfPeriods').value);
var rv = parseFloat(document.getElementById('leaseResidualValue').value);
var pv = parseFloat(document.getElementById('presentValueOrCost').value);
var resultsContainer = document.getElementById('results-container');
var weightedAverageDiscountRateEl = document.getElementById('weightedAverageDiscountRate');
var totalLeasePaymentsValueEl = document.getElementById('totalLeasePaymentsValue');
var pvResidualValueEl = document.getElementById('pvResidualValue');
var impliedRatePerPeriodEl = document.getElementById('impliedRatePerPeriod');
var cashFlowTableBody = document.getElementById('cashFlowTableBody');
// Clear previous errors and results
document.getElementById('leasePaymentError').style.display = 'none';
document.getElementById('numberOfPeriodsError').style.display = 'none';
document.getElementById('leaseResidualValueError').style.display = 'none';
document.getElementById('presentValueOrCostError').style.display = 'none';
// Validation
var isValid = true;
isValid = validateInput('leasePayment', 'leasePaymentError', 0) && isValid;
isValid = validateInput('numberOfPeriods', 'numberOfPeriodsError', 1) && isValid;
isValid = validateInput('leaseResidualValue', 'leaseResidualValueError', 0) && isValid;
isValid = validateInput('presentValueOrCost', 'presentValueOrCostError', 0) && isValid;
if (!isValid) {
weightedAverageDiscountRateEl.textContent = '–';
totalLeasePaymentsValueEl.textContent = '–';
pvResidualValueEl.textContent = '–';
impliedRatePerPeriodEl.textContent = '–';
cashFlowTableBody.innerHTML = '
Please correct the errors above.
';
updateChart(0, pv, pmt, n, rv); // Clear chart or show default state
return;
}
// Calculation Logic (Iterative approach to find IRR)
var ratePerPeriod = 0;
var maxIterations = 1000;
var tolerance = 0.00001;
var guess = 0.05; // Initial guess for rate
for (var i = 0; i < maxIterations; i++) {
var npv = pv;
for (var t = 1; t <= n; t++) {
npv -= pmt / Math.pow(1 + guess, t);
}
npv += rv / Math.pow(1 + guess, n);
// Derivative of NPV with respect to rate (for Newton-Raphson)
var derivative = 0;
for (var t = 1; t <= n; t++) {
derivative += (t * pmt) / Math.pow(1 + guess, t + 1);
}
derivative -= (n * rv) / Math.pow(1 + guess, n + 1);
var newGuess = guess – npv / derivative;
if (Math.abs(newGuess – guess) < tolerance) {
ratePerPeriod = newGuess;
break;
}
guess = newGuess;
// Handle cases where derivative is close to zero or rate becomes invalid
if (isNaN(guess) || !isFinite(guess) || guess 10) { // If it fails repeatedly, try a simpler approach or signal error
ratePerPeriod = guess; // Fallback or indicate failure
break;
}
}
}
// If iteration limit reached without convergence, use the last guess
if (i === maxIterations) {
ratePerPeriod = guess; // Use the last calculated value
}
// Ensure rate is not negative (can happen with weird inputs or solver instability)
if (ratePerPeriod 12. If not specified, it's ambiguous.
// For this calculator, we'll present the rate per period and a simple annualized rate.
// A better approach would be to ask for period frequency (Monthly, Quarterly, Annually).
// Simplified annualization: Assume n represents number of periods, and ratePerPeriod is the rate for that period.
// If we assume 'monthly' is implied by default for common leases:
var numPeriodsPerYear = 12; // Default assumption
// A more robust solution would ask the user for frequency.
// For now, let's just multiply by 12 if n is large, otherwise it might be annual.
// Let's stick to the rate per period and a common-sense annualization.
// Example annualization: If n=60 (monthly for 5 years), ratePerPeriod is monthly rate. Annualized = ratePerPeriod * 12.
// If n=4 (quarterly), ratePerPeriod is quarterly rate. Annualized = ratePerPeriod * 4.
// If n=5 (annual), ratePerPeriod is annual rate. Annualized = ratePerPeriod * 1.
// Let's calculate a standard nominal annual rate assuming monthly payments if n > 12, else assume annual payments.
var nominalAnnualRate = ratePerPeriod;
if (n > 12) { // Heuristic: assume monthly payments if many periods
nominalAnnualRate = ratePerPeriod * 12;
} else if (n > 4) { // Heuristic: assume quarterly payments
nominalAnnualRate = ratePerPeriod * 4;
} else { // Assume annual payments
nominalAnnualRate = ratePerPeriod * 1;
}
// Ensure the annualized rate is not negative
if (nominalAnnualRate < 0) nominalAnnualRate = 0;
var totalLeasePayments = pmt * n;
var pvOfResidual = rv / Math.pow(1 + ratePerPeriod, n);
weightedAverageDiscountRateEl.textContent = (nominalAnnualRate * 100).toFixed(2) + '%';
totalLeasePaymentsValueEl.textContent = '$' + totalLeasePayments.toFixed(2);
pvResidualValueEl.textContent = '$' + pvOfResidual.toFixed(2);
impliedRatePerPeriodEl.textContent = (ratePerPeriod * 100).toFixed(3) + '% per period';
// Update Cash Flow Table
cashFlowTableBody.innerHTML = ''; // Clear previous table rows
var currentBalance = pv;
for (var t = 1; t <= n; t++) {
var paymentInterestComponent = 0; // Not directly calculated here in basic WADR, but conceptually part of payment
var paymentPrincipalComponent = pmt; // This is simplified; actual principal/interest depends on rate
var residualPayment = 0;
// If it's the last period, the payment covers the remaining balance + residual value part
if (t === n) {
// The calculation ensures PV = Sum(PMT/(1+r)^t) + RV/(1+r)^n
// So, the ending balance conceptually should trend towards RV.
// For the table, we show the payment and how the balance moves.
}
// We will approximate the ending balance. The core calculation is finding 'r'.
// The table should reflect the conceptual flow.
var nextBalance = currentBalance – pmt; // Simplified: assumes payment reduces balance directly
if (t === n) {
// At the end, the remaining balance should theoretically be covered by the residual value.
// Let's just show the asset value is theoretically recovered by RV.
cashFlowTableBody.innerHTML += `
${t}
$${currentBalance.toFixed(2)}
$${pmt.toFixed(2)}
$${rv.toFixed(2)} (Final)
$0.00 (Asset Returned/Sold)
`;
} else {
cashFlowTableBody.innerHTML += `
${t}
$${currentBalance.toFixed(2)}
$${pmt.toFixed(2)}
$0.00
$${nextBalance.toFixed(2)}
`;
currentBalance = nextBalance; // Update balance for the next period
}
}
// Update Chart
updateChart(ratePerPeriod, pv, pmt, n, rv);
}
// Function to reset the form
function resetForm() {
document.getElementById('leasePayment').value = '1000.00';
document.getElementById('numberOfPeriods').value = '60';
document.getElementById('leaseResidualValue').value = '20000.00';
document.getElementById('presentValueOrCost').value = '50000.00';
// Clear error messages
document.getElementById('leasePaymentError').style.display = 'none';
document.getElementById('numberOfPeriodsError').style.display = 'none';
document.getElementById('leaseResidualValueError').style.display = 'none';
document.getElementById('presentValueOrCostError').style.display = 'none';
// Reset results
document.getElementById('weightedAverageDiscountRate').textContent = '–';
document.getElementById('totalLeasePaymentsValue').textContent = '–';
document.getElementById('pvResidualValue').textContent = '–';
document.getElementById('impliedRatePerPeriod').textContent = '–';
document.getElementById('cashFlowTableBody').innerHTML = '
Enter values and click Calculate to see schedule.
';
// Reset chart (optional: call updateChart with default/zero values or clear canvas)
var canvas = document.getElementById('cashFlowChart');
if(canvas) {
var ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
}
// Function to copy results to clipboard
function copyResults() {
var mainResult = document.getElementById('weightedAverageDiscountRate').textContent;
var totalPayments = document.getElementById('totalLeasePaymentsValue').textContent;
var pvResidual = document.getElementById('pvResidualValue').textContent;
var ratePerPeriod = document.getElementById('impliedRatePerPeriod').textContent;
var assumptions = "Key Assumptions:\n";
assumptions += "Periodic Lease Payment: $" + document.getElementById('leasePayment').value + "\n";
assumptions += "Total Number of Payments: " + document.getElementById('numberOfPeriods').value + "\n";
assumptions += "Estimated Residual Value: $" + document.getElementById('leaseResidualValue').value + "\n";
assumptions += "Present Value / Initial Cost: $" + document.getElementById('presentValueOrCost').value + "\n";
var textToCopy = "— Lease Discount Rate Calculation Results —\n\n";
textToCopy += "Weighted Average Discount Rate (Annualized): " + mainResult + "\n";
textToCopy += "Total Lease Payments Value: " + totalPayments + "\n";
textToCopy += "Present Value of Residual Value: " + pvResidual + "\n";
textToCopy += "Implied Interest Rate per Period: " + ratePerPeriod + "\n\n";
textToCopy += assumptions;
navigator.clipboard.writeText(textToCopy).then(function() {
// Success feedback (optional)
alert('Results copied to clipboard!');
}, function(err) {
// Error feedback (optional)
console.error('Could not copy text: ', err);
alert('Failed to copy results.');
});
}
// Initial calculation on page load with default values
document.addEventListener('DOMContentLoaded', function() {
resetForm(); // Sets default values and clears results/errors
// Trigger calculation after setting defaults
var pmt = parseFloat(document.getElementById('leasePayment').value);
var n = parseInt(document.getElementById('numberOfPeriods').value);
var rv = parseFloat(document.getElementById('leaseResidualValue').value);
var pv = parseFloat(document.getElementById('presentValueOrCost').value);
if (pmt > 0 && n > 0 && pv > 0) {
calculateWeightedAverageDiscountRate();
} else {
// Ensure the initial state is clean if defaults aren't sufficient for calculation
document.getElementById('weightedAverageDiscountRate').textContent = '–';
document.getElementById('totalLeasePaymentsValue').textContent = '–';
document.getElementById('pvResidualValue').textContent = '–';
document.getElementById('impliedRatePerPeriod').textContent = '–';
}
});