The Question is: Construct a computer program that uses both the secant method and the Runge-Kutta method to obtain a numerical solution to the two-point boundary-value
problem:

```none
x' = f(t,x) = x + 0.09 x ^2 + cos(10 t)    differential equation

x(0) + x(1) - 3.0 = 0                      boundary condition

```

Starting with the initial guesses 0.7 and 1.0 for the (unknown) initial value, `x(0)`, obtain an
approximation to `x(0)` {for the final solution, `x(t)`} such that the boundary condition is satisfied
to within a tolerance of 10-4.

Use a fixed step size of 0.025 (i.e., take 40 steps each time you integrate the differential
equation from `t=0` to `t=1`).

Write your program so that the output shows the values of `x(0)`, `x(1)`, and `x(0)+x(1)-3` (the error
in satisfying the boundary condition) at the end of each iteration of the secant method. After the
last iteration of the secant method, re-integrate from `t=0` to `t=1` and print out the solution for
`x(t)` over the range `[0,1]`.

**Why is the code having problems at
"return x + Math.sqrt(0.09\*2)+ cos(10t);" at the top of the code?**

```
package rungekutta1;

public class RungeKutta1 
{
  // The number of steps to use in the interval
  public static int STEPS = 100;
  // The derivative dy/dx at a given value of x and y.
  public static double deriv(double x, double y)
  {
    return x + Math.sqrt(0.09*2)+ cos(10t);
  }
  // The `main' method does the actual computations
  public static void main(String[] argv)
  {
    // `h' is the size of each step.
    double h = 1.0 / STEPS;
    double k1, k2, k3, k4;
    double x, y;
    int i;
    // Computation by Euclid's method
    // Initialize y
    y = 0;
    for (i=0; i<STEPS; i++)
    {
      // Step through, updating x and incrementing y
      x = i * h;
      y += h * deriv(x, y);
    }

    // Print out the result that we get.
    System.out.println("Using the Euler method "
        + "The value at x=1 is:");
    System.out.println(y);
    // Computation by 4th order Runge-Kutta
    // Initialize y
    y = 0;
    for (i=0; i<STEPS; i++)
    {
      // Step through, updating x
      x = i * h;
      // Computing all of the trial values
      k1 = h * deriv(x, y);
      k2 = h * deriv(x + h/2, y + k1/2);
      k3 = h * deriv(x + h/2, y + k2/2);
      k4 = h * deriv(x + h, y + k3);
      // Incrementing y
      y += k1/6 + k2/3+ k3/3 + k4/6;
    }
    // Print out the result that we get.
    System.out.println();
    System.out.println("Using 4th order Runge-Kutta "
        + "The value at x=1 is:");
    System.out.println(y);
    // Computation by closed form solution
    // Print out the result that we get.
    System.out.println();
    System.out.println("The value really is:");
    y = (Math.exp(0.5) - Math.exp(-0.5)) / 2;
    System.out.println(y);
  }
}

```