Results 1 to 3 of 3

Math Help - Use Logs to deal with very large numbers in MATLAB

  1. #1
    Newbie xlxc34's Avatar
    Joined
    Dec 2011
    Posts
    6

    Use Logs to deal with very large numbers in MATLAB

    Hi,

    I'm not entirely sure I'm posting this in the right place as I'm an engineer not a mathmatician, but it's certainly harder than anything I had to do to get my maths A-level before I went to University!

    I'm using the equation below to model cracks forming in a polymer under stress. My problem is this: k (the Boltzmann constant, 1.38 x 10^23... pretty small) is part of the exponential terms. The other variables are more manageable; U is around 1.14 x 10^5, and gamma is around 3.56 x 10^-4. Sigma is the effective stress, and would be around 10^7 Pa or thereabouts. T is the absolute temperature and is about 293K. n(t) is the time at which the polymer becomes macroscopically damaged.


    Use Logs to deal with very large numbers in MATLAB-equation.png

    I'm working with MATLAB, which is limited by the IEEE 'double' precision. This means it can deal with numbers up to about 1.7*10^308. Unfortunately, if you try and perform exp(-U/kT), -U/kT is about -2 x 10^25, so MATLAB returns 0. Similarly, for exp(gamma.sigma/kT) it returns infinity. I'm sure it is possible to rescale the problem somehow or work in logs to get around this but I can't figure out how you'd do this. Can anyone offer any help on this? It will be much appreciated!

    Thanks,

    Pete
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4

    Re: Use Logs to deal with very large numbers in MATLAB

    Quote Originally Posted by xlxc34 View Post
    Hi,

    I'm not entirely sure I'm posting this in the right place as I'm an engineer not a mathmatician, but it's certainly harder than anything I had to do to get my maths A-level before I went to University!

    I'm using the equation below to model cracks forming in a polymer under stress. My problem is this: k (the Boltzmann constant, 1.38 x 10^23... pretty small) is part of the exponential terms. The other variables are more manageable; U is around 1.14 x 10^5, and gamma is around 3.56 x 10^-4. Sigma is the effective stress, and would be around 10^7 Pa or thereabouts. T is the absolute temperature and is about 293K. n(t) is the time at which the polymer becomes macroscopically damaged.


    Click image for larger version. 

Name:	equation.png 
Views:	19 
Size:	11.1 KB 
ID:	23057

    I'm working with MATLAB, which is limited by the IEEE 'double' precision. This means it can deal with numbers up to about 1.7*10^308. Unfortunately, if you try and perform exp(-U/kT), -U/kT is about -2 x 10^25, so MATLAB returns 0. Similarly, for exp(gamma.sigma/kT) it returns infinity. I'm sure it is possible to rescale the problem somehow or work in logs to get around this but I can't figure out how you'd do this. Can anyone offer any help on this? It will be much appreciated!

    Thanks,

    Pete
    First thing to do is combine those two exponentials and see if you still overflow the exponentiation.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie xlxc34's Avatar
    Joined
    Dec 2011
    Posts
    6

    Re: Use Logs to deal with very large numbers in MATLAB

    Thanks for the reply... I think I might be quite close to achieving it using logs. I'm trying it with all the variables set to near 1 so it doesn't throw up such crazy numbers just to test it out, but I'm having trouble expanding a big set of brackets.

    say I want take the log of both sides of this equation:

    Z=-A*exp(-B)*exp(C)*(D*exp(E)-D*exp(F));

    I know that to take the log of a series of terms multiplied together you do for example

    log(A*B*exp(C)*D)=log(A)+log(B)+C+log(D)

    What I have is effectively

    Z=exp(A*exp(B)*exp(C)*D*exp(E*t2)-A*exp(B)*exp(C)*D*exp(E*t1));
    logZ=A*exp(B)*exp(C)*D*exp(E*t2)-A*exp(B)*exp(C)*D*exp(E*t1);
    loglogZ=?

    So yeah, how do I take the log of two numbers added together?

    Thanks again for your help, I will hopefully be able to resolve this tomorrow when I'm able to access my trusty copy of Engineering Mathmatics by Stroud but just in case there isn't anything in there I'd like to get it worked out!
    Last edited by xlxc34; December 11th 2011 at 11:57 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Divide two large numbers
    Posted in the Advanced Applied Math Forum
    Replies: 1
    Last Post: May 17th 2011, 06:56 AM
  2. law of large numbers
    Posted in the Advanced Statistics Forum
    Replies: 0
    Last Post: February 12th 2011, 12:39 PM
  3. Law of Large Numbers
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: August 3rd 2009, 12:53 AM
  4. The Strong Law of Large Numbers
    Posted in the Advanced Math Topics Forum
    Replies: 3
    Last Post: January 18th 2006, 02:48 PM
  5. The Strong Law of Large Numbers
    Posted in the Advanced Statistics Forum
    Replies: 5
    Last Post: November 18th 2005, 10:21 AM

Search Tags


/mathhelpforum @mathhelpforum