Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include \"StdAfx.h\" #include \"iostream\" #include \"iomanip\" using namespace

ID: 3569080 • Letter: #

Question

#include "StdAfx.h"
#include "iostream"
#include "iomanip"

using namespace std;
using std::cout;
using std::endl;
using std::cin;
using std::setw;

#define ErrorTolerance   0.0001
#define MaxSteps       40

void Secant(double a, double b);
double rungekutta3(double t);
double f(double t, double x);
double g(double x);

void main()
{
       // Initialize guesses 0.7 and 1.0
double g1 = 0.7;
double g2 = 1.0;

Secant(g(g1), g(g2));

       //Press key function to terminate the program.
       cout << " Press Any Key to Exit..." << endl;
cin.get();
}

double rungekutta3 (double x0)
{
       double h = 0.025; // Initialize step size = 0.025.
double x1, x2, x3; // Runge-Kutta orders.   
  
       double t0 = 0.0;   

       //alpha
       double a1 = 1.0 / 2.0;
double a2 = 1.0;

       //beta
       double b10 = 1.0/2.0;   
double b20 = -1.0;
double b21 = 2.0;

       //weights
double c0 = 1.0 / 6.0;
double c1 = 4.0 / 6.0;
double c2 = 1.0 / 6.0;

       // Define y values.
double y[200];   
      
       y[0] = 0;

int i = 0;
      
       cout << " h f(t,x) x1 x2 x3 y" << endl;
  
for (t0 = 0.0; t0 <= 1.0; t0 = t0 + h)
{
i=i+1;
  
//Calculate to 3rd orders of Runge-Kutta.
x1 = x0 + h * (b10 * f(t0,x0));
x2 = x0 + h * (b20 * f(t0,x0) + b21 * f(t0 + a1 * h, x0));
x3 = x0 + h * (c0 * f(t0,x0) + c1 * f(t0 + a1 * h, x0) + c2 * f(t0 + a2 * h, x0));
  
//Calculate y.
y[i] = y[i-1] + (1.00/6.00)*(c0*x1 + c1*x2 + c2*x3)*h;

cout << std::setprecision(4) << t0 << " " << std::setprecision(8) << f(t0,x0) << " " << x1 << " " << x2 << " " << x3 << " " << y[i] << " " << endl;

//Set step forward.
x0 = x3;
}

                       return x3;
}

//Method to return f(t,x) values.
double f(double t, double x)
{
return (x + 0.09*pow(x,2) + cos(10*t));   
}

// Method to return the guess values.
double g(double x)
{
return (x + rungekutta3(x) - 3.0);
}

//Secant method.
void Secant(double a, double b)
{
int i;
double fa, fb, d, m;
fa = g(a);
fb = g(b);
      
       //Print out the values of initial guesses and values of the guessed function.
cout << "x(0) = " << std::setprecision(6) << fa << " x(1) = " << std::setprecision(6) << fb << " x(0) + x(1) - 3 = " << std::setprecision(6) << fa + fb << endl;

//Loop runs 40 times.
for (i = 2; i <= MaxSteps; i++)
{
  
//Calculate d and f(b).
d = (b - a)/(fb - fa);
b = a;
fb = fa;

//Calculate new d.
d = d * fa;
m = 3 - a;

               //Function to check if error tolerance is smaller than 10^-4 or 0.001, then print out the value.
if (fabs(d) < ErrorTolerance)
{
cout << "x(0) = " << std::setw(4) << a << " x(1) = " << std::setw(4) << m << " x(0) + x(1) - 3.0 = " << std::setw(4)<< (a + m) - 3.0 << endl;
cout << " Value is found at: " << a << " and satisfied to within a tolerance of " << ErrorTolerance << endl;
return;
}

//Calculate new a and f(a).
a = a - d;
fa = g(a);

//Print out current values.
cout << "x(0) = " << std::setw(4) << a << " x(1) = " << std::setw(4) << b << " x(0) + x(1) - 3 = " << std::setw(4) << 2*(a + b) - 3.0 << endl;
}
}

