diff options
author | Samuel Niederer <43746162+samnied@users.noreply.github.com> | 2022-07-24 12:17:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-24 12:17:00 +0200 |
commit | efe7c35759afb5cbae3c1683873c5159be0be09f (patch) | |
tree | 84f2e8510132352f9943bddc577ccf32cd46f2dc /buch/chapters/040-rekursion/images/loggammaplot.m | |
parent | add current work (diff) | |
parent | Merge pull request #26 from p1mueller/master (diff) | |
download | SeminarSpezielleFunktionen-efe7c35759afb5cbae3c1683873c5159be0be09f.tar.gz SeminarSpezielleFunktionen-efe7c35759afb5cbae3c1683873c5159be0be09f.zip |
Merge branch 'AndreasFMueller:master' into master
Diffstat (limited to 'buch/chapters/040-rekursion/images/loggammaplot.m')
-rw-r--r-- | buch/chapters/040-rekursion/images/loggammaplot.m | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/buch/chapters/040-rekursion/images/loggammaplot.m b/buch/chapters/040-rekursion/images/loggammaplot.m new file mode 100644 index 0000000..5456e4f --- /dev/null +++ b/buch/chapters/040-rekursion/images/loggammaplot.m @@ -0,0 +1,43 @@ +# +# loggammaplot.m +# +# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +xmax = 10; +xmin = 0.1; +N = 500; + +fn = fopen("loggammadata.tex", "w"); + +fprintf(fn, "\\def\\loggammapath{\n ({%.4f*\\dx},{%.4f*\\dy})", + xmax, log(gamma(xmax))); +xstep = (xmax - 1) / N; +for x = (xmax:-xstep:1) + fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", x, log(gamma(x))); +endfor +for k = (0:0.2:10) + x = exp(-k); + fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", x, log(gamma(x))); +endfor +fprintf(fn, "\n}\n"); + +function retval = lgp(fn, x0, name) + fprintf(fn, "\\def\\loggammaplot%s{\n", name); + fprintf(fn, "\\draw[color=red,line width=1pt] "); + for k = (-7:0.1:7) + x = x0 + 0.5 * tanh(k); + if (k > -5) + fprintf(fn, "\n\t-- "); + end + fprintf(fn, "({%.4f*\\dx},{%.4f*\\dy})", x, log(gamma(x))); + endfor + fprintf(fn, ";\n}\n"); +endfunction + +lgp(fn, -0.5, "zero"); +lgp(fn, -1.5, "one"); +lgp(fn, -2.5, "two"); +lgp(fn, -3.5, "three"); +lgp(fn, -4.5, "four"); + +fclose(fn); |