[metapost] Metafun : is "atan" the arctangent function?
Franck Pastor
franck.pastor at me.com
Wed Jan 15 12:20:34 CET 2014
Le 13 janv. 2014 à 17:29, Daniel H. Luecking <luecking at uark.edu> a écrit :
> Franck Pastor wrote:
>
>> I had a look in grafbase.mp, the file that contains the MetaPost
>> macros for the mfpic package. It also defines an atan function this way:
>>
>> vardef atan primary X = angle (1, X) enddef;
>
> This, as well as asin and acos, comes right out of Knuth's suggestions in
> "The METAFONT book".
>
Where in this book? In the index, I read
"arccosine, arcsine, arctangent" see "angle",
but wherever "angle" is mentioned in the book there are no suggestions to be found about the inverse trigonometric functions, unless I've missed something. I suppose that Knuth meant in his index that we must figure them out by ourselves, with the help of the angle function.
>>
>> There is also an "invtan" function that gives the result in radians:
>>
>> vardef invtan primary X = radians (atan X) enddef;
>>
>> where the radians function is
>>
>> vardef radians (expr t) = t/radian enddef;
>>
>> and
>>
>> radian := 57.29578;
>>
>> is a rounding of 180/pi.
>
> The next version of grafbase.mp will have something like
> radian := 57.2957795130823209;
> in the hope that it wil benefit from Metapost's new double precision
> number system (and not cause any problems for Metafont's less precise
> system).
>
Good idea! In the meantime, I will make a copy of the grafbase.mp file that is to be found in my TeX distribution, introduce this modification in it and place it in my own TEXMF directory. I am currently using the new double precision number system quite a lot, including with mfpic.
I suppose I will also modify the rounding of pi, which is currently set to 3.14159.
Thanks!
Franck Pastor
More information about the metapost
mailing list