Re: Integrate with piecewise function
- To: mathgroup at smc.vnet.net
- Subject: [mg44068] Re: Integrate with piecewise function
- From: bobhanlon at aol.com (Bob Hanlon)
- Date: Mon, 20 Oct 2003 01:13:37 -0400 (EDT)
- References: <bmt8gd$87u$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Use a more straightforward definition for dis, i.e., define it using mathematical functions rather than program control logic dis[x_,xi_]:=Abs[x-xi]; Integrate[dis[x,0],{x,-1,1/6}] 37/72 Bob Hanlon In article <bmt8gd$87u$1 at smc.vnet.net>, "Chia-Ming" <yucalf at mail.educities.edu.tw> wrote: << I define a function describing the distance on the edge of a circle. dis[x_, xi_] := Which[ x - xi >= 0, x - xi, x - xi < 0, xi - x] Then I find that the command Integrate does not yield the result (37/72). Integrate[dis[x, 0], {x, 0, 1/6}] If I use the command NIntegrate, only the numerical result is yielded. But I want the exact result. NIntegrate[dis[x, 0], {x, 0, 1/6}] 0.513891 How can I get the exact result, just like I keyin the command by hand. Integrate[-x, {x, -1, 0}] + Integrate[x-0, {x, 0, 1/6}] 37/72