1. Name the standard method for numerically solving ordinary differential equations.
    The Runge-Kutta Method.
  2. Approximate f′(4) from the following table using the central difference scheme.
    x 1 2 3 4 5 6 7
    f(x)-1 3 2 5 4 7 9

    f(5) − f(3)

    2 ×1
    = 4 − 2

    2
    = 1.
  3. Solve the following equations using the Cramer's rule.
    a x + a2 y = c
    b x + b2 y = c2

    x = c b2c2 a2

    a b2a2 b
    ,     y = a c2b c

    a b2a2 b
    .
  4. Obtain y(t) at t = 0.2 for
    dy

    dt
    = − y+t,     y(0) = 1,
    using the Euler method with h (step size) = 0.1.

    y1 = y0 + 0.1×(−1 + 0) = 0.9,    y2 = 0.9 + 0.1 ×(−0.9 + 0.1) = 0.82.
  5. Translate the following Matlab/Octave code to C.
    sum=0;
    n=input('Enter a number=');
    for i=1:3:2*n
    sum=sum+(-1)^i/(2*i);
    end;
    fprintf('%f\n', sum);
    
    
    (Solution)
    float sum=0.0;
    printf("Enter a number =");
    scanf("%d", &n);
    for (i=1; i<=2*n; i=i+3) sum=sum+pow(-1,i)/(2*i);
    printf("%f\n", sum);
    
    
  6. What condition of f(x) makes numerical integral unstable ? Cite an example in which numerical integration yields rather poor convergence.
    When y, y′, y" … become singular. Example: √{ 1− x2} from 0 to 1.
  7. Translate the following C code to FORTRAN.
    sum=0.0;
    for (i=1;i<30;i=i+2) sum+=1/(2*i+1);
    
    
          sum = 0.0
          do 200 i=1, 29, 2
              sum=sum+1.0/(2.0*float(i)+1.0)
     200  continue
    
    
  8. Why is Cramer's rule inappropriate for a large set of simultaneous equations ?
    The number of multiplications is approximately proportional to n!. When n=10, n! is 3 million.
  9. Why would people still use FORTRAN ?
    1) Inertia 2) Legacy code 3) Compiler optimized (fast)
  10. Compute the following determinant.




    1
    4
    −3
    2
    3
    12
    3
    −4
    2




    233.
  11. What is a function m-file in Octave/Matlab ?
    See the lecture note. Function m-files are user-defined functions.
  12. Manually integrate the following

    1

    0 
    1

    1+x2
    dx
    by the trapezoidal rule. Choose h = 0.5.


    1 + 4

    5

    × 1

    2

    2
    +

    4

    5
    + 1

    2

    × 1

    2

    2
    = 31

    40
    = 0.775.
    The analytical solution is


    1

    0 
    1

    1 + x2
    d x = π

    4
     ∼ 0.7854.



File translated from TEX by TTH, version 4.03.
On 28 Jul 2025, 18:07.