Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, April 19, 2024

File: [Platon] / doc / diplomova-praca-rajo / scripts / chyba-MC.awk (download)

Revision 1.1, Thu Jul 24 17:50:08 2003 UTC (20 years, 9 months ago) by rajo

Diploma Thesis of Lubomir Host.
Title: Metoda Monte Carlo vo fyzike nizkoteplotnej plazmy. (Slovak language)

#!/usr/bin/awk -f

function fabs(x)
{
    if (x < 0)
        return -x;
    return x;
}

BEGIN {
    lines = 0;
    error = 0;
    pi    = 3.14159265358979323846;
    avg   = sqrt(2 / pi);
}

NF == 6 {
    if ($2 >= 10.0) {
#printf "OK: %s\n", $0;
        error += fabs($6 - avg);
        lines++;
    }
    
    next;
}

#// {
#    print;
#    next;
#}

END {
    gsub(/^.*N=/, "", FILENAME);
    gsub(/\.dat$/, "", FILENAME);
    printf "%s    %g\n", FILENAME, error / (lines * avg);
}

# vim: cindent


Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top