Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: Math problems of Brain Anerisms  (Read 3027 times)

Neonivek

  • Bay Watcher
    • View Profile
Re: Natural Log is going to kill me
« Reply #15 on: September 28, 2012, 12:37:41 am »

Why don't you just search for "why natural log" or something.

It's not thaaaat hard to find things.

Because I know what natural log is, I know what it is used for... I don't understand it and I cannot naturally use it.

I was hoping for tips that people have used personally and more down to earth explanations.
It's the inverse of exponentiation. Whenever you want to un-exponentiate something, you use it.

why would I want to do that? In the case when the exponent is X+1? Because that just gives me LogX+1 >_< and the nightmare begins.

Or would that be LNX+1 AHH!
« Last Edit: September 28, 2012, 12:56:02 am by Neonivek »
Logged

Eidolon

  • Bay Watcher
  • Floating weightless in a cavern.
    • View Profile
Re: Natural Log is going to kill me
« Reply #16 on: September 28, 2012, 12:56:27 am »

Logs have some useful properties. I won't bother going over all of them, but an algebra student should know this one.

For example: Lets solve 5^x = 25. (edit: the symbol ^ in this represents "five raised to the power of x", if you weren't familiar with that.)
Now, just looking at it, you might be able to guess 2 for x and be correct. If the numbers were uglier though, you wouldn't be able to guess, so that's were this would apply.

If you take the natural log of both sides, you get
ln(5^x) = ln(25)

Now, a property of logs is that if the quantity inside the log is raised to a power, that power can be pulled down to the outside of the log as if it were being multiplied. ie:
x * ln(5) = ln(25)

If you divide both sides by ln(5), you get:
x = ln(25)/ln(5)

Now, you could plug those values in the right in on your calculator, and get 2. Again, this is a simple example. If the numbers were ugly, this would be more useful.

_______

The number e is important in statistics and calculus because it helps model exponential decay and exponential growth. Also, if you have the equation y = e^x and you graph it, it turns out that the slope of that graph for any given x value is e^x. This isn't true for any number in the base besides e, which is why it's a "special" number.
« Last Edit: September 28, 2012, 12:58:47 am by Eidolon »
Logged
In ancient times, men built wonders, laid claim to the stars, and sought to better themselves for the good of all.
But we are much wiser now.

ed boy

  • Bay Watcher
    • View Profile
Re: Natural Log is going to kill me
« Reply #17 on: September 28, 2012, 01:30:53 am »

Why don't you just search for "why natural log" or something.

It's not thaaaat hard to find things.

Because I know what natural log is, I know what it is used for... I don't understand it and I cannot naturally use it.

I was hoping for tips that people have used personally and more down to earth explanations.
It's the inverse of exponentiation. Whenever you want to un-exponentiate something, you use it.

why would I want to do that? In the case when the exponent is X+1? Because that just gives me LogX+1 >_< and the nightmare begins.

Or would that be LNX+1 AHH!
No, log(ex+1) is x+1. The addition can't escape the logarithm.
Logged

Neonivek

  • Bay Watcher
    • View Profile
Re: Natural Log is going to kill me
« Reply #18 on: September 28, 2012, 01:52:21 am »

ahuh, but why would that be helpful if I cannot get that X+1?
Logged

ed boy

  • Bay Watcher
    • View Profile
Re: Natural Log is going to kill me
« Reply #19 on: September 28, 2012, 04:08:18 am »

ahuh, but why would that be helpful if I cannot get that X+1?
But you can get that x+1. If you know ex+1, then you can just apply the natural log to that to get x+1. Or do you mean something else?
Logged

Grek

  • Bay Watcher
    • View Profile
Re: Natural Log is going to kill me
« Reply #20 on: September 28, 2012, 04:34:03 am »

Ok, real life uses:

Once upon a time, I was coding a automatic rock-paper-scissors program that would try to predict what the human player would do and play moves to counter it. Version 1 of it used Bayes theorem to do the predictions. Bayes theorem for multiple sources of evidence (ie. multiple rounds of Rock-Paper-Scissors) is:
P(H|Etotal)=P(H) * [P(E1|H)/P(E)] * [P(E2|H)/P(E)] * [P(E3|H)/P(E)] * ... * [P(En|H)/P(E)]

which is definitely way too much division, since each instance of division can potentially add a couple of decimal places onto the final result, and a variable can only go out to so many decimal places before it stops recording them. Enter the natural log.

Since x/y = e^[ln(x)-ln(y)], I realized that could just add have a variable called "logprob" that gets ln(En|H)-ln(E) added to it every round and take e^logprob everytime I need to update the value of realprob. Except THEN I realized that since I was only checking to find the greatest out of P(rock), P(paper) or P(scissors) and playing the counter to that. I could skip the e^logprob step. Why?

Because for all values of f(x)=e^ln(x) and f(y)=e^ln(y) where f(x)>f(y), x>y too, due to how logarithims work.
« Last Edit: September 28, 2012, 04:35:43 am by Grek »
Logged

Jim Groovester

  • Bay Watcher
  • 1P
    • View Profile
Re: Natural Log is going to kill me
« Reply #21 on: September 28, 2012, 05:02:38 am »

Logarithms reduce the complexity of expressions even if at first glance they don't. It has the useful properties of:

1. Reducing multiplication into addition
2. Reducing exponentiation into multiplication

Read up on slide rules, the things people used to use to calculate things in ye olden days before computers were widely available. That's an application of logarithms, and it's even in easy to see ruler form.
Logged
I understood nothing, contributed nothing, but still got to win, so good game everybody else.

Neonivek

  • Bay Watcher
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #22 on: January 30, 2013, 07:26:30 pm »

Latest issue

G(x) = 4x^1/3 + x^4/3
G'(x) = 4/3 ((1+x)/(X^2 CUBED))

How did this happen?
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #23 on: January 30, 2013, 07:45:48 pm »

G(x) = 4*x^1/3 + x*x^1/3
G(x) = (4+x)*x^1/3

Chain rule:
G'(x) = x^1/3 + 1/3*(4+x)*x^-2/3
G'(x) = x*x^-2/3 + 1/3*(4+x)*x^-2/3
G'(x) = (x+4/3+1/3*x)*x^-2/3
G'(x) = 4/3*(1+x)+x^-2/3

And that last line should be equal to your last formula.
Logged

Il Palazzo

  • Bay Watcher
  • And lo, the Dude did abide. And it was good.
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #24 on: January 30, 2013, 08:01:22 pm »

Latest issue

G(x) = 4x^1/3 + x^4/3
G'(x) = 4/3 ((1+x)/(X^2 CUBED))

How did this happen?
Virex was quicker than me, but I'm using different approach, so you might find it useful.

(I presume you meant cubic root there, as that's what I'm getting.)

First perform derivation:

d( f^n ) = n f^{n-1} df    {1}

keeping in mind that:

d(af+bg) = a df + b dg, meaning just that you can do each of the two elements of the sum separately

Using equation {1} you end up with:

G'(x) = 4/3x^(-2/3) + 4/3x^(1/3)

isolate the constant terms:

G'(x) = 4/3(x^(-2/3) + x^(1/3))   {2}

x^(-2/3) means just that it's the same as 1/(x^(2/3)), so you need a common denominator for the two terms in the parenthesis in {2} to be able to add them.

We do this by multiplying x^(1/3) by x^(2/3)/x^(2/3) and end up with

G'(x) = 4/3 (1/x^(2/3)+x/x^(2/3))

or

G'(x) = 4/3 ((1+x)/(x^2/3))
Logged

Neonivek

  • Bay Watcher
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #25 on: January 30, 2013, 08:08:26 pm »

Thank you.
Logged

eerr

  • Bay Watcher
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #26 on: January 31, 2013, 12:39:12 am »

Log base 10 of 2000000
=6*log2

If that helps any

Ln e=
1

Log b10 of 10=
1

Log b10 of 1 =
0

Log b10 of .10=
-1

Log literally means the exponent over (10) which is equal to what you have now.

Ln is likewise for 2.7 something or other(e).
Logged

Grek

  • Bay Watcher
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #27 on: January 31, 2013, 01:59:30 am »

Ln is the base e log. e is a transcendental number (like pi!) and is calculated by taking the limit of [1+n^-1]^n as n goes to infinity. It comes out to about 2.71828182845904523536028747135266249775724709369995... but, being a transcendental number, keeps going on forever.
Logged

Neonivek

  • Bay Watcher
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #28 on: January 31, 2013, 04:39:25 am »

When numbers go on forever you want to be careful you don't lose significance.

It is where 2+2=5 junk often comes from.
Logged

Aerie

  • Bay Watcher
  • Mae fy hofrenfad yn llawn llyswennod.
    • View Profile
Re: Math problems of Brain Anerisms
« Reply #29 on: February 04, 2013, 11:01:02 pm »

« Last Edit: February 04, 2013, 11:24:17 pm by Aerie »
Logged
Play my forum game, The Darkness Below!
Pages: 1 [2] 3