diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex | 262 |
1 files changed, 262 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex new file mode 100644 index 00000000000..a05d934f12b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex @@ -0,0 +1,262 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoremath.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>. +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% Mathematical stuff + + +% Internal registers +\newcounter{pgf@counta} +\newcounter{pgf@countb} +\newcounter{pgf@countc} +\newcounter{pgf@countd} + +% Internal setting function +\def\pgf@setmath#1#2{\edef\pgf@temp{#2pt}\csname pgf@#1\endcsname=\pgf@temp} + + +% Calculate sin of a degree +% +% #1 = degree +% +% x = sin of #1 +% +% Example: +% +% \pgfsin{30} + +\def\pgfsin#1{% + \pgf@setcounter{pgf@counta}{#1}\relax% + \c@pgf@countb=90% + \advance\c@pgf@countb by-\c@pgf@counta% + \ifnum\c@pgf@countb>179% + \advance\c@pgf@countb by-360% + \else% + \ifnum\c@pgf@countb<-179% + \advance\c@pgf@countb by360% + \fi\fi% + \ifnum\c@pgf@countb<0\relax% + \c@pgf@countb=-\c@pgf@countb% + \fi% + \pgf@setmath{x}{\csname pgf@cos\the\c@pgf@countb\endcsname}} + + +% Calculate cos of a degree +% +% #1 = degree +% +% x = cos of #1 +% +% Example: +% +% \pgfcos{30} + +\def\pgfcos#1{% + \pgf@setcounter{pgf@counta}{#1}% + \ifnum\c@pgf@counta>179% + \advance\c@pgf@counta by-360% + \else% + \ifnum\c@pgf@counta<-179% + \advance\c@pgf@counta by360% + \fi\fi% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta% + \fi% + \pgf@setmath{x}{\csname pgf@cos\the\c@pgf@counta\endcsname}} + + + +% Calculate sin and cos of a degree +% +% #1 = degree +% +% x = cos of #1 +% y = sin of #1 +% +% Example: +% +% \pgfcos{30} + +\def\pgfsincos#1{% + \pgf@setcounter{pgf@counta}{#1}% + \ifnum\c@pgf@counta>179% + \advance\c@pgf@counta by-360% + \else% + \ifnum\c@pgf@counta<-179% + \advance\c@pgf@counta by360% + \fi\fi\relax% + \c@pgf@countb=\c@pgf@counta\relax% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta% + \fi\relax% + \pgf@setmath{y}{\csname pgf@cos\the\c@pgf@counta\endcsname}% + \c@pgf@counta=90% + \advance\c@pgf@counta by-\c@pgf@countb\relax% + \ifnum\c@pgf@counta>179% + \advance\c@pgf@counta by-360% + \else% + \ifnum\c@pgf@counta<-179% + \advance\c@pgf@counta by360% + \fi\fi\relax% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta% + \fi\relax% + \pgf@setmath{x}{\csname pgf@cos\the\c@pgf@counta\endcsname}} + + +% Internal tables + +\def\pgf@def#1#2#3{\expandafter\def\csname pgf@#1#2\endcsname{#3}} +\pgf@def{cos}{0}{1} \pgf@def{cos}{1}{0.999848} +\pgf@def{cos}{2}{0.999391} \pgf@def{cos}{3}{0.99863} +\pgf@def{cos}{4}{0.997564} \pgf@def{cos}{5}{0.996195} +\pgf@def{cos}{6}{0.994522} \pgf@def{cos}{7}{0.992546} +\pgf@def{cos}{8}{0.990268} \pgf@def{cos}{9}{0.987688} +\pgf@def{cos}{10}{0.984808} \pgf@def{cos}{11}{0.981627} +\pgf@def{cos}{12}{0.978148} \pgf@def{cos}{13}{0.97437} +\pgf@def{cos}{14}{0.970296} \pgf@def{cos}{15}{0.965926} +\pgf@def{cos}{16}{0.961262} \pgf@def{cos}{17}{0.956305} +\pgf@def{cos}{18}{0.951057} \pgf@def{cos}{19}{0.945519} +\pgf@def{cos}{20}{0.939693} \pgf@def{cos}{21}{0.93358} +\pgf@def{cos}{22}{0.927184} \pgf@def{cos}{23}{0.920505} +\pgf@def{cos}{24}{0.913545} \pgf@def{cos}{25}{0.906308} +\pgf@def{cos}{26}{0.898794} \pgf@def{cos}{27}{0.891007} +\pgf@def{cos}{28}{0.882948} \pgf@def{cos}{29}{0.87462} +\pgf@def{cos}{30}{0.866025} \pgf@def{cos}{31}{0.857167} +\pgf@def{cos}{32}{0.848048} \pgf@def{cos}{33}{0.838671} +\pgf@def{cos}{34}{0.829038} \pgf@def{cos}{35}{0.819152} +\pgf@def{cos}{36}{0.809017} \pgf@def{cos}{37}{0.798636} +\pgf@def{cos}{38}{0.788011} \pgf@def{cos}{39}{0.777146} +\pgf@def{cos}{40}{0.766044} \pgf@def{cos}{41}{0.75471} +\pgf@def{cos}{42}{0.743145} \pgf@def{cos}{43}{0.731354} +\pgf@def{cos}{44}{0.71934} \pgf@def{cos}{45}{0.707107} +\pgf@def{cos}{46}{0.694658} \pgf@def{cos}{47}{0.681998} +\pgf@def{cos}{48}{0.669131} \pgf@def{cos}{49}{0.656059} +\pgf@def{cos}{50}{0.642788} \pgf@def{cos}{51}{0.62932} +\pgf@def{cos}{52}{0.615661} \pgf@def{cos}{53}{0.601815} +\pgf@def{cos}{54}{0.587785} \pgf@def{cos}{55}{0.573576} +\pgf@def{cos}{56}{0.559193} \pgf@def{cos}{57}{0.544639} +\pgf@def{cos}{58}{0.529919} \pgf@def{cos}{59}{0.515038} +\pgf@def{cos}{60}{0.5} \pgf@def{cos}{61}{0.48481} +\pgf@def{cos}{62}{0.469472} \pgf@def{cos}{63}{0.45399} +\pgf@def{cos}{64}{0.438371} \pgf@def{cos}{65}{0.422618} +\pgf@def{cos}{66}{0.406737} \pgf@def{cos}{67}{0.390731} +\pgf@def{cos}{68}{0.374607} \pgf@def{cos}{69}{0.358368} +\pgf@def{cos}{70}{0.34202} \pgf@def{cos}{71}{0.325568} +\pgf@def{cos}{72}{0.309017} \pgf@def{cos}{73}{0.292372} +\pgf@def{cos}{74}{0.275637} \pgf@def{cos}{75}{0.258819} +\pgf@def{cos}{76}{0.241922} \pgf@def{cos}{77}{0.224951} +\pgf@def{cos}{78}{0.207912} \pgf@def{cos}{79}{0.190809} +\pgf@def{cos}{80}{0.173648} \pgf@def{cos}{81}{0.156434} +\pgf@def{cos}{82}{0.139173} \pgf@def{cos}{83}{0.121869} +\pgf@def{cos}{84}{0.104528} \pgf@def{cos}{85}{0.0871557} +\pgf@def{cos}{86}{0.0697565} \pgf@def{cos}{87}{0.052336} +\pgf@def{cos}{88}{0.0348995} \pgf@def{cos}{89}{0.0174524} +\pgf@def{cos}{90}{0} \pgf@def{cos}{91}{-0.0174524} +\pgf@def{cos}{92}{-0.0348995} \pgf@def{cos}{93}{-0.052336} +\pgf@def{cos}{94}{-0.0697565} \pgf@def{cos}{95}{-0.0871557} +\pgf@def{cos}{96}{-0.104528} \pgf@def{cos}{97}{-0.121869} +\pgf@def{cos}{98}{-0.139173} \pgf@def{cos}{99}{-0.156434} +\pgf@def{cos}{100}{-0.173648} \pgf@def{cos}{101}{-0.190809} +\pgf@def{cos}{102}{-0.207912} \pgf@def{cos}{103}{-0.224951} +\pgf@def{cos}{104}{-0.241922} \pgf@def{cos}{105}{-0.258819} +\pgf@def{cos}{106}{-0.275637} \pgf@def{cos}{107}{-0.292372} +\pgf@def{cos}{108}{-0.309017} \pgf@def{cos}{109}{-0.325568} +\pgf@def{cos}{110}{-0.34202} \pgf@def{cos}{111}{-0.358368} +\pgf@def{cos}{112}{-0.374607} \pgf@def{cos}{113}{-0.390731} +\pgf@def{cos}{114}{-0.406737} \pgf@def{cos}{115}{-0.422618} +\pgf@def{cos}{116}{-0.438371} \pgf@def{cos}{117}{-0.45399} +\pgf@def{cos}{118}{-0.469472} \pgf@def{cos}{119}{-0.48481} +\pgf@def{cos}{120}{-0.5} \pgf@def{cos}{121}{-0.515038} +\pgf@def{cos}{122}{-0.529919} \pgf@def{cos}{123}{-0.544639} +\pgf@def{cos}{124}{-0.559193} \pgf@def{cos}{125}{-0.573576} +\pgf@def{cos}{126}{-0.587785} \pgf@def{cos}{127}{-0.601815} +\pgf@def{cos}{128}{-0.615661} \pgf@def{cos}{129}{-0.62932} +\pgf@def{cos}{130}{-0.642788} \pgf@def{cos}{131}{-0.656059} +\pgf@def{cos}{132}{-0.669131} \pgf@def{cos}{133}{-0.681998} +\pgf@def{cos}{134}{-0.694658} \pgf@def{cos}{135}{-0.707107} +\pgf@def{cos}{136}{-0.71934} \pgf@def{cos}{137}{-0.731354} +\pgf@def{cos}{138}{-0.743145} \pgf@def{cos}{139}{-0.75471} +\pgf@def{cos}{140}{-0.766044} \pgf@def{cos}{141}{-0.777146} +\pgf@def{cos}{142}{-0.788011} \pgf@def{cos}{143}{-0.798636} +\pgf@def{cos}{144}{-0.809017} \pgf@def{cos}{145}{-0.819152} +\pgf@def{cos}{146}{-0.829038} \pgf@def{cos}{147}{-0.838671} +\pgf@def{cos}{148}{-0.848048} \pgf@def{cos}{149}{-0.857167} +\pgf@def{cos}{150}{-0.866025} \pgf@def{cos}{151}{-0.87462} +\pgf@def{cos}{152}{-0.882948} \pgf@def{cos}{153}{-0.891007} +\pgf@def{cos}{154}{-0.898794} \pgf@def{cos}{155}{-0.906308} +\pgf@def{cos}{156}{-0.913545} \pgf@def{cos}{157}{-0.920505} +\pgf@def{cos}{158}{-0.927184} \pgf@def{cos}{159}{-0.93358} +\pgf@def{cos}{160}{-0.939693} \pgf@def{cos}{161}{-0.945519} +\pgf@def{cos}{162}{-0.951057} \pgf@def{cos}{163}{-0.956305} +\pgf@def{cos}{164}{-0.961262} \pgf@def{cos}{165}{-0.965926} +\pgf@def{cos}{166}{-0.970296} \pgf@def{cos}{167}{-0.97437} +\pgf@def{cos}{168}{-0.978148} \pgf@def{cos}{169}{-0.981627} +\pgf@def{cos}{170}{-0.984808} \pgf@def{cos}{171}{-0.987688} +\pgf@def{cos}{172}{-0.990268} \pgf@def{cos}{173}{-0.992546} +\pgf@def{cos}{174}{-0.994522} \pgf@def{cos}{175}{-0.996195} +\pgf@def{cos}{176}{-0.997564} \pgf@def{cos}{177}{-0.99863} +\pgf@def{cos}{178}{-0.999391} \pgf@def{cos}{179}{-0.999848} +\pgf@def{cos}{180}{-1} + + + +\pgf@def{cosfrac}{0}{1} +\pgf@def{cosfrac}{1}{0.99995} \pgf@def{cosfrac}{2}{0.9998} +\pgf@def{cosfrac}{3}{0.99955} \pgf@def{cosfrac}{4}{0.999201} +\pgf@def{cosfrac}{5}{0.998752} \pgf@def{cosfrac}{6}{0.998205} +\pgf@def{cosfrac}{7}{0.997559} \pgf@def{cosfrac}{8}{0.996815} +\pgf@def{cosfrac}{9}{0.995974} \pgf@def{cosfrac}{10}{0.995037} +\pgf@def{cosfrac}{11}{0.994004} \pgf@def{cosfrac}{12}{0.992877} +\pgf@def{cosfrac}{13}{0.991656} \pgf@def{cosfrac}{14}{0.990342} +\pgf@def{cosfrac}{15}{0.988936} \pgf@def{cosfrac}{16}{0.987441} +\pgf@def{cosfrac}{17}{0.985856} \pgf@def{cosfrac}{18}{0.984183} +\pgf@def{cosfrac}{19}{0.982424} \pgf@def{cosfrac}{20}{0.980581} +\pgf@def{cosfrac}{21}{0.978653} \pgf@def{cosfrac}{22}{0.976644} +\pgf@def{cosfrac}{23}{0.974555} \pgf@def{cosfrac}{24}{0.972387} +\pgf@def{cosfrac}{25}{0.970143} \pgf@def{cosfrac}{26}{0.967823} +\pgf@def{cosfrac}{27}{0.965429} \pgf@def{cosfrac}{28}{0.962964} +\pgf@def{cosfrac}{29}{0.960429} \pgf@def{cosfrac}{30}{0.957826} +\pgf@def{cosfrac}{31}{0.955157} \pgf@def{cosfrac}{32}{0.952424} +\pgf@def{cosfrac}{33}{0.949629} \pgf@def{cosfrac}{34}{0.946773} +\pgf@def{cosfrac}{35}{0.943858} \pgf@def{cosfrac}{36}{0.940887} +\pgf@def{cosfrac}{37}{0.937862} \pgf@def{cosfrac}{38}{0.934784} +\pgf@def{cosfrac}{39}{0.931655} \pgf@def{cosfrac}{40}{0.928477} +\pgf@def{cosfrac}{41}{0.925252} \pgf@def{cosfrac}{42}{0.921982} +\pgf@def{cosfrac}{43}{0.918669} \pgf@def{cosfrac}{44}{0.915315} +\pgf@def{cosfrac}{45}{0.911922} \pgf@def{cosfrac}{46}{0.90849} +\pgf@def{cosfrac}{47}{0.905024} \pgf@def{cosfrac}{48}{0.901523} +\pgf@def{cosfrac}{49}{0.89799} \pgf@def{cosfrac}{50}{0.894427} +\pgf@def{cosfrac}{51}{0.890835} \pgf@def{cosfrac}{52}{0.887217} +\pgf@def{cosfrac}{53}{0.883573} \pgf@def{cosfrac}{54}{0.879905} +\pgf@def{cosfrac}{55}{0.876216} \pgf@def{cosfrac}{56}{0.872506} +\pgf@def{cosfrac}{57}{0.868777} \pgf@def{cosfrac}{58}{0.865031} +\pgf@def{cosfrac}{59}{0.861269} \pgf@def{cosfrac}{60}{0.857493} +\pgf@def{cosfrac}{61}{0.853704} \pgf@def{cosfrac}{62}{0.849903} +\pgf@def{cosfrac}{63}{0.846092} \pgf@def{cosfrac}{64}{0.842271} +\pgf@def{cosfrac}{65}{0.838444} \pgf@def{cosfrac}{66}{0.834609} +\pgf@def{cosfrac}{67}{0.83077} \pgf@def{cosfrac}{68}{0.826927} +\pgf@def{cosfrac}{69}{0.82308} \pgf@def{cosfrac}{70}{0.819232} +\pgf@def{cosfrac}{71}{0.815383} \pgf@def{cosfrac}{72}{0.811534} +\pgf@def{cosfrac}{73}{0.807687} \pgf@def{cosfrac}{74}{0.803842} +\pgf@def{cosfrac}{75}{0.8} \pgf@def{cosfrac}{76}{0.796162} +\pgf@def{cosfrac}{77}{0.792329} \pgf@def{cosfrac}{78}{0.788502} +\pgf@def{cosfrac}{79}{0.784682} \pgf@def{cosfrac}{80}{0.780869} +\pgf@def{cosfrac}{81}{0.777064} \pgf@def{cosfrac}{82}{0.773268} +\pgf@def{cosfrac}{83}{0.769481} \pgf@def{cosfrac}{84}{0.765705} +\pgf@def{cosfrac}{85}{0.761939} \pgf@def{cosfrac}{86}{0.758185} +\pgf@def{cosfrac}{87}{0.754443} \pgf@def{cosfrac}{88}{0.750714} +\pgf@def{cosfrac}{89}{0.746997} \pgf@def{cosfrac}{90}{0.743294} +\pgf@def{cosfrac}{91}{0.739605} \pgf@def{cosfrac}{92}{0.735931} +\pgf@def{cosfrac}{93}{0.732272} \pgf@def{cosfrac}{94}{0.728628} +\pgf@def{cosfrac}{95}{0.724999} \pgf@def{cosfrac}{96}{0.721387} +\pgf@def{cosfrac}{97}{0.717792} \pgf@def{cosfrac}{98}{0.714213} +\pgf@def{cosfrac}{99}{0.710651} \pgf@def{cosfrac}{100}{0.707107} + + + +\endinput |