Explanation / Answer

To convert the program from C to Java the following statements are need to be changed as follows:

Program Code:

//CtoJava.java

class CtoJava

{

     //define the static constants

     final static double ErrorTolerance=0.0001;

     final static int MaxSteps= 40;

     //Secant method

     static void Secant(double a, double b)

     {

          int i;

          double fa, fb, d, m;

          fa = g(a);

          fb = g(b);

          //the setpercision() is replaced with %.(numberofdecimal points)f

          //Print out the values of initial guesses and values of the guessed function.

          System.out.printf("x(0) = %.6f   x(1) = %.6f   x(0) + x(1) - 3 = %.6f ",fa,fb,fa + fb);

          //Loop runs 40 times.

          for (i = 2; i <= MaxSteps; i++)

          {

              //Calculate d and f(b).

              d = (b - a)/(fb - fa);

              b = a;

              fb = fa;

              //Calculate new d.

              d = d * fa;

              m = 3 - a;

              //Function to check if error tolerance is smaller than 10^-4 or 0.001, then print out the value.

              if (Math.abs(d)< ErrorTolerance)

              {

                   //the setw() is replaced with %(spaces)f

                   System.out.printf("x(0) = %4f x(1) = %4f x(0) + x(1) - 3.0 = %4f ",a,m,(a + m) - 3.0 );

                   System.out.printf(" Value is found at: %f and satisfied to within a tolerance of %f" ,a,ErrorTolerance );

                   return;

              }

              //Calculate new a and f(a).

              a = a - d;

              fa = g(a);

              //Print out current values.

              System.out.printf("x(0) = %4f x(1) = %4f x(0) + x(1) - 3 = %4f ",a,b, 2*(a + b) - 3.0);

          }

     }

   

     //rungekutta3 method

     static double rungekutta3(double x0)

     {

          double h = 0.025; // Initialize step size = 0.025.

          double x1, x2, x3=0; // Runge-Kutta orders.

          double t0 = 0.0;

          //alpha

          double a1 = 1.0 / 2.0;

          double a2 = 1.0;

          //beta

          double b10 = 1.0/2.0;

          double b20 = -1.0;

          double b21 = 2.0;

          //weights

          double c0 = 1.0 / 6.0;

          double c1 = 4.0 / 6.0;

          double c2 = 1.0 / 6.0;

          // Define y values.

          double y[]=new double[200];

          y[0] = 0;

          int i = 0;

          //declare a char of single blank space

          char s=' ';

          //in the printf statement specify how many spaces are

          //required and print the character(eg. %5s=>5 spaces followed by blank space)

          //as shown in the below code

          System.out.printf(" h %8s f(t,x) %8s x1 %11s x2 %12s x3 %12s y",s,s, s, s, s);

          System.out.println();

          for (t0 = 0.0; t0 <= 1.0; t0 = t0 + h)

          {

              i=i+1;

              //Calculate to 3rd orders of Runge-Kutta.

              x1 = x0 + h * (b10 * f(t0,x0));          

              x2 = x0 + h * (b20 * f(t0,x0) + b21 * f(t0 + a1 * h, x0));

              x3 = x0 + h * (c0 * f(t0,x0) + c1 * f(t0 + a1 * h, x0) + c2 * f(t0 + a2 * h, x0));

              //Calculate y.

              y[i] = y[i-1] + (1.00/6.00)*(c0*x1 + c1*x2 + c2*x3)*h;

              //the setpercision() is replaced with %.(numberofdecimal points)f

              System.out.printf("%.4f %.8f %f %f %f %f ",t0, f(t0,x0),x1, x2,x3, y[i]);

              //Set step forward.

              x0 = x3;

          }

          return x3;

     }

   

     //f method

     static double f(double t, double x)

     {

          return (x + 0.09*Math.pow(x,2) + Math.cos(10*t));

     }

   

     //g method

     static double g(double x)

