MathGroup Archive 2012

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

Search the Archive

Re: Some assistance from seasoned users.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124912] Re: Some assistance from seasoned users.
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at ymail.com>
  • Date: Sun, 12 Feb 2012 04:59:57 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jh6k2n$jr9$1@smc.vnet.net>

On Sat, 11 Feb 2012 20:46:15 -0000, peter livingston  
<peter.livingston at cox.net> wrote:

> Folks!
>
> I have recently come to the pleasures of Mathematica from other popular  
> but
> very expensive programming methods that I, as a retiree, cannot afford.
>
> My specific question is this: why am I able to get Mathematica to do the
> complete integral of sin(x)/x, but it refuses to do any of the other  
> types:
> specifically sin^3[x]/x or sin^3[x]/x^3 over the half interval from zero  
> to
> infinity. (see page 449 of G & R  Table of Integrals).
>
> It seems to suggest that throwing away my Gradshtein and Ryzhik is  
> premature
> in spite of the claims in the Mathematica "Mathematics and Algorithms"
> manual.
>
> Peter Livingston

Did you enter sin^n(x) as Sin^n[x], or as Sin[x]^n? The former will not be  
understood, being interpreted as Sin^(n[x]), but the latter works as  
expected:

In[1]:= Integrate[Sin[x]/x, {x, 0, Infinity}]

Out[1]= Pi/2

In[2]:= Integrate[Sin[x]^3/x, {x, 0, Infinity}]

Out[2]= Pi/4

In[3]:= Integrate[Sin[x]^3/x^3, {x, 0, Infinity}]

Out[3]= (3 Pi)/8

In my opinion it is better for Mathematica not to accept Sin^n[x] is  
because (a) this would be at odds with other Mathematica syntax and (b) in  
many contexts it will be ambiguous as to whether Sin[x]*Sin[x] or  
Sin[Sin[x]] is meant. However, it does mean that you'll either have to get  
used to this discrepancy from common usage, or (as you get more  
experienced with Mathematica) define your own operators that work in the  
way that you want. For instance, we can write:

sin /: sin^n_. := Sin[#]^n &;
sin[x_] := Sin[x];

Now:

In := Integrate[(sin^3)[x]/x^3, {x, 0, Infinity}]

Out = (3 Pi)/8

(Although note that we must still use parentheses around sin^3 to make the  
syntax unambiguous.)



  • Prev by Date: Re: Baffled by FindMinimum
  • Next by Date: Re: Abort computation on any message
  • Previous by thread: Re: Some assistance from seasoned users.
  • Next by thread: Re: Some assistance from seasoned users.