[net.lang.c] Exponetiation

sandman@bucsb.bu.edu.UUCP (Dominick Galang) (06/18/86)

I'm confused. I've been trying to figure out a quick and easy way
to exponetiate to a fraction (ie. x^(4.25))  and also be able to
figure out the power when given the base and the result.  

If anyone can help me out, please send me mail.

		Thanx.

			dg.

sandman@bucsb.bu.edu

brooks@lll-crg.ARpA (Eugene D. Brooks III) (06/19/86)

In article <366@bucsb.bu.edu.UUCP> sandman@bucsb.bu.edu.UUCP (Dominick Galang) writes:
>I'm confused. I've been trying to figure out a quick and easy way
>to exponetiate to a fraction (ie. x^(4.25))  and also be able to
>figure out the power when given the base and the result.  

Try your HP calculator :-)

ark@alice.UucP (Andrew Koenig) (06/19/86)

> I'm confused. I've been trying to figure out a quick and easy way
> to exponetiate to a fraction (ie. x^(4.25))  and also be able to
> figure out the power when given the base and the result.  

a^b is exp(b*ln(a)).  So, if x = a^b and you know a and x,

	exp(b*ln(a)) = x
	b * ln(a) = ln(x)
	b = ln(x) / ln(a)

bs@linus.UUCP (Robert D. Silverman) (06/25/86)

> > I'm confused. I've been trying to figure out a quick and easy way
> > to exponetiate to a fraction (ie. x^(4.25))  and also be able to
> > figure out the power when given the base and the result.  
> 
> a^b is exp(b*ln(a)).  So, if x = a^b and you know a and x,
> 
> 	exp(b*ln(a)) = x
> 	b * ln(a) = ln(x)
> 	b = ln(x) / ln(a)

Better make sure that a,x > 0 before using this well known trick.
Bob Silverman