     {

          System.out.println(x + rungekutta3(x) - 3.0);

        

          return x + rungekutta3(x) - 3.0;

     }

   

     //main method

     public static void main(String args[])

     {

          // Initialize guesses 0.7 and 1.0

          double g1 = 0.7;

          double g2 = 1.0;

          double gg1=g(g1);

          double gg2=g(g2);

          Secant(gg1, gg2);

     }

}

Sample Output:

h          f(t,x)           x1             x2              x3              y

0.0000    1.74410000 0.721801     0.743212     0.743343     0.003082

0.0250    1.76198564 0.765368     0.785472     0.786372     0.006341

0.0500    1.71960879 0.807867     0.826031     0.827644     0.009772

0.0750    1.62098233 0.847906     0.863634     0.865860     0.013361

0.1000    1.47363599 0.884280     0.897244     0.899944     0.017092

0.1250    1.28815759 0.916046     0.926109     0.929116     0.020946

0.1500    1.07754650 0.942586     0.949809     0.952936     0.024901

0.1750    0.85641720 0.963641     0.968282     0.971333     0.028934

0.2000    0.64010033 0.979334     0.981830     0.984617     0.033025

0.2250    0.44369569 0.990163     0.991104     0.993454     0.037156

0.2500    0.28113545 0.996968     0.997064     0.998829     0.041312

0.2750    0.16431644 1.000883     1.000919     1.001991     0.045483

0.3000    0.10235693 1.003270     1.004056     1.004368     0.049666

0.3250    0.10102619 1.005631     1.007956     1.007488     0.053864

0.3500    0.16238418 1.009518     1.014100     1.012881     0.058085

0.3750    0.28465535 1.016439     1.023881     1.021987     0.062345

0.4000    0.46234501 1.027767     1.038519     1.036068     0.066663

0.4250    0.68659030 1.044651     1.058986     1.056131     0.071063

0.4500    0.94572265 1.067953     1.085950     1.082868     0.075574

0.4750    1.22600437 1.098193     1.119733     1.116615     0.080222

0.5000    1.51249163 1.135521     1.160294     1.157335     0.085037

0.5250    1.78996816 1.179709     1.207238     1.204621     0.090047

0.5500    2.04389094 1.230170     1.259840     1.257728     0.095274

0.5750    2.26128931 1.285994     1.317093     1.315617     0.100739

0.6000    2.43156310 1.346011     1.377773     1.377025     0.106457

0.6250    2.54713231 1.408864     1.440520     1.440547     0.112437

0.6500    2.60390055 1.473096     1.503923     1.504722     0.118683

0.6750    2.60150574 1.537241     1.566606     1.568129     0.125191

0.7000    2.54334398 1.599921     1.627323     1.629475     0.131954

0.7250    2.43636567 1.659929     1.685031     1.687678     0.138959

0.7500    2.29065590 1.716311     1.738962     1.741938     0.146191

0.7750    2.11882365 1.768423     1.788668     1.791790     0.153632

0.8000    1.93523554 1.815980     1.834060     1.837133     0.161264

0.8250    1.75513977 1.859072     1.875410     1.878243     0.169069

0.8500    1.59373294 1.898165     1.913344     1.915760     0.177032

0.8750    1.46522711 1.934076     1.948801     1.950652     0.185143

0.9000    1.38197512 1.967926     1.982987     1.984156     0.193396

0.9250    1.35371003 2.001078     2.017299     2.017714     0.201790

0.9500    1.38694728 2.035051     2.053245     2.052880     0.210333

0.9750    1.48458902 2.071438     2.092356     2.091234     0.219036

h          f(t,x)           x1             x2              x3              y

0.0000    2.09000000 1.026125     1.051860     1.051990     0.004365

0.0250    2.12050440 1.078497     1.103083     1.103982     0.008945

0.0500    2.09125493 1.130123     1.152933     1.154546     0.013734

0.0750    2.00620224 1.179623     1.200166     1.202392     0.018722

