0
$\begingroup$

Let me explain a little. I am trying to find a formula to find trig functions without a triangle or using a calculator because:

(a) you don't need a calculator

(b) it could give exact values using fractions and/or radicals instead of an approximated decimal

Here is how I'm attempting to solve this:

The things I know:

  • One angle is given and one angle is a right angle so you are able to find all 3 angles
  • Because the trig functions use the ratio between sides as long as the sides are proportional to each other the scale of the triangle doesn't matter
  • Because the scale doesn't matter you can set one of the sides to any length and just base the other sides of that one side.
  1. First you set the adjacent side to 1 and base the other sides off of it. If you imagine it on a graph then you would draw a line from (0,0) to (1,0)
  2. Next you add a line for the hypotenuse that passes through the origin and has a slope based on the degree of the angle. The equation for this would be y=mx
  3. At the point on this line where x is equal to the adjacent side, the opposite side would be equal to the y
  4. Because the adjacent is set to 1 this essentially means that the opposite side equals the slope of the hypotenuse
  5. Once you have the the adjacent and opposite sides then you can use the pythagorean theorem to find the length of the hypotenuse
  6. With all 3 proportional sides you are able to calculate trig functions

The final formula for each side is:

$adj=1$

$opp=m$

$hyp=√(m^2+1)$

The only problem I have with this is I don't know a good way to convert an angle into a slope. I know that you can do it using the tangent function but that would kind of defeat the whole purpose of this. What is a good way to convert degrees into a slope without using any trig?

P.S. I would also appreciate if somebody could verify that this formula works or if it is flawed in some way that I did not notice

$\endgroup$
5
  • 3
    $\begingroup$ You are producing the tangent of an angle as "output" $m$. Hence it is necessarily the case that $m=\tan\alpha$. Any result such as "$\alpha=30^\circ$ leads to $m=\frac 2{\sqrt 3}$" is in an extremely shallow sense equivalent to "$\tan30^\circ=\frac 2{\sqrt 3}$". $\endgroup$ Commented Mar 29, 2022 at 20:21
  • 1
    $\begingroup$ @HagenvonEitzen Yes, but is there any way to find m without a calculator? $\endgroup$ Commented Mar 29, 2022 at 20:28
  • 1
    $\begingroup$ I'm very confident that there is no such way to do the conversion, except for very specific angles like $45^{\circ}$. Even in those cases, the computation might be way too cumbersome to do without a calculator. (See this work about finding the exact value of $\sin(1^{\circ})$.) $\endgroup$
    – VTand
    Commented Mar 29, 2022 at 20:58
  • $\begingroup$ Are approximate values okay? Can you find square root without a calculator? If so, you might look at how calculators actually calculate, and use their formulas. E.g. A 1972 paper. $\endgroup$ Commented Mar 29, 2022 at 21:03
  • $\begingroup$ @RayButterworth Approximate values are ok but not preferred. All of the ways that I've found that calculators calculate use infinite series that just get repeated over and over until the answer becomes close enough that continuing would not produce any significant changes. Those are the two things that I'm trying to avoid, approximation and infinite equations. $\endgroup$ Commented Mar 29, 2022 at 21:52

1 Answer 1

1
$\begingroup$

If you are looking for absolutely correct answers in close form, it's going to require infinite sums.

But if you are okay with very close approximations, there are implementations of high precision calculations of sin() and cos() that don't contain any loops or function calls.
(From them, one can calculate tan() = sin() ÷ cos().)

Here's an example of a Fast implementation of trigonometric functions for c++ — Stack Overflow:

static const unsigned __int16 DEGREE_LOOKUP_TABLE[91] = {
    64000, 63990, 63961, 63912, 63844, 63756,
    63649, 63523, 63377, 63212, 63028, 62824,
    62601, 62360, 62099, 61819, 61521, 61204,
    60868, 60513, 60140, 59749, 59340, 58912,
    58467, 58004, 57523, 57024, 56509, 55976,
    55426, 54859, 54275, 53675, 53058, 52426,
    51777, 51113, 50433, 49737, 49027, 48301,
    47561, 46807, 46038, 45255, 44458, 43648,
    42824, 41988, 41138, 40277, 39402, 38516,
    37618, 36709, 35788, 34857, 33915, 32962,
    32000, 31028, 30046, 29055, 28056, 27048,
    26031, 25007, 23975, 22936, 21889, 20836,
    19777, 18712, 17641, 16564, 15483, 14397,
    13306, 12212, 11113, 10012,  8907,  7800,
     6690,  5578,  4464,  3350,  2234,  1117,
0 };

int deg1 = (int)degrees;
int deg2 = 90 - deg1;
float module = degrees - deg1;
double vX = DEGREE_LOOKUP_TABLE[deg1] * 0.000015625;
double vZ = DEGREE_LOOKUP_TABLE[deg2] * 0.000015625;
double mX = DEGREE_LOOKUP_TABLE[deg1 + 1] * 0.000015625;
double mZ = DEGREE_LOOKUP_TABLE[deg2 - 1] * 0.000015625;
float vectorX = vX + (mX - vX) * module;
float vectorZ = vZ + (mZ - vZ) * module;
if (quadrant & 1) {
    float tmp = vectorX;
    if (quadrant == 1) { vectorX = -vectorZ; vectorZ = tmp; }
    else { vectorX = vectorZ; vectorZ = -tmp; }
} else if (quadrant == 2) { vectorX = -vectorX; vectorZ = -vectorZ; }

(It could be optimized by doing the * 0.000015625 at compile time in the lookup table itself. And with today's computers, there's little need to keep the table so small. This code is given simply to illustrate the method, not to provide the best implementation.)

It's all done with table lookups and simple arithmetic.

Basically, it makes use of the fact that the general shape of the sine curve repeats every 90° (here called quadrants). The table supplies values at 1° degree intervals, and interpolates for values between adjacent degrees.

Much faster and more precise calculations can be implemented using assembler tailored to the specific hardware.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .