diff options
author | Karl Berry <karl@freefriends.org> | 2009-07-15 00:14:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-07-15 00:14:18 +0000 |
commit | e355922861e2bc91176c058d563d477444c2dfd9 (patch) | |
tree | b8b23e9b69d8a1cbd97d0063bf48d51237e6499a /Build/source/utils/asymptote/examples | |
parent | c64b34678b096f795ef6e745e23cf50cc4e983ea (diff) |
asymptote 1.81 source/w32 update
git-svn-id: svn://tug.org/texlive/trunk@14262 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/examples')
-rw-r--r-- | Build/source/utils/asymptote/examples/contextfonts.asy | 4 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/lmfit1.asy | 37 |
2 files changed, 40 insertions, 1 deletions
diff --git a/Build/source/utils/asymptote/examples/contextfonts.asy b/Build/source/utils/asymptote/examples/contextfonts.asy index ef1b1ddfe50..39177abdba3 100644 --- a/Build/source/utils/asymptote/examples/contextfonts.asy +++ b/Build/source/utils/asymptote/examples/contextfonts.asy @@ -1,8 +1,10 @@ settings.tex="context"; +// Work around ConTeXT bug for font sizes less than 12pt: +texpreamble("\setupbodyfont[8pt]"); usetypescript("iwona"); usetypescript("antykwa-torunska"); label("$A$",0,N,font("iwona")); -label("$A$",0,S,font("antykwa")+red); +label("$A$",0,S,font("antykwa",8pt)+red); diff --git a/Build/source/utils/asymptote/examples/lmfit1.asy b/Build/source/utils/asymptote/examples/lmfit1.asy new file mode 100644 index 00000000000..c25a7c4b4be --- /dev/null +++ b/Build/source/utils/asymptote/examples/lmfit1.asy @@ -0,0 +1,37 @@ +import lmfit; +import graph; + +size(10cm, 7cm, IgnoreAspect); + +real[] date = { 1790, 1800, 1810, 1820, 1830, 1840, 1850, 1860, 1870, 1880, +1890, 1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990 }; +real[] population = { 3.929, 5.308, 7.240, 9.638, 12.866, 17.069, 23.192, 31.443, +38.558, 50.156, 62.948, 75.996, 91.972, 105.711, 122.775, 131.669, 150.697, +179.323, 203.185, 226.546, 248.710 }; + +real t0 = 1776; + +real P(real[] params, real t) { + real P0 = params[0]; + real K = params[1]; + real r = params[2]; + return (K * P0) / (P0 + (K - P0) * exp(-r * (t - t0))); +} + +real[] params = { 10, 500, 0.1 }; + +real res = lmfit.fit(date, population, P, params).norm; + +write("P_0 = ", params[0]); +write("K = ", params[1]); +write("r = ", params[2]); +write("error = ", res); + +real P(real t) { + return P(params, t); +} + +draw(graph(date, population), blue); +draw(graph(P, t0, 2000), red); +xaxis("Year", BottomTop, LeftTicks); +yaxis("Population in millions", LeftRight, RightTicks); |