Re: Some assistance from seasoned users.
- To: mathgroup at smc.vnet.net
- Subject: [mg124936] Re: Some assistance from seasoned users.
- From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
- Date: Mon, 13 Feb 2012 03:39:09 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jh6k2n$jr9$1@smc.vnet.net> <201202120959.EAA25064@smc.vnet.net>
Hi Oleksandr May I say, without apology, that using your code to change Sin to sin, and thus allow a new Mathematican to break the golden rule about capitals for built-in Mathematica symbols, and lower case for your own, would be, well, a sin. :-) (I note your excellent advice against this: "this would be at odds with other Mathematica syntax".) Cheers Barrie (a Hitchensian who doesn't believe in sin, original or plagiarised!. I do believe in Sin, Cos, Tan, and the rest, of course , as a Platonic Realist.) >>> On 12/02/2012 at 8:59 pm, in message <201202120959.EAA25064 at smc.vnet.net>, Oleksandr Rasputinov <oleksandr_rasputinov at ymail.com> wrote: > 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.)
- References:
- Re: Some assistance from seasoned users.
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov@ymail.com>
- Re: Some assistance from seasoned users.