Re: How to treat this false singular point?

*To*: mathgroup at smc.vnet.net*Subject*: [mg68440] Re: How to treat this false singular point?*From*: "Ray Koopman" <koopman at sfu.ca>*Date*: Sat, 5 Aug 2006 03:46:40 -0400 (EDT)*References*: <easkcp$g3j$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

simon yang wrote: > Dear everyone, > I have a function: > f[x_]:=(x-x1)Log[Abs[x-x1]] + (x-x2)Log[Abs[x-x2]] + ... + > (x-xn)Log[Abs[x-xn]], > {x1,x2,...,xn}={100,200,300,...} for instance > How to get value: f[x] as there are different singular at different x? > I know at x=xn, f[x]==1, But Mathematica return: "Indeterminate", What > should I do? > what others do in C++, Fortran ? The easiest way would be Unprotect[Log]; Log[0] = 0; Log[0.] = 0; Protect[Log]; That would do what you want here, but might cause problems elsewhere. Another way would be to define a new function xLog[0] = 0; xLog[0.] = 0; xLog[x_] := x*Log[Abs[x]] Then f[x_] := Tr@Map[xLog,x-{100,200,...}]