Logarithms between 0 and 1 and ratios
2 次查看(过去 30 天)
显示 更早的评论
Hello
I have to divide two things. They are really small, so I did log of both of them and then divided. Now, the thing is that without log, the ratio is less than 1, while, with the log, the ratio is larger than 1. I know this is due to the fact that the smallest number returns a smaller log, which when dividing and cancelling signs, becomes larger. How could I avoid the 'inconsistence' between ratios? I mean, I want to have the same result (ratio less or more than 1) independently of how I do it.
Thank you.
1 个评论
Pawel Jastrzebski
2018-7-19
What is "two things"? What does it mean "really small"? Your whole description is so vague and the description I doubt anyone will be able to catch up with your problem, not to mention coming up with some help. Can you attach some examples of the data you're working on? And the code that you've developed so far that presents the transformation you've described (logging, dividing, cancelling)? This way we can have a look at the problem, not the description of it...
采纳的回答
Dimitris Kalogiros
2018-7-19
编辑:Dimitris Kalogiros
2018-7-19
Hi Juan
Suppose you have to divide two very small numbers x, y. And assume that 0<x<<0 and also 0<y<<0. A mathematical correct method is to exploit the following indentity :
x/y = exp( log( x/y ) ) = exp( log(x) - log(y) )
So, difference of logarithms is a metric of the ratio.
On the other hand, if you want to calculate the ratio, you must use logarithm difference as argunent to exp function.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!