User Tools

Site Tools


Advanced/Extended Trigonometry Functions

Arguably, most Trigonometry requirements are served by the three staples of Sine, Cosine and Tangent almost exclusively. There are however, many more functions which can be required. Their use is sufficiently rare though, that native functions are probably a waste of firmware space and development when they can be synthesized from the other mathematical primitives in a language.

The following code is all written in MMBasic but that language is a good “pseudo-code” allowing easy transcribing to just about any other. A good discussion on all trig functions and how/why to use them can be found here:

The below functions have been tested against Wolfram Alpha for correct function. Most are fine but three may be considered a “work in progress”. This status is clearly indicated against each function. Please feel free to correct those that currently do not work as expected.

Secant, CoSecant and CoTangent:

	Function Sec(x As Float) As Float'OK
	End Function

	Function Cosec(x As Float) As Float'OK
	End Function

	Function Cot(x As Float) As Float'OK
	End Function

Hyperbolic function counter-parts:

	Function Sinh(x As Float) As Float'OK
	End Function

	Function Cosh(x As Float) As Float'OK
	End Function

	Function Tanh(x As Float) As Float'OK
	End Function

	Function Sech(x As Float) As Float'OK
	End Function

	Function Cosech(x As Float) As Float'OK
	End Function

	Function Coth(x As Float) As Float'OK
	End Function

The Inverse counterparts

	Function Sin_1(x As Float) As Float'OK
	End Function

	Function Cos_1(x As Float) As Float'OK
	End Function

	Function Sec_1(x As Float) As Float
		Sec_1=Acos(1/x)'formula from, still not convinced since arcsec(0.5)=1.31696 on WA, but errors on Acos
	End Function

	Function Cosec_1(x As Float) As Float' x>1, OK 
	End Function

	Function Cot_1(x As Float) As Float'formula from
		Cot_1=Atn(1 / x)
	End Function

	Function Sinh_1(x As Float) As Float' OK
	End Function

	Function Cosh_1(x As Float) As Float' OK
	End Function

	Function Tanh_1(x As Float) As Float' OK
	End Function

	Function Sech_1(x As Float) As Float
		 Sech_1=Log((1+Sqr(1-x*x))/x)'formula from
	End Function

	Function Cosech_1(x As Float) As Float' OK
	End Function
	Function Coth_1(x As Float) As Float' OK
	End Function
platform_agnostic/advanced_extended_trigonometry_funtions.txt · Last modified: 2024/01/19 09:41 by