Maths help please!

Discuss anything interesting but not remotely Countdown-related here.

Moderator: Jon O'Neill

Post Reply
User avatar
Jon Corby
Moral Hero
Posts: 8021
Joined: Mon Jan 21, 2008 8:36 am

Maths help please!

Post by Jon Corby »

Okay, I'm having a blank moment. It feels like there should be a very easy answer to this, but possibly not.

If I've got this set of data where a = 2^b, how do I determine the value of a if I'm given b? Is there an easy formula or do I have to use calculus or something like that? I can obviously do it in a loop with code (which is what I'm about to do, as it won't really ever have to do more than about a dozen iterations to get near enough to the answer to be usable, so it's not a huge overhead), but I wondered if there was a neater way and it bugs me that I should probably know how to do it...
User avatar
Kai Laddiman
Fanatic
Posts: 2314
Joined: Wed Oct 15, 2008 3:37 pm
Location: My bedroom

Re: Maths help please!

Post by Kai Laddiman »

That's odd, I've never really considered doing that without programming. There's probably an Egyptian technique somewhere, I'll have a look.
16/10/2007 - Episode 4460
Dinos Sfyris 76 - 78 Dorian Lidell
Proof that even idiots can get well and truly mainwheeled.
User avatar
Jon Corby
Moral Hero
Posts: 8021
Joined: Mon Jan 21, 2008 8:36 am

Re: Maths help please!

Post by Jon Corby »

Kai Laddiman wrote:That's odd, I've never really considered doing that without programming. There's probably an Egyptian technique somewhere, I'll have a look.
Oh okay, I assumed I was being dim. I was just a bit annoyed looking at such a simple set of data (actually my real data wasn't quite so simple, but the same principle applied) that I couldn't work out a simple formula. Maybe there isn't one then.
User avatar
Ian Fitzpatrick
Devotee
Posts: 620
Joined: Sat Jan 31, 2009 12:23 pm
Location: Wimborne, Dorset

Re: Maths help please!

Post by Ian Fitzpatrick »

Jon Corby wrote:Okay, I'm having a blank moment. It feels like there should be a very easy answer to this, but possibly not.

If I've got this set of data where a = 2^b, how do I determine the value of a if I'm given b? Is there an easy formula or do I have to use calculus or something like that? if there was a neater way and it bugs me that I should probably know how to do it...
Just trying to wind up these old cogs of mine and I think it's done like this:
Take logs of both sides:
log a = b*log 2
therefore
b=(log a)/log 2

Hope that helps, it's been a long long time!!!!!!!!!
I thought I was good at Countdown until I joined this forum
User avatar
Jon Corby
Moral Hero
Posts: 8021
Joined: Mon Jan 21, 2008 8:36 am

Re: Maths help please!

Post by Jon Corby »

Ian Fitzpatrick wrote:
Jon Corby wrote:Okay, I'm having a blank moment. It feels like there should be a very easy answer to this, but possibly not.

If I've got this set of data where a = 2^b, how do I determine the value of a if I'm given b? Is there an easy formula or do I have to use calculus or something like that? if there was a neater way and it bugs me that I should probably know how to do it...
Just trying to wind up these old cogs of mine and I think it's done like this:
Take logs of both sides:
log a = b*log 2
therefore
b=(log a)/log 2

Hope that helps, it's been a long long time!!!!!!!!!
Wow, you're a genius! That does help in that it shows me how it's done, makes me feel a bit better for not being able to work it out myself (despite being a little bit mathsy, I can't think I actually know how to use logarithms anywhere), but I'll actually leave my code as it is (with the loop) as it's much easier to follow and tinker with. Thanks though!
User avatar
Michael Wallace
Racoonteur
Posts: 5458
Joined: Mon Jan 21, 2008 5:01 am
Location: London

Re: Maths help please!

Post by Michael Wallace »

Jon Corby wrote:
Ian Fitzpatrick wrote:
Jon Corby wrote:Okay, I'm having a blank moment. It feels like there should be a very easy answer to this, but possibly not.

If I've got this set of data where a = 2^b, how do I determine the value of a if I'm given b? Is there an easy formula or do I have to use calculus or something like that? if there was a neater way and it bugs me that I should probably know how to do it...
Just trying to wind up these old cogs of mine and I think it's done like this:
Take logs of both sides:
log a = b*log 2
therefore
b=(log a)/log 2

Hope that helps, it's been a long long time!!!!!!!!!
Wow, you're a genius! That does help in that it shows me how it's done, makes me feel a bit better for not being able to work it out myself (despite being a little bit mathsy, I can't think I actually know how to use logarithms anywhere), but I'll actually leave my code as it is (with the loop) as it's much easier to follow and tinker with. Thanks though!
You said you wanted to calculate a given b, not b given a...
User avatar
Kai Laddiman
Fanatic
Posts: 2314
Joined: Wed Oct 15, 2008 3:37 pm
Location: My bedroom

Re: Maths help please!

Post by Kai Laddiman »

Michael Wallace wrote:You said you wanted to calculate a given b, not b given a...
I can't remember much about logarithms, but I think that means ln a = 2 * ln b => a = e^(2 * ln b). You might want to check that.
16/10/2007 - Episode 4460
Dinos Sfyris 76 - 78 Dorian Lidell
Proof that even idiots can get well and truly mainwheeled.
Gavin Chipper
Post-apocalypse
Posts: 13315
Joined: Mon Jan 21, 2008 10:37 pm

Re: Maths help please!

Post by Gavin Chipper »

a = 2 ^ b
User avatar
Jon Corby
Moral Hero
Posts: 8021
Joined: Mon Jan 21, 2008 8:36 am

Re: Maths help please!

Post by Jon Corby »

Michael Wallace wrote:You said you wanted to calculate a given b, not b given a...
Haha, oh yeah. I obviously meant the other way around.
JackHurst
Series 63 Champion
Posts: 2020
Joined: Tue Jan 20, 2009 8:40 pm

Re: Maths help please!

Post by JackHurst »

Kai Laddiman wrote:
Michael Wallace wrote:You said you wanted to calculate a given b, not b given a...
I can't remember much about logarithms, but I think that means ln a = 2 * ln b => a = e^(2 * ln b). You might want to check that.
You could simplify that further;
a=e^(2*lnb)
=e^(lnb*2)
=(e^lnb)^2
=b^2

Not that that's any help to the OP.
User avatar
Charlie Reams
Site Admin
Posts: 9494
Joined: Fri Jan 11, 2008 2:33 pm
Location: Cambridge
Contact:

Re: Maths help please!

Post by Charlie Reams »

Kai Laddiman wrote:
Michael Wallace wrote:You said you wanted to calculate a given b, not b given a...
I can't remember much about logarithms, but I think that means ln a = 2 * ln b => a = e^(2 * ln b). You might want to check that.
Definitely something wrong here, I'm not sure how you got the first expression. a=b^2 is obviously not consistent with a=2^b which you started with.
User avatar
Ian Volante
Postmaster General
Posts: 3967
Joined: Wed Sep 03, 2008 8:15 pm
Location: Edinburgh
Contact:

Re: Maths help please!

Post by Ian Volante »

Ian Fitzpatrick wrote:
Jon Corby wrote:Okay, I'm having a blank moment. It feels like there should be a very easy answer to this, but possibly not.

If I've got this set of data where a = 2^b, how do I determine the value of a if I'm given b? Is there an easy formula or do I have to use calculus or something like that? if there was a neater way and it bugs me that I should probably know how to do it...
Just trying to wind up these old cogs of mine and I think it's done like this:
Take logs of both sides:
log a = b*log 2
therefore
b=(log a)/log 2

Hope that helps, it's been a long long time!!!!!!!!!
I'm also dredging up old maths memories, but can you do:

b=(log a)/log 2
b=log a (log to the base 2)

Very helpful of course.
Last edited by Ian Volante on Fri Jan 14, 2011 6:27 pm, edited 1 time in total.
meles meles meles meles meles meles meles meles meles meles meles meles meles meles meles meles
User avatar
Kai Laddiman
Fanatic
Posts: 2314
Joined: Wed Oct 15, 2008 3:37 pm
Location: My bedroom

Re: Maths help please!

Post by Kai Laddiman »

Charlie Reams wrote:
Kai Laddiman wrote:
Michael Wallace wrote:You said you wanted to calculate a given b, not b given a...
I can't remember much about logarithms, but I think that means ln a = 2 * ln b => a = e^(2 * ln b). You might want to check that.
Definitely something wrong here, I'm not sure how you got the first expression. a=b^2 is obviously not consistent with a=2^b which you started with.
Oops, went wrong there, sorry. It's sort of irrelevant now that Corby's changed his initial question anyway.
16/10/2007 - Episode 4460
Dinos Sfyris 76 - 78 Dorian Lidell
Proof that even idiots can get well and truly mainwheeled.
Post Reply