How to treat with logarithm numerically when it becomes negative?

asked 2013-03-12 10:38:41 +0200

ela gravatar image

I have a term log(f(x)) in my equations which I am trying to solve them numerically. But the solver does not solve, perhaps when the argument of the logarithm becomes negative. What should I write in the program when f(x)<0 in the loop in order not to loose the iteration?

Thanks

edit retag flag offensive close merge delete

Comments

I think you have to provide more details. In general, log of a negative number does make sense, but it is multi-valued.

kcrisman gravatar imagekcrisman ( 2013-03-12 11:09:40 +0200 )edit

you mean detail in the program?

ela gravatar imageela ( 2013-03-13 03:55:57 +0200 )edit

Have you tried: find_root(log(x*x-x),-2,0) -0.6180339887498988 find_root(log(x*x-x),-2,2) 1.6180339887498947

achrzesz gravatar imageachrzesz ( 2013-03-13 08:07:42 +0200 )edit