Monday, May 19, 2025

Final Value Approximation Method

A new method that performs approximation of a curve depending on an initial point. Which is further related to the Initial Value Problem. 300 years ago Euler wrote an approximation method and

300 years later you get to see the FVAM

Git link for the html code on final value approximation method or follow this procedure

create a  fvam.html file

copy the entire html code given below the figure and  paste it into fvam.html file

run the html file .

It will load the curve to a new browser tab. Here you see the completely new step function 'h' that is mathematically derived after months of study and implemented into the code for verifying the fit to the curve. It wasn't an easy task.

Euler's work would have stayed incomplete if this wasn't done. As it was thought that his method was worst with increasing error in each iteration.

You can read more on this in the book, "Fundamental Structure of the Universe by Wasiful Alam"

Here the green dots are exact final value approximation of the red curve. Equation of the curve is in the top-right corner, click the picture to enlarge it







<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Modified Euler Method Plot</title>

    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>

</head>

<body>


<div id="plot" style="width: 100%; height: 100%;"></div>


<script>

// Euler method parameters

let x0 = 0;

let y0 = 1;

let num_steps = 20;

let a = 0.02; // Guessed neighborhood value


// Arrays to store x and y values for Euler's method

let x_values = [x0];

let y_values = [y0];

let x_values_modified = [x0];

let y_values_modified = [y0];



// Modified Euler's method with variable step size h = (x_n - a) / n

for (let i = 0; i < num_steps; i++) {

    let h = (x_values_modified[x_values_modified.length - 1] - a) / (i + 1);

    let y_new = y_values_modified[y_values_modified.length - 1] + h * (-2 * y_values_modified[y_values_modified.length - 1]);

    let x_new = x_values_modified[x_values_modified.length - 1] + h;

    x_values_modified.push(x_new);

    y_values_modified.push(y_new);

}



let x_exact = [];

let y_exact = [];

for (let i = 0; i <= 100; i++) {

    let x = i * 2 / 100;

    x_exact.push(x);

    y_exact.push(Math.exp(-2 * x));

}


let modified_trace = {

    x: x_values_modified,

    y: y_values_modified,

    mode: 'lines+markers',

    name: 'Modified Final Value Approximation',

    marker: { color: 'green' }

};



let exact_trace = {

    x: x_exact,

    y: y_exact,

    mode: 'lines',

    name: 'Exact Solution y(x) = e^(-2x)',

    line: { color: 'red' }

};


let layout = {

    title: 'Modified Final Value Approximation method',

    xaxis: { title: 'x' },

    yaxis: { title: 'y' }

};


Plotly.newPlot('plot', [modified_trace, exact_trace], layout);

</script>


</body>

</html>

Final Value Approximation Method

A new method that performs approximation of a curve depending on an initial point. Which is further related to the Initial Value Problem. 30...