C/Math/Tan ATan

Материал из C\C++ эксперт
Перейти к: навигация, поиск

Calculate arctangent, 2 parameters: how to use atan2

#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main ()
{
  double x, y, result;
  x = 0;
  y = 6;
  result = atan2 (y, x) * 180 / PI;
  printf ("Arctangent for (x = %lf, y = %lf) is %lf degrees\n", x, y, result );
  return 0;
}


Calculate arctangent: how to use atan

#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main ()
{
  double v, result;
  v = 5;
  
  result = atan ( v ) * 180 / PI;
  printf ("Arctangent of %lf is %lf degrees\n", v, result );
  return 0;
}


Calculate hyperbolic tangent: how to use tanh

#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main ()
{
  double param, result;
  param = 60;
  result = tanh (param*PI/180);
  printf ("Hyperbolic tangent of %lf degrees is %lf\n", param, result );
  return 0;
}


Calculate tangent: tan

#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main () {
  double param, result;
  param = 45;
  result = tan ( param * PI / 180);
  printf ("Tangent  %lf degrees = %lf\n", param, result );
  return 0;
}


How to use atan

#include <math.h>
#include <stdio.h>
int main(void) 
{
  double val = -1.0;
  do {
    printf("Arc tangent of %f is %f.\n", val, atan(val));
    val += 0.1;
  } while(val<=1.0);
  return 0;
}


How to use atan2

#include <math.h>
#include <stdio.h>
int main(void)
{
  double val = -1.0;
  do {
    printf("Atan2 of %f is %f.\n", val, atan2(val,1.0));
    val += 0.1;
  } while(val<=1.0);
  return 0;
}


How to use tan

#include <math.h>
#include <stdio.h>
int main(void)
{
  double val = -1.0;
  do {
    printf("Tangent of %f is %f.\n", val, tan(val));
    val += 0.1;
  } while(val<=1.0);
  return 0;
}


Hyperbolic tangent: how to use tanh

#include <math.h>
#include <stdio.h>
int main(void)
{
  double val = -1.0;
  do {
    printf("Hyperbolic tangent of %f is %f.\n", val, tanh(val));
    val += 0.1;
  } while(val<=1.0);
  return 0;
}