0.1000    1.87281107 1.225802     1.243756     1.246456     0.023894

0.1250    1.70160679 1.267726     1.282957     1.285964     0.029231

0.1500    1.50553439 1.304783     1.317357     1.320483     0.034713

0.1750    1.29916764 1.336723     1.346898     1.349949     0.040320

0.2000    1.09781528 1.363672     1.371889     1.374676     0.046033

0.2250    0.91657848 1.386133     1.392985     1.395335     0.051834

0.2500    0.76941738 1.404952     1.411152     1.412918     0.057710

0.2750    0.66828544 1.421271     1.427606     1.428678     0.063655

0.3000    0.62238656 1.436458     1.443744     1.444056     0.069666

0.3250    0.63760321 1.452026     1.461058     1.460591     0.075747

0.3500    0.71613309 1.469542     1.481046     1.479827     0.081909

0.3750    0.85635813 1.490532     1.505119     1.503226     0.088169

0.4000    1.05295465 1.516388     1.534523     1.532073     0.094549

0.4250    1.29723716 1.548288     1.570257     1.567402     0.101074

0.4500    1.57771301 1.587123     1.613020     1.609938     0.107775

0.4750    1.88081116 1.633448     1.663173     1.660055     0.114682

0.5000    2.19173770 1.687452     1.720716     1.717756     0.121827

0.5250    2.49540311 1.748948     1.785296     1.782678     0.129238

0.5500    2.77736287 1.817395     1.856234     1.854122     0.136944

0.5750    3.02471330 1.891931     1.932572     1.931096     0.144967

0.6000    3.22688843 1.971432     2.013136     2.012388     0.153326

0.6250    3.37631067 2.054592     2.096613     2.096639     0.162032

0.6500    3.46885761 2.140000     2.181639     2.182439     0.171094

0.6750    3.50411825 2.226240     2.266888     2.268411     0.180512

0.7000    3.48542462 2.311978     2.351157     2.353308     0.190283

0.7250    3.41965757 2.396054     2.433447     2.436093     0.200398

0.7500    3.31683824 2.477554     2.513032     2.516008     0.210847

0.7750    3.18952947 2.555877     2.589506     2.592628     0.221615

0.8000    3.05208222 2.630779     2.662819     2.665892     0.232690

0.8250    2.91977195 2.702389     2.733285     2.736118     0.244059

0.8500    2.80787692 2.771217     2.801572     2.803989     0.255713

0.8750    2.73075510 2.838123     2.868668     2.870518     0.267646

0.9000    2.70097693 2.904281     2.935829     2.936998     0.279858

0.9250    2.72856916 2.971105     3.004513     3.004927     0.292354

0.9500    2.82041820 3.040183     3.076295     3.075930     0.305146

0.9750    2.97987175 3.113179     3.152789     3.151666     0.318254

h          f(t,x)           x1             x2              x3              y

0.0000    0.79515674 -0.198826    -0.189277    -0.189146    -0.000795

0.0250    0.78298590 -0.179359    -0.171492    -0.170592    -0.001515

0.0500    0.70960935 -0.161722    -0.156183    -0.154570    -0.002168

0.0750    0.57926880 -0.147329    -0.144623    -0.142398    -0.002771

0.1000    0.39972964 -0.137401    -0.137861    -0.135161    -0.003343

0.1250    0.18180597 -0.132888    -0.136654    -0.133647    -0.003908

0.1500    -0.06130266 -0.134414    -0.141426    -0.138299    -0.004490

0.1750    -0.31482397 -0.142235    -0.152234    -0.149183    -0.005115

0.2000    -0.56332647 -0.156224    -0.168772    -0.165985    -0.005808

0.2250    -0.79167860 -0.175881    -0.190382    -0.188032    -0.006590

0.2500    -0.98599387 -0.200357    -0.216100    -0.214335    -0.007478

0.2750    -1.13450254 -0.228516    -0.244716    -0.243644    -0.008485

0.3000    -1.22829373 -0.258998    -0.274845    -0.274533    -0.009619

0.3250    -1.26187945 -0.290306    -0.305018    -0.305486    -0.010880

0.3500    -1.23354327 -0.320905    -0.333772    -0.334991    -0.012263

0.3750    -1.14545019 -0.349309    -0.359744    -0.361637    -0.013756

0.4000    -1.00351023 -0.374181    -0.381752    -0.384202    -0.015343

0.4250    -0.81700476 -0.394415    -0.398874    -0.401729    -0.017004

0.4500    -0.59800034 -0.409204    -0.410503    -0.413586    -0.018716

0.4750    -0.36058877 -0.418093    -0.416386    -0.419504    -0.020454

0.5000    -0.12000294 -0.421004    -0.416637    -0.419596    -0.022195

0.5250    0.10833472 -0.418242    -0.411733    -0.414351    -0.023917

0.5500    0.30977097 -0.410478    -0.402485    -0.404597    -0.025601

0.5750    0.47132839 -0.398705    -0.389981    -0.391457    -0.027233

0.6000    0.58250465 -0.384176    -0.375527    -0.376275    -0.028804

0.6250    0.63591679 -0.368326    -0.360560    -0.360533    -0.030312

0.6500    0.62775276 -0.352687    -0.346562    -0.345762    -0.031760

0.6750    0.55800407 -0.338787    -0.334966    -0.333443    -0.033157

0.7000    0.43046615 -0.328062    -0.327071    -0.324919    -0.034519

0.7250    0.25250658 -0.321763    -0.323959    -0.321313    -0.035865

0.7500    0.03461445 -0.320880    -0.326430    -0.323453    -0.037220

0.7750    -0.21024292 -0.326081    -0.334950    -0.331828    -0.038607

0.8000    -0.46741838 -0.337671    -0.349624    -0.346552    -0.040053

0.8250    -0.72149074 -0.355570    -0.370190    -0.367357    -0.041583

0.8500    -0.95722322 -0.379322    -0.396030    -0.393614    -0.043220

0.8750    -1.16051538 -0.408120    -0.426216    -0.424366    -0.044982

0.9000    -1.31928834 -0.440857    -0.459562    -0.458393    -0.046883

0.9250    -1.42424676 -0.476196    -0.494699    -0.494284    -0.048932

0.9500    -1.46946754 -0.512652    -0.530163    -0.530528    -0.051129

0.9750    -1.45277650 -0.548688    -0.564486    -0.565608    -0.053470

h          f(t,x)           x1             x2              x3              y

0.0000    2.27103656 1.180054     1.208052     1.208183     0.005014

0.0250    2.30846863 1.237039     1.263974     1.264874     0.010263

0.0500    2.28644789 1.293454     1.318704     1.320317     0.015741

0.0750    2.20889694 1.347928     1.371005     1.373230     0.021439

0.1000    2.08325106 1.399271     1.419855     1.422555     0.027343

0.1250    1.92000743 1.446555     1.464517     1.467524     0.033434

0.1500    1.73208698 1.489175     1.504580     1.507706     0.039695

0.1750    1.53404634 1.526882     1.539993     1.543045     0.046105

0.2000    1.34118680 1.559810     1.571068     1.573856     0.052645

0.2250    1.16861402 1.588463     1.598466     1.600815     0.059300

0.2500    1.03030649 1.613694     1.623155     1.624920     0.066058

0.2750    0.93825094 1.636648     1.646358     1.647430     0.072911

0.3000    0.90169989 1.658701     1.669479     1.669791     0.079860

0.3250    0.92659927 1.681373     1.694018     1.693550     0.086910

0.3500    1.01522362 1.706240     1.721483     1.720264     0.094071

0.3750    1.16604287 1.734840     1.753299     1.751405     0.101362

0.4000    1.37382951 1.768578     1.790724     1.788273     0.108807

0.4250    1.62999888 1.808648     1.834777     1.831921     0.116431

