Logarithms between 0 and 1 and ratios
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Juan Gambetta
el 19 de Jul. de 2018
Editada: Dimitris Kalogiros
el 19 de Jul. de 2018
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 comentario
Pawel Jastrzebski
el 19 de Jul. de 2018
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...
Respuesta aceptada
Dimitris Kalogiros
el 19 de Jul. de 2018
Editada: Dimitris Kalogiros
el 19 de Jul. de 2018
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.
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!