Navigation

Operators and Keywords

Function List:

C++ API

Demonstration 1

The following code


  clc; input("  Please press 'Enter' to continue. ","s"); 
 %
  clc; disp(" ");
 %
  W$=["  Needs four inputs: the order, the lower and upper"];
  W$=[W$,[" bounds, and the integrand function type.\n"]];
  X$=["  To add 1% noise, add 0.5 to the integer function number, e.g. 2.5.\n"];
    disp(W$);
    disp("\n  The integrand function types are:\n");
    disp("    1. x^ord");
    disp("    2. exp(ord*x)");
    disp("    3. exp(ord*x^2)");
    disp("    4. sin(ord*x)");
    disp("    5. 1/(ord^2 + x^2)\n");
    disp(X$);
 %
  disp(" "); ord=input("  Enter the order: ");
 %  
  xl=input("  Enter the lower limit: ");
  xu=input("  Enter the upper limit: ");
  if xu

Produces the following output

Please press 'Enter' to continue. 
 
  Needs four inputs: the order, the lower and upper bounds, and the integrand function type.


  The integrand function types are:

    1. x^ord
    2. exp(ord*x)
    3. exp(ord*x^2)
    4. sin(ord*x)
    5. 1/(ord^2 + x^2)

  To add 1% noise, add 0.5 to the integer function number, e.g. 2.5.

 
  Enter the order: 1
  Enter the lower limit: 2
  Enter the upper limit: 5
  Enter the integrand function type: 2
 
   e^(1*x) on (2,5) 
      #.##e-014 is just numerical noise.

     Points =      2    I =   2.3370e+02    % RelErr =   6.6e+01
     Points =      3    I =   1.4413e+02    % RelErr =   2.2e+00
     Points =      4    I =   1.4244e+02    % RelErr =   1.0e+00
     Points =      5    I =   1.4106e+02    % RelErr =   2.9e-02
     Points =      6    I =   1.4105e+02    % RelErr =   1.6e-02
     Points =      7    I =   1.4102e+02    % RelErr =   3.1e-04
     Points =      8    I =   1.4102e+02    % RelErr =   1.9e-04
     Points =      9    I =   1.4102e+02    % RelErr =   2.6e-06
     Points =     10    I =   1.4102e+02    % RelErr =   1.7e-06
     Points =     11    I =   1.4102e+02    % RelErr =   1.6e-08
     Points =     12    I =   1.4102e+02    % RelErr =   2.0e-07
     Points =     13    I =   1.4102e+02    % RelErr =   7.8e-08
     Points =     14    I =   1.4102e+02    % RelErr =   3.4e-08
     Points =     15    I =   1.4102e+02    % RelErr =   1.6e-08
     Points =     16    I =   1.4102e+02    % RelErr =   7.6e-09
     Points =     17    I =   1.4102e+02    % RelErr =   3.9e-09
     Points =     18    I =   1.4102e+02    % RelErr =   2.1e-09
     Points =     19    I =   1.4102e+02    % RelErr =   1.1e-09
     Points =     20    I =   1.4102e+02    % RelErr =   6.5e-10
     Points =     21    I =   1.4102e+02    % RelErr =   3.8e-10
     Points =     22    I =   1.4102e+02    % RelErr =   2.3e-10
     Points =     23    I =   1.4102e+02    % RelErr =   1.4e-10
     Points =     24    I =   1.4102e+02    % RelErr =   8.9e-11
     Points =     25    I =   1.4102e+02    % RelErr =   5.7e-11
     Points =     26    I =   1.4102e+02    % RelErr =   3.7e-11
     Points =     27    I =   1.4102e+02    % RelErr =   2.5e-11
     Points =     28    I =   1.4102e+02    % RelErr =   1.7e-11
     Points =     29    I =   1.4102e+02    % RelErr =   1.1e-11
     Points =     30    I =   1.4102e+02    % RelErr =   7.9e-12
     Points =     31    I =   1.4102e+02    % RelErr =   5.6e-12
     Points =     32    I =   1.4102e+02    % RelErr =   3.9e-12
     Points =     33    I =   1.4102e+02    % RelErr =   2.8e-12
     Points =     34    I =   1.4102e+02    % RelErr =   2.1e-12
     Points =     35    I =   1.4102e+02    % RelErr =   1.5e-12
     Points =     36    I =   1.4102e+02    % RelErr =   1.1e-12
     Points =     37    I =   1.4102e+02    % RelErr =   8.0e-13
     Points =     38    I =   1.4102e+02    % RelErr =   6.2e-13
     Points =     39    I =   1.4102e+02    % RelErr =   4.7e-13
     Points =     50    I =   1.4102e+02    % RelErr =   2.2e-14
     Points =    100    I =   1.4102e+02    % RelErr =   0.0e+00
     Points =    200    I =   1.4102e+02    % RelErr =  -2.2e-14
     Points =    500    I =   1.4102e+02    % RelErr =   0.0e+00
     Points =   1000    I =   1.4102e+02    % RelErr =  -2.2e-14
     Points =  10000    I =   1.4102e+02    % RelErr =   0.0e+00
     Points = 100000    I =   1.4102e+02    % RelErr =  -2.2e-14

Package: integration