0.4500    1.92315995 1.855961     1.886176     1.883094     0.124267

0.4750    2.23984016 1.911092     1.945305     1.942187     0.132347

0.5000    2.56533720 1.974254     2.012187     2.009228     0.140702

0.5250    2.88464292 2.045286     2.086498     2.083881     0.149366

0.5500    3.18338139 2.123673     2.167587     2.165475     0.158365

0.5750    3.44870293 2.208584     2.254525     2.253049     0.167726

0.6000    3.67008031 2.298925     2.346168     2.345421     0.177469

0.6250    3.83995990 2.393420     2.441237     2.441263     0.187607

0.6500    3.95423002 2.490691     2.538397     2.539197     0.198151

0.6750    4.01248009 2.589353     2.636355     2.637878     0.209105

0.7000    4.01803628 2.688103     2.733939     2.736091     0.220466

0.7250    3.97777233 2.785813     2.830183     2.832829     0.232229

0.7500    3.90170702 2.881600     2.924389     2.927366     0.244386

0.7750    3.80241221 2.974896     3.016185     3.019307     0.256927

0.8000    3.69426630 3.065485     3.105553     3.108626     0.269842

0.8250    3.59259767 3.153533     3.192840     3.195673     0.283120

0.8500    3.51276990 3.239582     3.278749     3.281166     0.296756

0.8750    3.46926463 3.324532     3.364308     3.366158     0.310747

0.9000    3.47481959 3.409593     3.450815     3.451984     0.325098

0.9250    3.53967602 3.496230     3.539776     3.540191     0.339817

0.9500    3.67098422 3.586078     3.632823     3.632458     0.354921

0.9750    3.87240558 3.680863     3.731629     3.730507     0.370433

x(0) = -3.774374   x(1) = 1.882174   x(0) + x(1) - 3 = -1.892200

h          f(t,x)           x1             x2              x3              y

0.0000    1.74296601 0.720780     0.742177     0.742307     0.003078

0.0250    1.76081165 0.764318     0.784407     0.785307     0.006333

0.0500    1.71839328 0.806787     0.824936     0.826549     0.009758

0.0750    1.61972401 0.846795     0.862507     0.864733     0.013343

0.1000    1.47233378 0.883137     0.896085     0.898785     0.017069

0.1250    1.28681064 0.914870     0.924917     0.927923     0.020918

0.1500    1.07615417 0.941375     0.948581     0.951708     0.024868

0.1750    0.85497898 0.962395     0.967018     0.970070     0.028896

0.2000    0.63861581 0.978052     0.980529     0.983316     0.032982

0.2250    0.44216447 0.988843     0.989765     0.992114     0.037107

0.2500    0.27955704 0.995609     0.995685     0.997451     0.041257

0.2750    0.16269019 0.999484     0.999499     1.000572     0.045422

0.3000    0.10068192 1.001830     1.002595     1.002907     0.049599

0.3250    0.09930114 1.004148     1.006452     1.005984     0.053791

0.3500    0.16060737 1.007991     1.012551     1.011333     0.058006

0.3750    0.28282457 1.014868     1.022286     1.020393     0.062259

0.4000    0.46045752 1.026149     1.036877     1.034427     0.066570

0.4250    0.68464280 1.042985     1.057296     1.054441     0.070963

0.4500    0.94371128 1.066237     1.084210     1.081127     0.075466

0.4750    1.22392480 1.096426     1.117940     1.114822     0.080107

0.5000    1.51033907 1.133702     1.158448     1.155488     0.084915

0.5250    1.78773746 1.177835     1.205336     1.202719     0.089916

0.5500    2.04157668 1.228239     1.257880     1.255768     0.095135

0.5750    2.25888593 1.284004     1.315072     1.313596     0.100592

0.6000    2.42906500 1.343960     1.375690     1.374943     0.106302

0.6250    2.54453397 1.406749     1.438373     1.438400     0.112273

