Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Integrating f(x,y) on a certain line in XY plane
Date: Mon, 9 May 2011 20:39:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <iq9jd9$po9$1@newscl01ah.mathworks.com>
References: <iq5tkg$j6e$1@newscl01ah.mathworks.com> <iq5vo1$nch$1@newscl01ah.mathworks.com> <iq6390$17d$1@newscl01ah.mathworks.com> <iq6t1h$ocu$1@newscl01ah.mathworks.com> <iq704t$1av$1@newscl01ah.mathworks.com> <iq740k$9e4$1@newscl01ah.mathworks.com> <iq7900$jj3$1@newscl01ah.mathworks.com> <iq7sns$1j5$1@newscl01ah.mathworks.com> <iq8oeq$5tv$1@newscl01ah.mathworks.com> <iq9dhr$9bb$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1304973545 26377 172.30.248.48 (9 May 2011 20:39:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 May 2011 20:39:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:725928

"Roger Stafford" wrote in message <iq9dhr$9bb$1@newscl01ah.mathworks.com>...
>   I didn't say you could reduce your expression to log((XM-X).^2).  What I said was that it could be reduced to the form log(x^2+a^2)) which is a very different entity.
> .........
- - - - - - - - -
  Mohamed, the explanation I gave you earlier could have been made much more intuitively evident.  Hopefully the following is an improvement.

  You start with log(sqrt((X-XM)^2+(Y-YM)^2)) to be integrated along some straight line extending from (X1,Y1) to (X2,Y2).  The quantity within the logarithm is the distance from a point (X,Y), which is moving along this line segment, to the point (XM,YM).  Now find the closest point (X0,Y0) along the extended line to the point (XM,YM).  The three points (X,Y), (XM,YM), and (X0,Y0) will form a right triangle, so by the theorem of Pythagoras we have

 (X-XM)^2+(Y-YM)^2 = (X-X0)^2+(Y-Y0)^2 + (X0-XM)^2+(Y0-YM)^2

If we call t the distance from (X,Y) to (X0,Y0) and f the distance from (X0,Y0) to (XM,YM), this can be written expressed as t^2+f^2.

This means we seek to integrate 

 log(sqrt(t^2+f^2)) = 1/2*log(t^2+f^2)

along the line segment from (X1,Y1) to (X2,Y2).  The indefinite integral of

 log(t^2+f^2)

with respect to t is given by the formula

 t*log(t^2+f^2) - 2*t + 2*f*atan(t/f) + C

which would allow you to express the definite integral in terms of the t values at (X1,Y1) and (X2,Y2) and the constant f.  No need to do numerical integration.

  (I overlooked the fact that the a^2+c^2 quantity in my previous discussion is necessarily equal to 1, so the log(a^2+c^2) constant would have been zero.) 

Roger Stafford