MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with Integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22520] Re: [mg22496] Problem with Integration
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Thu, 9 Mar 2000 03:24:12 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

on 3/8/00 8:22 AM, Hans Friedrich Steffani at
hans.steffani at e-technik.tu-chemnitz.de wrote:

> In[1]:= U[f_]:=1.0*Integrate[Cos[(f*Pi)/(180*2) + alpha],{alpha,-(Pi/3),
> Pi/3}]
> 
> In[2]:= U[60]
> 
> -16
> Out[2]= 1.5 - 6.08617 10    I
> 
> In[3]:= Integrate[Cos[(f*Pi)/(180*2) + alpha],{alpha, -(Pi/3), Pi/3}]
> 
> f Pi
> Out[3]= Sqrt[3] Cos[----]
> 360
> 
> Cos[f Pi/360] should be real vor any real f. How can I avoid results
> like Out[2] (exepct using Chop[] or Re[])?
> 
> Hans Friedrich Steffani
> 
> PS:
> Thanks for the help with my other problems last week.
> h.f.s.

You can't. These imaginary error are a consequence of the way Mathematica's
numerics work and Chop is the way to get rid of them. I can't understand why
you find this unsatisfactory. If you do not want to have to use Chop after
each evaluation you can simply make it a part of your definition:

In[7]:=
U[f_] := Chop[
    1.0*Integrate[Cos[(f*Pi)/(180*2) + alpha], {alpha, -(Pi/3), Pi/3}]]

In[8]:=
U[60]
Out[8]=
1.5
-- 
Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp




  • Prev by Date: Re: Stieltjes Integral
  • Next by Date: Re: Error in Subtraction with V4.0??
  • Previous by thread: Re: Problem with Integration
  • Next by thread: Re: Problem with Integration