0.6500    2.60119663 1.470915     1.501708     1.502507     0.118509

0.6750    2.59869113 1.534991     1.564321     1.565844     0.125008

0.7000    2.54041389 1.597599     1.624964     1.627116     0.131761

0.7250    2.43331563 1.657532     1.682596     1.685243     0.138756

0.7500    2.28748177 1.713836     1.736447     1.739424     0.145978

0.7750    2.11552154 1.765868     1.786071     1.789193     0.153408

0.8000    1.93180173 1.813340     1.831377     1.834450     0.161028

0.8250    1.75157057 1.856345     1.872638     1.875471     0.168822

0.8500    1.59002454 1.895346     1.910479     1.912896     0.176773

0.8750    1.46137535 1.931163     1.945840     1.947691     0.184872

0.9000    1.37797533 1.964915     1.979926     1.981095     0.193112

0.9250    1.34955672 1.997965     2.014134     2.014549     0.201493

0.9500    1.38263400 2.031832     2.049973     2.049608     0.210022

0.9750    1.48010809 2.068109     2.088972     2.087850     0.218711

x(0) = 0.698993 x(1) = -0.208766 x(0) + x(1) - 3 = -2.019546

h          f(t,x)           x1             x2              x3              y

0.0000    1.80440209 0.775882     0.798047     0.798177     0.003310

0.0250    1.82442771 0.820983     0.841868     0.842768     0.006804

0.0500    1.78427320 0.865071     0.884043     0.885656     0.010475

0.0750    1.68793980 0.906755     0.923320     0.925546     0.014312

0.1000    1.54294507 0.944832     0.958663     0.961363     0.018299

0.1250    1.35986516 0.978361     0.989321     0.992328     0.022416

0.1500    1.15168918 1.006724     1.014874     1.018001     0.026641

0.1750    0.93302381 1.029663     1.035262     1.038313     0.030953

0.2000    0.71919518 1.047303     1.050787     1.053575     0.035331

0.2250    0.52530271 1.060141     1.062102     1.064451     0.039756

0.2500    0.36528285 1.069017     1.070165     1.071931     0.044216

0.2750    0.25104173 1.075069     1.076188     1.077260     0.048700

0.3000    0.19171195 1.079657     1.081560     1.081871     0.053205

0.3250    0.19308186 1.084285     1.087761     1.087293     0.057735

0.3500    0.25723470 1.090508     1.096276     1.095057     0.062298

0.3750    0.38242150 1.099838     1.108501     1.106608     0.066909

0.4000    0.56317632 1.113647     1.125660     1.123209     0.071589

0.4250    0.79066595 1.133093     1.148729     1.145874     0.076363

0.4500    1.05325093 1.159040     1.178381     1.175299     0.081257

0.4750    1.33722080 1.192014     1.214944     1.211826     0.086301

0.5000    1.62765574 1.232172     1.258385     1.255425     0.091524

0.5250    1.90935910 1.279292     1.308314     1.305697     0.096954

0.5500    2.16780225 1.332794     1.364013     1.361901     0.102614

0.5750    2.39002314 1.391776     1.424484     1.423008     0.108526

0.6000    2.56542417 1.455076     1.488511     1.487763     0.114704

0.6250    2.68642214 1.521343     1.554741     1.554767     0.121159

0.6500    2.74891225 1.589129     1.621768     1.622568     0.127894

0.6750    2.75251979 1.656975     1.688227     1.689750     0.134908

0.7000    2.70062538 1.723508     1.752876     1.755028     0.142193

0.7250    2.60016282 1.787530     1.814679     1.817326     0.149737

0.7500    2.46120137 1.848091     1.872873     1.875850     0.157525

0.7750    2.29633700 1.904554     1.927017     1.930139     0.165541

0.8000    2.11992840 1.956638     1.977027     1.980099     0.173767

0.8250    1.94722289 2.004440     2.023179     2.026012     0.182186

0.8500    1.79342524 2.048430     2.066105     2.068522     0.190784

0.8750    1.67276617 2.089431     2.106751     2.108601     0.199551

0.9000    1.59762893 2.128572     2.146328     2.147497     0.208483

0.9250    1.57778915 2.167220     2.186242     2.186657     0.217579

0.9500    1.61981713 2.206905     2.228010     2.227645     0.226847

0.9750    1.72668134 2.249228     2.273173     2.272051     0.236302

x(0) = 0.753327 x(1) = 0.698993 x(0) + x(1) - 3 = -0.095360

h          f(t,x)           x1             x2              x3              y

0.0000    1.79784054 0.770019     0.792102     0.792233     0.003285

0.0250    1.81763206 0.814953     0.835753     0.836653     0.006754

0.0500    1.77723436 0.858868     0.877753     0.879366     0.010399

0.0750    1.68064993 0.900374     0.916847     0.919073     0.014209

0.1000    1.53539763 0.938265     0.952001     0.954702     0.018168

0.1250    1.35205487 0.971602     0.982464     0.985471     0.022256

0.1500    1.14361187 0.999766     1.007815     1.010942     0.026452

0.1750    0.92467613 1.022500     1.027994     1.031046     0.030734

0.2000    0.71057426 1.039928     1.043304     1.046092     0.035081

0.2250    0.51640572 1.052547     1.054397     1.056746     0.039474

0.2500    0.35610648 1.061197     1.062230     1.063996     0.043901

0.2750    0.24158163 1.067016     1.068017     1.069089     0.048351

0.3000    0.18196222 1.071364     1.073145     1.073456     0.052821

0.3250    0.18303450 1.075744     1.079095     1.078627     0.057315

0.3500    0.24687917 1.081713     1.087351     1.086132     0.061841

0.3750    0.37174435 1.090779     1.099309     1.097416     0.066414

0.4000    0.55216095 1.104318     1.116192     1.113742     0.071055

0.4250    0.77929252 1.123483     1.138978     1.136122     0.075788

0.4500    1.04149638 1.149141     1.168336     1.165254     0.080640

0.4750    1.32505910 1.181817     1.204595     1.201477     0.085641

0.5000    1.61505818 1.221665     1.247720     1.244761     0.090820

0.5250    1.89629480 1.268464     1.297323     1.294705     0.096204

0.5500    2.15423872 1.321633     1.352683     1.350571     0.101817

0.5750    2.37592688 1.380270     1.412801     1.411325     0.107680

0.6000    2.55076135 1.443210     1.476462     1.475714     0.113808

0.6250    2.67115920 1.509103     1.542310     1.542337     0.120212

0.6500    2.73301646 1.576499     1.608940     1.609740     0.126894

0.6750    2.73595974 1.643939     1.674985     1.676508     0.133852

0.7000    2.68337125 1.710050     1.739203     1.741354     0.141080

0.7250    2.58218652 1.773631     1.800556     1.803203     0.148566

0.7500    2.44247644 1.833734     1.858282     1.861258     0.156293

0.7750    2.27683832 1.889719     1.911939     1.915061     0.164247

0.8000    2.09963161 1.941306     1.961441     1.964513     0.172407

0.8250    1.92610363 1.988590     2.007065     2.009898     0.180759

0.8500    1.77145815 2.032041     2.049442     2.051858     0.189288

0.8750    1.64992375 2.072482     2.089517     2.091367     0.197984

0.9000    1.57388023 2.111041     2.128500     2.129669     0.206841

0.9250    1.55309845 2.149083     2.167797     2.168212     0.215861

0.9500    1.59414256 2.188139     2.208923     2.208558     0.225050

0.9750    1.69997361 2.229808     2.253419     2.252297     0.234422

x(0) = 0.747546 x(1) = 0.753327 x(0) + x(1) - 3 = 0.001746

x(0) = 0.747546 x(1) = 2.252454 x(0) + x(1) - 3.0 = 0.000000

Value is found at: 0.747546 and satisfied to within a tolerance of 0.000100