TechArena Community The tanh() function of C++
 User Name Remember Me? Password

#1
09-03-2010
 Member Join Date: Dec 2009 Posts: 31
The tanh() function of C++

I am the student of the Bachelor of science in Information Technology. I have know about the C++ language. I am finding the problem while using the tanh() function in the C++ program. I want to know about the tanh() function of the C++ language. I also want know how can I implement these functions in my C++ program. Thus, Anyone knows about the these functions ? Please, Help me!!
#2
09-03-2010
 Member Join Date: Apr 2008 Posts: 1,948
The tanh() function of C++

The tanh() function of the C++ language can be used to compute the hyperbolic tangent of the valarray of an elements. The tanh() function of the C++ language can returns an object of the valarray that can be containing the hyperbolic tangents of all of an elements of y. The tanh() function can an overloads c math's tanh function.
#3
09-03-2010
 Member Join Date: May 2008 Posts: 2,008
Re: The tanh() function of C++

The tanh() function of the C++ language used to find out the tangent of an given element. The tanh() function can be a member function of the valarray. The following can be the general form of the tanh() function of the C++ language :
Code:
template<class S> valarray<S> tanh (const valarray<S>& y);
#4
09-03-2010
 Member Join Date: Apr 2008 Posts: 2,001
Use of the tanh() function

I can suggest you that to carefully go through the following code of lines that can demonstrates you how to use the tanh() function in the C++ programming as follows :
Code:
#include <iostream>
#include <cmath>
#include <valarray>
using namespace std;
int main ()
{
double vl[] = {0.35, 1.22, 3.4};
vlarray<double> f (vl,3);
vlarray<double> br = tanh (f);
cout << "f: ";
for (size_t k=0; k<f.size(); ++k)
cout << f[k] << ' ';
cout << endl;
cout << "br: ";
for (size_t k=0; k<br.size(); ++k)
cout << br[k] << ' ';
cout << endl;
return 0;
}
Output:
Code:
f: 0.35 1.22 3.4
br: 0.335376 0.839654 0.997775
#5
09-03-2010
 Member Join Date: May 2008 Posts: 2,293
Re: The tanh() function of C++

A valarray whose elements can be equal to the hyperbolic cos of an elements of the input valarray. The following can be the parameters of the tanh() function in the C++ programming language :
1. y : This parameter of the tanh() function can be used to contains a valarray that can be containing an elements of a type for that the unary function tanh can be defined.
#6
09-03-2010
 Member Join Date: Nov 2005 Posts: 1,323
Re: The tanh() function of C++

The following can be an example that can uses the tanh() function of the C++ language to illustrate the tanh(0 function. The following an example can calculates y as the hyperbolic tangent of &pi./4.
Code:
#include <math.h>
#include <stdio.h>
int main(void)
{
double pi, y;
pi = 3.1415926;
y = tanh(pi/4);
printf("tanh( %lf ) = %lf\n", pi/4, y);
}
Output :
Code:
tanh( 0.785398 ) = 0.655794

 Tags:

 Thread Tools Search this Thread Search this Thread: Advanced Search

 Similar Threads for: "The tanh() function of C++" Thread Thread Starter Forum Replies Last Post c++ equivalent function to the c-function 'sprintf Dilbert Software Development 6 13-12-2011 04:03 PM c# function equivalent to gettime function in javascript Omaar Software Development 4 10-03-2010 10:44 PM How to pass function with parameters to another function in PHP? Linoo Software Development 5 27-02-2010 07:52 PM How does abstract function differs from virtual function? Maddox G Software Development 5 29-01-2010 11:32 AM Function keys don't function under windows XP GunFighter Hardware Peripherals 3 08-04-2009 11:07 PM

All times are GMT +5.5. The time now is 06:22 PM.

 Contact Us - TechArena - Privacy Statement - Terms of Service - SiteMap