|
| |||||||||
| Tags: cpp, functions, header files, library, tanh, valarray |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| 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
| ||||
| ||||
| 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
| |||
| |||
| 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
| ||||
| ||||
| 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;
} Code: f: 0.35 1.22 3.4 br: 0.335376 0.839654 0.997775 |
|
#5
| ||||
| ||||
| 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
| ||||
| ||||
| 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);
} Code: tanh( 0.785398 ) = 0.655794 |
![]() |
|
| Thread Tools | Search this Thread |
| |
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 | 09-04-2009 12:07 AM |