finish README
[AGH_fortran_course_solution3.git] / run.sh
blob848ea90f7e847c9cb6daae4cbec43ba03603a12e
1 #!/bin/bash
3 # Copyright 2019 Wojciech Kosior
5 # This is free and unencumbered software released into the public domain.
7 # Anyone is free to copy, modify, publish, use, compile, sell, or
8 # distribute this software, either in source code form or as a compiled
9 # binary, for any purpose, commercial or non-commercial, and by any
10 # means.
12 # In jurisdictions that recognize copyright laws, the author or authors
13 # of this software dedicate any and all copyright interest in the
14 # software to the public domain. We make this dedication for the benefit
15 # of the public at large and to the detriment of our heirs and
16 # successors. We intend this dedication to be an overt act of
17 # relinquishment in perpetuity of all present and future rights to this
18 # software under copyright law.
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 # OTHER DEALINGS IN THE SOFTWARE.
28 # For more information, please refer to <http://unlicense.org/>
30 if [ -z "$1" ]; then echo "please pass number of images"; exit; fi
32 COMMAND="cafrun -np $1 ./integrator"
34 QUADRATURE_TYPES="newton-cotes gauss"
36 FUNCTIONS="exp sin poly"
38 # for simplicity always use the same
39 IBEG="-0.5"
40 IEND="1"
42 SUBINTERVALS="1 4 16 64 128"
44 VALID_POLY_ORDERS="0 1 2"
46 echo "\
47 # results of numerical integration of three different functions
48 # (exp, sin and some 10 degree polynomial) on [$IBEG; $IEND] interval
50 #FUNC ___QUAD_TYPE POLY_ORDER SUBINTERVALS _______COMPUTED_VALUE __________VALUE_ERROR"
53 for FUNC in $FUNCTIONS; do
54 echo -n "# function $FUNC; exact integral:"
55 $COMMAND analytical $FUNC $IBEG $IEND
57 for TYPE in $QUADRATURE_TYPES; do
58 for N in $SUBINTERVALS; do
59 for P in $VALID_POLY_ORDERS; do
60 printf "%5s %12s %10s %12s " $FUNC $TYPE $P $N
61 $COMMAND $TYPE $FUNC $IBEG $IEND $P $N
62 done
63 done
64 done
65 done