diff options
author | Karl Berry <karl@freefriends.org> | 2014-02-24 22:58:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-02-24 22:58:28 +0000 |
commit | 2385109f9c04a438cbd803b18e9b8dd0637aa31c (patch) | |
tree | 9379bacf1e71117df8228cbaca99101cfd99dbab /Master/texmf-dist/tex | |
parent | 9448b9fce7c46eb0ac4b118cb78f44696dadf39d (diff) |
calculator (23feb14)
git-svn-id: svn://tug.org/texlive/trunk@33041 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/calculator/calculator.sty | 322 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/calculator/calculus.sty | 78 |
2 files changed, 367 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/latex/calculator/calculator.sty b/Master/texmf-dist/tex/latex/calculator/calculator.sty index eb17a0715c0..0c8cd4a23c8 100644 --- a/Master/texmf-dist/tex/latex/calculator/calculator.sty +++ b/Master/texmf-dist/tex/latex/calculator/calculator.sty @@ -5,21 +5,27 @@ %% The original source files were: %% %% calculator.dtx (with options: `calculator') -%% ------------------------------------------------------------------ -%% The calculator and calculus packages -%% Copyright (C) 2012 by Robert Fuster <rfuster@mat.upv.es> -%% All rights reserved +%% This is a generated file. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in: +%% This work may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3 of this license +%% or (at your option) any later version. The latest version of this +%% license is in: %% -%% http://www.latex-project.org/lppl.txt +%% http://www.latex-project.org/lppl.txt %% %% and version 1.3 or later is part of all distributions of LaTeX -%% version 1999/12/01 or later. -%% ------------------------------------------------------------------ +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Robert Fuster +%% +%% This work consists of the files calculator.dtx and calculator.ins +%% and the derived files calculator.sty, calculus.ins, and several +%% calculator<nn>.tex derived files. +%% +%% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -39,8 +45,9 @@ + \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{calculator}[2012/06/10 v.1.0a] +\ProvidesPackage{calculator}[2014/02/20 v.2.0] \newdimen\cctr@lengtha \newdimen\cctr@lengthb \newdimen\cctr@epsilon @@ -67,6 +74,37 @@ must be an integer\MessageBreak I can't define #1^#2}} +\def\cctr@Warnbigarcsin#1{% + \PackageWarning{calculator}% + {The argument in arcsin\MessageBreak + must be a number between -1 and 1\MessageBreak + I can't define arcsin(#1)}} + +\def\cctr@Warnbigarccos#1{% + \PackageWarning{calculator}% + {The argument in arccos\MessageBreak + must be a number between -1 and 1\MessageBreak + I can't define arccos(#1)}} + +\def\cctr@Warnsmallarcosh#1{% + \PackageWarning{calculator}% + {The argument in arcosh\MessageBreak + must be a number greater or equal than 1\MessageBreak + I can't define arcosh(#1)}} + +\def\cctr@Warnbigartanh#1{% + \PackageWarning{calculator}% + {The argument in artanh\MessageBreak + must be a number between -1 and 1\MessageBreak + I can't define artanh(#1)}} + +\def\cctr@Warnsmallarcoth#1{% + \PackageWarning{calculator}% + {The argument in arcoth\MessageBreak + must be a number greater than 1\MessageBreak + or smaller than -1\MessageBreak + I can't define arcoth(#1)}} + \def\cctr@Warnsingmatrix#1#2#3#4{% \PackageWarning{calculator}% {Matrix (#1 #2 ; #3 #4) is singular\MessageBreak @@ -77,18 +115,18 @@ {Matrix (#1 #2 #3; #4 #5 #6; #7 #8 #9) is singular\MessageBreak Its inverse is not defined}} -\def\cctr@WarnIncLinSys{\PackageWarning{xpicture}{% +\def\cctr@WarnIncLinSys{\PackageWarning{calculator}{% Incompatible linear system}} -\def\cctr@WarnIncTDLinSys{\PackageWarning{xpicture}{% +\def\cctr@WarnIncTDLinSys{\PackageWarning{calculator}{% Incompatible or indeterminate linear system\MessageBreak For 3x3 systems I can solve only determinate systems}} -\def\cctr@WarnIndLinSys{\PackageWarning{xpicture}{% +\def\cctr@WarnIndLinSys{\PackageWarning{calculator}{% Indeterminate linear system.\MessageBreak I will choose one of the infinite solutions}} -\def\cctr@WarnZeroLinSys{\PackageWarning{xpicture}{% +\def\cctr@WarnZeroLinSys{\PackageWarning{calculator}{% 0x=0 linear system. Every vector is a solution!\MessageBreak I will choose the (0,0) solution}} @@ -124,6 +162,18 @@ The value of the variable\MessageBreak in the logarithm function must be positive\MessageBreak I can't define log(#1)}} + +\def\cctr@Warncrossprod(#1)(#2){% + \PackageWarning{calculator}% + {Vector product only defined\MessageBreak + for 3 dimmensional vectors.\MessageBreak + I can't define (#1)x(#2)}} + +\def\cctr@Warnnoangle(#1)(#2){% + \PackageWarning{calculator}% + {Angle between two vectors only defined\MessageBreak + for nonzero vectors.\MessageBreak + I can't define an angle between (#1) and (#2)}} \def\COPY#1#2{\edef#2{#1}\ignorespaces} \def\GLOBALCOPY#1#2{\xdef#2{#1}\ignorespaces} \def\@OUTPUTSOL#1{\GLOBALCOPY{#1}{\cctr@outa}\endgroup\COPY{\cctr@outa}{#1}} @@ -185,6 +235,12 @@ \divide\cctr@lengtha\cctr@lengthb \COPY{\number\cctr@lengtha}{#3} \fi\ignorespaces} +\def\LENGTHADD#1#2#3{\cctr@lengtha=#1 + \cctr@lengthb=#2 + \advance\cctr@lengtha by \cctr@lengthb + \setlength{#3}{\cctr@lengtha}\ignorespaces} +\def\LENGTHSUBTRACT#1#2#3{% + \LENGTHADD{#1}{-#2}{#3}} \def\LENGTHDIVIDE#1#2#3{% \begingroup \cctr@lengtha=#1 @@ -692,8 +748,7 @@ \def\@BASICLOG#1#2{\begingroup \SUBTRACT{#1}{1}{\cctr@tempw} \cctr@lengthb=5\p@% - \cctr@lengtha=\cctr@epsilon% - \@whilenum \cctr@lengthb>\cctr@lengtha \do {% + \@whilenum \cctr@lengthb>\cctr@epsilon \do {% \COPY{\cctr@tempw}{\cctr@tempoldw} \EXP{\cctr@tempw}{\cctr@tempxw} \DIVIDE{#1}{\cctr@tempxw}{\cctr@tempxw} @@ -705,6 +760,196 @@ \cctr@lengthb<\z@ \cctr@lengthb=-\cctr@lengthb \fi}% \COPY{\cctr@tempw}{#2}\@OUTPUTSOL{#2}} +\def\ARCSIN#1#2{% + \begingroup + \ifdim #1\p@ = \z@ + \COPY{0}{#2} + \else + \ifdim #1\p@ = 1\p@ + \COPY{\numberHALFPI}{#2} + \else + \ifdim #1\p@ = -1\p@ + \COPY{-\numberHALFPI}{#2} + \else + \ifdim #1\p@ > 1\p@ + \let#2\undefined + \cctr@Warnbigarcsin{#1} + \else + \ifdim #1\p@ < -1\p@ + \let#2\undefined + \cctr@Warnbigarcsin{#1} + \else + \ifdim #1\p@ >0.89\p@ + \SUBTRACT{1}{#1}{\cctr@tempx} + \DIVIDE{\cctr@tempx}{2}{\cctr@tempx} + \SQRT{\cctr@tempx}{\cctr@tempxx} + \ARCSIN{\cctr@tempxx}{#2} + \MULTIPLY{2}{#2}{#2} + \SUBTRACT{\numberHALFPI}{#2}{#2} + \else + \ifdim #1\p@ <-0.89\p@ + \ADD{1}{#1}{\cctr@tempx} + \DIVIDE{\cctr@tempx}{2}{\cctr@tempx} + \SQRT{\cctr@tempx}{\cctr@tempxx} + \ARCSIN{\cctr@tempxx}{#2} + \MULTIPLY{2}{#2}{#2} + \SUBTRACT{#2}{\numberHALFPI}{#2} + \else + \COPY{#1}{#2} + \ABSVALUE{#1}{\cctr@tempy} + \ifdim \cctr@tempy\p@ < 0.04\p@ + \else + \cctr@lengthb=5\p@ + \COPY{16383}{\cctr@tempy} + \@whilenum \cctr@lengthb>\cctr@epsilon \do {% + \COPY{#2}{\cctr@tempw} + \COPY{\cctr@tempy}{\cctr@tempoldy} + \SIN{\cctr@tempw}{\cctr@tempz} + \SUBTRACT{\cctr@tempz}{#1}{\cctr@tempz} + \COS{\cctr@tempw}{\cctr@tempy} + \DIVIDE{\cctr@tempz}{\cctr@tempy}{\cctr@tempz} + \SUBTRACT{\cctr@tempw}{\cctr@tempz}{\cctr@tempz} + \COPY{\cctr@tempz}{#2} + \SUBTRACT{#2}{\cctr@tempw}{\cctr@tempy} + \ABSVALUE{\cctr@tempy}{\cctr@tempy} + \cctr@lengthb=\cctr@tempy\p@% + \ifdim\cctr@tempy\p@=\cctr@tempoldy\p@ + \cctr@lengthb=\z@ + \fi}\fi\fi\fi\fi\fi\fi\fi\fi\@OUTPUTSOL{#2}} +\def\ARCCOS#1#2{% + \begingroup + \ifdim #1\p@ = \z@ + \COPY{\numberHALFPI}{#2} + \else + \ifdim #1\p@ = 1\p@ + \COPY{0}{#2} + \else + \ifdim #1\p@ = -1\p@ + \COPY{\numberPI}{#2} + \else + \ifdim #1\p@ > 1\p@ + \let#2\undefined + \cctr@Warnbigarccos{#1} + \else + \ifdim #1\p@ < -1\p@ + \let#2\undefined + \cctr@Warnbigarccos{#1} + \else + \ARCSIN{#1}{#2} + \SUBTRACT{\numberHALFPI}{#2}{#2} + \fi\fi\fi\fi\fi\@OUTPUTSOL{#2}} +\def\ARCTAN#1#2{% + \begingroup + \ifdim#1\p@<-1\p@ + \DIVIDE{1}{#1}{\cctr@tempb} + \ARCTAN{\cctr@tempb}{#2} + \SUBTRACT{-\numberHALFPI}{#2}{#2} + \else + \ifdim#1\p@>1\p@ + \DIVIDE{1}{#1}{\cctr@tempb} + \ARCTAN{\cctr@tempb}{#2} + \SUBTRACT{\numberHALFPI}{#2}{#2} + \else + \@BASICARCTAN{#1}{#2} + \fi + \fi\@OUTPUTSOL{#2}} +\def\@BASICARCTAN#1#2{% + \begingroup + \ifdim#1\p@=\z@ \COPY{0}{#2} + \else + \SQUARE{#1}{\cctr@tempa} + \MULTIPLY{64}{\cctr@tempa}{#2} + \ADD{15}{#2}{#2} + \DIVIDE{\cctr@tempa}{#2}{#2} + \MULTIPLY{49}{#2}{#2} + \ADD{13}{#2}{#2} + \DIVIDE{\cctr@tempa}{#2}{#2} + \MULTIPLY{36}{#2}{#2} + \ADD{11}{#2}{#2} + \DIVIDE{\cctr@tempa}{#2}{#2} + \MULTIPLY{25}{#2}{#2} + \ADD{9}{#2}{#2} + \DIVIDE{\cctr@tempa}{#2}{#2} + \MULTIPLY{16}{#2}{#2} + \ADD{7}{#2}{#2} + \DIVIDE{\cctr@tempa}{#2}{#2} + \MULTIPLY{9}{#2}{#2} + \ADD{5}{#2}{#2} + \DIVIDE{\cctr@tempa}{#2}{#2} + \MULTIPLY{4}{#2}{#2} + \ADD{3}{#2}{#2} + \DIVIDE{\cctr@tempa}{#2}{#2} + \ADD{1}{#2}{#2} + \DIVIDE{#1}{#2}{#2} + \fi\@OUTPUTSOL{#2}} +\def\ARCCOT#1#2{% + \begingroup + \ARCTAN{#1}{#2} + \SUBTRACT{\numberHALFPI}{#2}{#2} + \@OUTPUTSOL{#2}} +\def\ARSINH#1#2{% + \begingroup + \SQUARE{#1}{\cctr@tempa} + \ADD{1}{\cctr@tempa}{\cctr@tempa} + \SQRT{\cctr@tempa}{\cctr@tempb} + \ADD{#1}{\cctr@tempb}{\cctr@tempb} + \LOG\cctr@tempb{#2} + \@OUTPUTSOL{#2}} + +\def\ARCOSH#1#2{% + \begingroup + \ifdim#1\p@<1\p@ + \let#2\undefined + \cctr@Warnsmallarcosh{#1} + \else + \SQUARE{#1}{\cctr@tempa} + \SUBTRACT{\cctr@tempa}{1}{\cctr@tempa} + \SQRT{\cctr@tempa}{\cctr@tempb} + \ADD{#1}{\cctr@tempb}{\cctr@tempb} + \LOG\cctr@tempb{#2} + \fi\@OUTPUTSOL{#2}} +\def\ARTANH#1#2{% + \begingroup + \ifdim#1\p@<-0.99998\p@ + \let#2\undefined + \cctr@Warnbigartanh{#1} + \else + \ifdim#1\p@>0.99998\p@ + \let#2\undefined + \cctr@Warnbigartanh{#1} + \else + \COPY{#1}{\cctr@tempa} + \ADD1\cctr@tempa\cctr@tempb + \SUBTRACT1\cctr@tempa\cctr@tempc + \LOG\cctr@tempb\cctr@tempB + \LOG\cctr@tempc\cctr@tempC + \SUBTRACT\cctr@tempB\cctr@tempC{#2} + \DIVIDE{#2}{2}{#2} + \fi + \fi\@OUTPUTSOL{#2}} +\def\ARCOTH#1#2{% + \begingroup + \ifdim#1\p@>-0.99998\p@ + \ifdim#1\p@<0.99998\p@ + \let#2\undefined + \cctr@Warnsmallarcoth{#1} + \else + \ifdim#1\p@>\p@ + \COPY{#1}{\cctr@tempa} + \ADD1\cctr@tempa\cctr@tempb + \SUBTRACT\cctr@tempa1\cctr@tempc + \LOG\cctr@tempb\cctr@tempB + \LOG\cctr@tempc\cctr@tempC + \SUBTRACT\cctr@tempB\cctr@tempC{#2} + \DIVIDE{#2}{2}{#2} + \else + \fi + \fi + \else + \MULTIPLY{-1}{#1}{\cctr@tempa} + \ARCOTH{\cctr@tempa}{#2} + \COPY{-#2}{#2} + \fi\@OUTPUTSOL{#2}} \def\VECTORSIZE(#1)#2{\expandafter\@VECTORSIZE(#1,,){#2}} \def\@VECTORSIZE(#1,#2,#3,#4)#5{\ifx$#3$\COPY{2}{#5} \else\COPY{3}{#5}\fi\ignorespaces} @@ -760,6 +1005,28 @@ \ifnum\cctr@size=2 \@@SCALARPRODUCT(#1)(#2){#3} \else \@@@SCALARPRODUCT(#1)(#2){#3}\fi\@OUTPUTSOL{#3}} + +\let\DOTPRODUCT\SCALARPRODUCT + +\def\@@VECTORPRODUCT(#1)(#2)(#3,#4){% + \let#3\undefined + \let#4\undefined + \cctr@Warncrossprod(#1)(#2)} + +\def\@@@VECTORPRODUCT(#1,#2,#3)(#4,#5,#6)(#7,#8,#9){% + \DETERMINANT(#2,#3;#5,#6){#7} + \DETERMINANT(#3,#1;#6,#4){#8} + \DETERMINANT(#1,#2;#4,#5){#9}} + +\def\VECTORPRODUCT(#1)(#2)(#3){% + \begingroup + \VECTORSIZE(#1){\cctr@size} + \ifnum\cctr@size=2 + \@@VECTORPRODUCT(#1)(#2)(#3) + \else \@@@VECTORPRODUCT(#1)(#2)(#3)\fi\@OUTPUTSOL{#3}} + +\let\CROSSPRODUCT\VECTORPRODUCT + \def\@@VECTORADD(#1,#2)(#3,#4)(#5,#6){% \ADD{#1}{#3}{#5} \ADD{#2}{#4}{#6}} @@ -819,6 +1086,23 @@ \VECTORNORM(#1){\cctr@tempa} \DIVIDE{1}{\cctr@tempa}{\cctr@tempa} \SCALARVECTORPRODUCT{\cctr@tempa}(#1)(#2)\@OUTPUTVECTOR(#2)} +\def\TWOVECTORSANGLE(#1)(#2)#3{% + \begingroup + \VECTORNORM(#1){\cctr@tempa} + \VECTORNORM(#2){\cctr@tempb} + \SCALARPRODUCT(#1)(#2){\cctr@tempc} + \ifdim \cctr@tempa\p@ =\z@ + \let#3\undefined + \cctr@Warnnoangle(#1)(#2) + \else + \ifdim \cctr@tempb\p@ =\z@ + \let#3\undefined + \cctr@Warnnoangle(#1)(#2) + \else + \DIVIDE{\cctr@tempc}{\cctr@tempa}{\cctr@tempc} + \DIVIDE{\cctr@tempc}{\cctr@tempb}{\cctr@tempc} + \ARCCOS{\cctr@tempc}{#3} + \fi\fi\@OUTPUTSOL{#3}} \def\@TDMATRIXCOPY(#1,#2,#3;#4,#5,#6;#7,#8,#9){% \COPY{#1}{\cctr@solAA} \COPY{#2}{\cctr@solAB} @@ -1207,6 +1491,6 @@ \def\numberSQRTFIVE{2.23607} \def\numberCOSXLV{0.70711} \def\numberCOSXXX{0.86603} -%% +\endinput %% %% End of file `calculator.sty'. diff --git a/Master/texmf-dist/tex/latex/calculator/calculus.sty b/Master/texmf-dist/tex/latex/calculator/calculus.sty index c90dabece8a..86010b080af 100644 --- a/Master/texmf-dist/tex/latex/calculator/calculus.sty +++ b/Master/texmf-dist/tex/latex/calculator/calculus.sty @@ -5,21 +5,27 @@ %% The original source files were: %% %% calculator.dtx (with options: `calculus') -%% ------------------------------------------------------------------ -%% The calculator and calculus packages -%% Copyright (C) 2012 by Robert Fuster <rfuster@mat.upv.es> -%% All rights reserved +%% This is a generated file. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in: +%% This work may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3 of this license +%% or (at your option) any later version. The latest version of this +%% license is in: %% -%% http://www.latex-project.org/lppl.txt +%% http://www.latex-project.org/lppl.txt %% %% and version 1.3 or later is part of all distributions of LaTeX -%% version 1999/12/01 or later. -%% ------------------------------------------------------------------ +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Robert Fuster +%% +%% This work consists of the files calculator.dtx and calculator.ins +%% and the derived files calculator.sty, calculus.ins, and several +%% calculator<nn>.tex derived files. +%% +%% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -39,9 +45,9 @@ + \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{calculus} - [2012/06/10 v.1.0a] +\ProvidesPackage{calculus}[2014/02/20 v.2.0] \RequirePackage{calculator} \def\ccls@ErrorFuncDef#1{% \PackageError{calculus}% @@ -320,6 +326,50 @@ \newfunction{\HEAVISIDEfunction}{% \ifdim \t\p@<\z@ \COPY{0}{\y}\else\COPY{1}{\y}\fi \COPY{0}{\Dy}} +\newfunction{\ARCSINfunction}{% + \ARCSIN{\t}{\y} + \SQUARE{\t}{\yy} + \SUBTRACT{1}{\yy}{\yy} + \SQRT{\yy}{\Dy} + \DIVIDE{1}{\Dy}{\Dy}} +\newfunction{\ARCCOSfunction}{% + \ARCCOS{\t}{\y} + \SQUARE{\t}{\yy} + \SUBTRACT{1}{\yy}{\yy} + \SQRT{\yy}{\Dy} + \DIVIDE{-1}{\Dy}{\Dy}} +\newfunction{\ARCTANfunction}{% + \ARCTAN{\t}{\y} + \SQUARE{\t}{\yy} + \ADD{1}{\yy}{\yy} + \DIVIDE{1}{\yy}{\Dy}} +\newfunction{\ARCCOTfunction}{% + \ARCCOT{\t}{\y} + \SQUARE{\t}{\yy} + \ADD{1}{\yy}{\yy} + \DIVIDE{-1}{\yy}{\Dy}} +\newfunction{\ARSINHfunction}{% + \ARSINH{\t}{\y} + \SQUARE{\t}{\yy} + \ADD{1}{\yy}{\yy} + \SQRT{\yy}{\Dy} + \DIVIDE{1}{\Dy}{\Dy}} +\newfunction{\ARCOSHfunction}{% + \ARCOSH{\t}{\y} + \SQUARE{\t}{\yy} + \SUBTRACT{\yy}{1}{\yy} + \SQRT{\yy}{\Dy} + \DIVIDE{1}{\Dy}{\Dy}} +\newfunction{\ARTANHfunction}{% + \ARTANH{\t}{\y} + \SQUARE{\t}{\yy} + \SUBTRACT{1}{\yy}{\yy} + \DIVIDE{1}{\yy}{\Dy}} +\newfunction{\ARCOTHfunction}{% + \ARCOTH{\t}{\y} + \SQUARE{\t}{\yy} + \SUBTRACT{1}{\yy}{\yy} + \DIVIDE{1}{\yy}{\Dy}} \def\CONSTANTfunction#1#2{% \def#2##1##2##3{% \xdef##2{#1}% @@ -433,6 +483,6 @@ #1{##1}{##2}{##3} #2{##1}{##4}{##5}}} \let\VECTORfunction\PARAMETRICfunction -%% +\endinput %% %% End of file `calculus.sty'. |