Re: Mathematica, Axiom or Maxima?
- From: Daniel Lichtblau <danl@xxxxxxxxxxx>
- Date: Mon, 1 Sep 2008 11:04:09 -0700 (PDT)
On Sep 1, 12:24 pm, "Nasser Abbasi" <n...@xxxxxxxxx> wrote:
"rjf" <fate...@xxxxxxxxx> wrote in message
On Aug 31, 2:35 am, Francogrex <fra...@xxxxxxxx> wrote:
.....
And for solving
integrals in particular?
try http://integrals.wolfram.com/index.jsp
for free access to integrals by Mathematica.
Note that actually computing integrals symbolically is a challenge, it
is probably much less important than you might think. Numerical
integration techniques often do an equivalent job (for most purposes)
and are often many many times faster.
....
So the question for you is why you want to do integrals?
RJF
Sometimes using symbolic integration over numerical can result in a much
simpler computation to a practical problem.
This is just one example from a very practical problem: Find the Fourier
coefficient of a rectangular pulse of period say 2T and the pulse width is T
(the height of the pulse is 1)
The Fourier coefficient for the above is SINC(k*Pi/2). (sinc(x) =
sin(x)/x).
For different k's we obtain the different Fourier coefficients. The above is
found by symbolic integration of a the pulse over its period time, ine
INT( f(t)* exp(-j*2*pi/T*t) , t=-T/2 .. T/2 ). This results in an expression
which I call c(k), since it is a function of k. Hence c(k) = SINC(k*Pi/2).
Now to find the Fourier coefficient for k=0, I could now using limit k->0
c(k) which gives 1/2, since direct substitution of k=0 will result in 0/0
which is not defined.
So one is able to write a small function which will find Fourier coeff. for
any function f(t) if they use symbolic integration. one can use limit to
evaluate the Fourier coeff for the k value of interest and this
automatically is handled the case above (thanks to L'hopital etc..). But I
am able to do this because I used symbolic integration and obtained a
symbolic expression and used limit.
How would you do the above numerically? If I give you a rectangle pulse of
period 2T, width T, and ask what is the Fourier coeff at k=0 ?
Most engineers will hardcode SINC(k*Pi/2) for this one case, and hardcode
the case for k=0 (the DC case) to be 1/2. But using symbolic integration is
more natural and no need to hardcode specific cases for different functions.
Nasser- Hide quoted text -
- Show quoted text -
I may have some factors not quite right, but something like this will
work.
f[k_, p_] :=
Chop[Quiet[1/p*NIntegrate[Exp[-k*Pi*I*t/p], {t, -p/2, p/2}]]]
For example:
In[29]:= nft = Table[f[k, 2], {k, -7, 7}]
Out[29]= {-0.0909457, 0, 0.127324, 0, -0.212207, 0, 0.63662, 1., \
0.63662, 0, -0.212207, 0, 0.127324, 0, -0.0909457}
We can compoare this to the symbolic result.
g[k_, p_] := 1/p*Integrate[Exp[-k*Pi*I*t/p], {t, -p/2, p/2}]
In[30]:= ft = Table[g[k, 2], {k, -7, 7}]
Out[30]= {-(2/(7*Pi)), 0, 2/(5*Pi), 0, -(2/(3*Pi)),
0, 2/Pi, 1, 2/Pi, 0, -(2/(3*Pi)), 0,
2/(5*Pi), 0, -(2/(7*Pi))}
In[31]:= Chop[nft - ft]
Out[31]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Daniel Lichtblau
Wolfram Research
.
- Follow-Ups:
- Re: Mathematica, Axiom or Maxima?
- From: Nasser Abbasi
- Re: Mathematica, Axiom or Maxima?
- References:
- Re: Mathematica, Axiom or Maxima?
- From: Nasser Abbasi
- Re: Mathematica, Axiom or Maxima?
- Prev by Date: Re: Mathematica, Axiom or Maxima?
- Next by Date: Re: Mathematica, Axiom or Maxima?
- Previous by thread: Re: Mathematica, Axiom or Maxima?
- Next by thread: Re: Mathematica, Axiom or Maxima?
- Index(es):
Relevant Pages
|