[R] Exponentiate very large numbers
Spencer Graves
spencer.graves at structuremonitoring.com
Tue Feb 5 11:47:16 CET 2013
I don't understand the problem: Do you mean that given either
"a" or "b", solve for the other? Otherwise, I don't see an unknown in
the problem statement.
Further, do you mean that "exp( ln(a) ) - exp( ln(0.1) + ln(b) )
= 0"?
Or equivalently, "exp( ln(a) ) = exp( ln(0.1) + ln(b) )"?
If given either "a" or "b" you want to solve for the other in
this last expression? If yes, note that since exp is monotonic, the
equation above is true if and only if
ln(a) = ln(0.1) + ln(b).
Given "b" -- or ln(b) -- you can solve this for "a". ???
hope this helps.
Spencer Graves
On 2/4/2013 10:58 AM, Rui Barradas wrote:
> Sorry, it should be:
>
> Divide both terms by exp(log(0.1) + log.b) to give
>
> tmp1 <- exp(log.a - log(0.1) - log.b) - 1
> result <- tmp1 * exp(log(0.1) + log.b)
>
>
> Rui Barradas
>
> Em 04-02-2013 18:53, Rui Barradas escreveu:
>> Hello,
>>
>> Use a simple transfomation. Divide both t
>>
>> log.a <- 1347
>> log.b <- 1351
>> tmp1 <- exp(log.a - log(0.1) - log.b) - 1
>> result <- tmp1 * exp(0.1 + log.b) # -Inf
>>
>> Using base 10, the result would be
>>
>> -4.405386507*10^585
>>
>> a number too large for R. See the help page ?.Machine
>>
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>>
>> Em 04-02-2013 15:11, francesca casalino escreveu:
>>> Dear R experts,
>>>
>>> I have the logarithms of 2 values:
>>>
>>> log(a) = 1347
>>> log(b) = 1351
>>>
>>> And I am trying to solve this expression:
>>>
>>> exp( ln(a) ) - exp( ln(0.1) + ln(b) )
>>>
>>> But of course every time I try to exponentiate the log(a) or log(b)
>>> values I get Inf. Are there any tricks I can use to get a real result
>>> for exp( ln(a) ) - exp( ln(0.1) + ln(b) ), either in logarithm or
>>> exponential form?
>>>
>>>
>>> Thank you very much for the help
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
--
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph: 408-655-4567
web: www.structuremonitoring.com
More information about the R-help
mailing list