Re: Avoid long output, Real variables?
- To: mathgroup at smc.vnet.net
- Subject: [mg20474] Re: Avoid long output, Real variables?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 27 Oct 1999 02:04:43 -0400
- References: <7v3ch5$5vu@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bergervoet J.R.M. <bergervo at prl.philips.nl> wrote in message news:7v3ch5$5vu at smc.vnet.net... > Is it possible to tell Mathematica that a variable, x, is Real? > I am looking for commands like those of some competing vendor: > assume(x, real) > assume(x>0) > If I cannot declare x to be Real, I get clumsy answers. For > instance, a Fourier transform which for real x is just: > > 2 BesselK[0, x Sign[x]] > > gives me instead a pretty long answer where the actual solution > for real x is hardly recognizable between the rest: > > In[4]:=Integrate[E^(I*k*x)/Sqrt[1+k^2]/(2*Pi), {k,-Infinity,Infinity}] > > Out[4]= If[Im[x] == 0, 2 BesselK[0, x Sign[x]], > > I k x > E > Integrate[------------, {k, -Infinity, Infinity}]] / (2 Pi) > 2 > Sqrt[1 + k ] > In[5]:= > > And it can get worse if several variables are involved. So I really > hope that someone can teach me how to declare them Real (or positive). > > Thanks in advance, > Jos > Jos, We can put the assumption in locally, Integrate[E^(I*k*x)/Sqrt[1 + k^2]/(2*Pi), {k, -Infinity, Infinity}, Assumptions -> {x \[Element] Reals}] BesselK[0, Sqrt[x^2]]/Pi -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565