# Inverse Functions in Math

Discussion in 'C Programming' started by a.dheeraj.kumar@gmail.com, Jul 1, 2005.

1. ### Guest

i know that there is a function to find the logarithm of a number, sin,
cos, tan etc. but are there which can find sin^-1, cos^-1, tan^-1 and
antilog of a given number?

PS: sin^-1 means sin inverse. eg:
if sin 30 =1/2
30=sin inverse of 1/2

HELP!

, Jul 1, 2005

2. ### Dik T. WinterGuest

In article <> writes:
> i know that there is a function to find the logarithm of a number, sin,
> cos, tan etc. but are there which can find sin^-1, cos^-1, tan^-1 and
> antilog of a given number?
>
> PS: sin^-1 means sin inverse. eg:
> if sin 30 =1/2
> 30=sin inverse of 1/2

asin, acos, atan and exp.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/

Dik T. Winter, Jul 1, 2005

3. ### Guest

thanks man, i understood all functions except exp function.

can you tell me how to use this function to find the antilog of
0.something to base 10, and also how to make it work for different bases

, Jul 1, 2005
4. ### REHGuest

<> wrote in message
news:...
> thanks man, i understood all functions except exp function.
>
> can you tell me how to use this function to find the antilog of
> 0.something to base 10, and also how to make it work for different bases
>

The exp function is just like the pow function but with a constant base,
namely e. If you want "exp" with 10 or other bases, use pow.

REH

REH, Jul 1, 2005
5. ### Walter RobersonGuest

In article <>,
<> wrote:
>thanks man, i understood all functions except exp function.

>can you tell me how to use this function to find the antilog of
>0.something to base 10, and also how to make it work for different bases

(Using non-C notation in this portion)

Log{N}[x] -> ln[x] / ln[N]

so

ln[x] -> Log{N}[x] * ln[N]

so

exp[ln[x]] -> exp[ Log{N}[x] * ln[N] ]

hence

x -> exp[ Log{N}[x] * ln[N] ]

Hence, to find the antilog of something base 10, Y, take
(using C notation)

exp(Y * log(10.))

For example, log10(1000.) = 3., ln(10.) ~= 2.3025851, and
exp( 3. * 2.3025851 ) = exp( 6.9077553 ) ~= 1000.0

--
Studies show that the average reader ignores 106% of all statistics
they see in .signatures.

Walter Roberson, Jul 1, 2005
6. ### Rouben RostamianGuest

In article <da3t5q\$4hi\$>,
Walter Roberson <-cnrc.gc.ca> wrote:
>
>Hence, to find the antilog of something base 10, Y, take
>(using C notation)
>
> exp(Y * log(10.))

Or simply:

pow(10., Y)

--
Rouben Rostamian

Rouben Rostamian, Jul 1, 2005
7. ### CBFalconerGuest

wrote:
>
> i know that there is a function to find the logarithm of a number, sin,
> cos, tan etc. but are there which can find sin^-1, cos^-1, tan^-1 and
> antilog of a given number?
>
> PS: sin^-1 means sin inverse. eg:
> if sin 30 =1/2
> 30=sin inverse of 1/2

Such as arcsin or asin, and exp?

--
Chuck F () ()
Available for consulting/temporary embedded and systems.

CBFalconer, Jul 1, 2005
8. ### Martin AmbuhlGuest

wrote:
> thanks man, i understood all functions except exp function.
>
> can you tell me how to use this function to find the antilog of
> 0.something to base 10, and also how to make it work for different bases

pow(base, x) == exp(x * log(base)) :

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <time.h>

int main(void)
{
double x, y;
int i;
double M_log10 = log(10);
srand(time(0));

printf("exp(x) is the antilog(x, base=%.*g)\n\n", DBL_DIG, exp(1));

for (i = 0; i < 10; i++) {
x = rand() / (1. + RAND_MAX);
y = exp(x),
printf("exp(%g) = %g, log(%g) = %g\n", x, y, y, log(y));
y = pow(10, x);
printf("pow(10, %g) = %g, log10(%g) = %g\n", x, y, y, log10(y));
y = exp(x * M_log10);
printf("exp(%g * log(10)) = %g, log10(%g) = %g\n\n",
x, y, y, log10(y));
}
return 0;
}

This is the result of one run:

exp(x) is the antilog(x, base=2.71828182845905)

exp(0.540308) = 1.71654, log(1.71654) = 0.540308
pow(10, 0.540308) = 3.46983, log10(3.46983) = 0.540308
exp(0.540308 * log(10)) = 3.46983, log10(3.46983) = 0.540308

exp(0.655142) = 1.92542, log(1.92542) = 0.655142
pow(10, 0.655142) = 4.52004, log10(4.52004) = 0.655142
exp(0.655142 * log(10)) = 4.52004, log10(4.52004) = 0.655142

exp(0.430014) = 1.53728, log(1.53728) = 0.430014
pow(10, 0.430014) = 2.69162, log10(2.69162) = 0.430014
exp(0.430014 * log(10)) = 2.69162, log10(2.69162) = 0.430014

exp(0.656084) = 1.92723, log(1.92723) = 0.656084
pow(10, 0.656084) = 4.52985, log10(4.52985) = 0.656084
exp(0.656084 * log(10)) = 4.52985, log10(4.52985) = 0.656084

exp(0.567552) = 1.76394, log(1.76394) = 0.567552
pow(10, 0.567552) = 3.69447, log10(3.69447) = 0.567552
exp(0.567552 * log(10)) = 3.69447, log10(3.69447) = 0.567552

exp(0.346806) = 1.41454, log(1.41454) = 0.346806
pow(10, 0.346806) = 2.22232, log10(2.22232) = 0.346806
exp(0.346806 * log(10)) = 2.22232, log10(2.22232) = 0.346806

exp(0.418147) = 1.51914, log(1.51914) = 0.418147
pow(10, 0.418147) = 2.61907, log10(2.61907) = 0.418147
exp(0.418147 * log(10)) = 2.61907, log10(2.61907) = 0.418147

exp(0.859071) = 2.36097, log(2.36097) = 0.859071
pow(10, 0.859071) = 7.22888, log10(7.22888) = 0.859071
exp(0.859071 * log(10)) = 7.22888, log10(7.22888) = 0.859071

exp(0.824404) = 2.28052, log(2.28052) = 0.824404
pow(10, 0.824404) = 6.67427, log10(6.67427) = 0.824404
exp(0.824404 * log(10)) = 6.67427, log10(6.67427) = 0.824404

exp(0.225011) = 1.25234, log(1.25234) = 0.225011
pow(10, 0.225011) = 1.67885, log10(1.67885) = 0.225011
exp(0.225011 * log(10)) = 1.67885, log10(1.67885) = 0.225011

Martin Ambuhl, Jul 1, 2005