Re: Integrate vs Nintegrate for impulsive functions
- To: mathgroup at smc.vnet.net
- Subject: [mg61760] Re: Integrate vs Nintegrate for impulsive functions
- From: Fred Bartoli <fred._canxxxel_this_bartoli at RemoveThatAlso_free.fr_AndThisToo>
- Date: Fri, 28 Oct 2005 03:25:46 -0400 (EDT)
- References: <djn3na$inr$1@smc.vnet.net>
- Reply-to: Fred Bartoli <fred._canxxxel_this_bartoli at RemoveThatAlso_free.fr_AndThisToo>
- Sender: owner-wri-mathgroup at wolfram.com
Try to evaluate the integral with symbolic coefficients.
It gives the same result as Nintegrate.
--
Thanks,
Fred.
Cell[CellGroupData[{Cell[BoxData[{
RowBox[{"Clear", "[",
RowBox[{"h", ",", "h1"}], "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"h", "[", "x_", "]"}], "=",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"-", "0.24982234345508192"}], "-",
RowBox[{"0.0429732983215806", "*", "\[ImaginaryI]"}]}],
")"}], "*",
RowBox[{"Sin", "[",
RowBox[{
RowBox[{"(",
RowBox[{"3.1734427242687215", "+",
RowBox[{
"0.3295480781081674", "*", "\[ImaginaryI]"}]}], ")"}],
"*", "x"}], "]"}], "*",
RowBox[{"(",
RowBox[{
RowBox[{"Cosh", "[",
RowBox[{"1000.", "*",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"-", "0.4"}], "+", "x"}], ")"}], "^",
"2"}]}], "]"}], "-",
RowBox[{"Sinh", "[",
RowBox[{"1000.", "*",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"-", "0.4"}], "+", "x"}], ")"}], "^",
"2"}]}], "]"}]}], ")"}]}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"h1", "[", "x_", "]"}], "=",
RowBox[{
RowBox[{"(",
RowBox[{"a", "+",
RowBox[{"\[ImaginaryI]", " ", "b"}]}], ")"}],
RowBox[{"Sin", "[",
RowBox[{
RowBox[{"(",
RowBox[{"c", "+",
RowBox[{"\[ImaginaryI]", " ", "d"}]}], ")"}], "x"}],
"]"}],
RowBox[{"(",
RowBox[{
RowBox[{"Cosh", "[",
RowBox[{"e",
SuperscriptBox[
RowBox[{"(",
RowBox[{"f", "+", "x"}], ")"}], "2"]}], "]"}],
"-",
RowBox[{"Sinh", "[",
RowBox[{"e",
SuperscriptBox[
RowBox[{"(",
RowBox[{"f", "+", "x"}], ")"}], "2"]}], "]"}]}],
")"}]}]}], "\[IndentingNewLine]",
RowBox[{"sol", "=",
RowBox[{"Integrate", "[",
RowBox[{
RowBox[{"h1", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "0", ",", "1"}], "}"}]}], "]"}]}], "\n",
RowBox[{"sol", "/.",
RowBox[{"{",
RowBox[{
RowBox[{"a", "\[Rule]",
RowBox[{"-", "0.24982234345508192"}]}], ",",
RowBox[{"b", "\[Rule]",
RowBox[{"-", "0.0429732983215806"}]}], ",",
RowBox[{"c", "\[Rule]", "3.1734427242687215"}], ",",
RowBox[{"d", "\[Rule]", "0.3295480781081674"}], ",",
RowBox[{"e", "\[Rule]", "1000"}], ",",
RowBox[{"f", "\[Rule]",
FractionBox[
RowBox[{"-", "4"}], "10"]}]}],
"}"}]}], "\[IndentingNewLine]", }], "Input",
CellLabel->"In[7]:="],
Cell[BoxData[
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"-", "0.24982234345508192`"}], "-",
RowBox[{"0.0429732983215806`", " ", "\[ImaginaryI]"}]}],
")"}], " ",
RowBox[{"Sin", "[",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"3.1734427242687215`", "\[InvisibleSpace]"}],
"+",
RowBox[{"0.3295480781081674`", " ", "\[ImaginaryI]"}]}],
")"}], " ", "x"}], "]"}], " ",
RowBox[{"(",
RowBox[{
RowBox[{"Cosh", "[",
RowBox[{"1000.`", " ",
SuperscriptBox[
RowBox[{"(",
RowBox[{
RowBox[{"-", "0.4`"}], "+", "x"}], ")"}], "2"]}],
"]"}], "-",
RowBox[{"Sinh", "[",
RowBox[{"1000.`", " ",
SuperscriptBox[
RowBox[{"(",
RowBox[{
RowBox[{"-", "0.4`"}], "+", "x"}], ")"}], "2"]}],
"]"}]}], ")"}]}]], "Output",
CellLabel->"Out[8]="],
Cell[BoxData[
RowBox[{
RowBox[{"(",
RowBox[{"a", "+",
RowBox[{"\[ImaginaryI]", " ", "b"}]}], ")"}], " ",
RowBox[{"Sin", "[",
RowBox[{
RowBox[{"(",
RowBox[{"c", "+",
RowBox[{"\[ImaginaryI]", " ", "d"}]}], ")"}], " ",
"x"}], "]"}], " ",
RowBox[{"(",
RowBox[{
RowBox[{"Cosh", "[",
RowBox[{"e", " ",
SuperscriptBox[
RowBox[{"(",
RowBox[{"f", "+", "x"}], ")"}], "2"]}], "]"}], "-",
RowBox[{"Sinh", "[",
RowBox[{"e", " ",
SuperscriptBox[
RowBox[{"(",
RowBox[{"f", "+", "x"}], ")"}], "2"]}], "]"}]}],
")"}]}]], "Output",
CellLabel->"Out[9]="],
Cell[BoxData[
FractionBox[
RowBox[{
RowBox[{"(",
RowBox[{"a", "+",
RowBox[{"\[ImaginaryI]", " ", "b"}]}], ")"}], " ",
SuperscriptBox["\[ExponentialE]",
RowBox[{"-",
FractionBox[
RowBox[{
SuperscriptBox["c", "2"], "-",
RowBox[{"d", " ",
RowBox[{"(",
RowBox[{"d", "-",
RowBox[{"4", " ", "e", " ", "f"}]}], ")"}]}],
"+",
RowBox[{"2", " ", "\[ImaginaryI]", " ", "c", " ",
RowBox[{"(",
RowBox[{"d", "+",
RowBox[{"2", " ", "e", " ", "f"}]}], ")"}]}]}],
RowBox[{"4", " ", "e"}]]}]], " ",
SqrtBox["\[Pi]"], " ",
RowBox[{"(",
RowBox[{
RowBox[{
SuperscriptBox["\[ExponentialE]",
RowBox[{
"2", " ", "\[ImaginaryI]", " ", "c", " ", "f"}]], " ",
RowBox[{"Erfi", "[",
FractionBox[
RowBox[{"c", "+",
RowBox[{"\[ImaginaryI]", " ",
RowBox[{"(",
RowBox[{"d", "-",
RowBox[{"2", " ", "e", " ", "f"}]}],
")"}]}]}],
RowBox[{"2", " ",
SqrtBox["e"]}]], "]"}]}], "+",
RowBox[{
SuperscriptBox["\[ExponentialE]",
RowBox[{"2", " ", "d", " ", "f"}]], " ",
RowBox[{"Erfi", "[",
FractionBox[
RowBox[{"c", "+",
RowBox[{"\[ImaginaryI]", " ",
RowBox[{"(",
RowBox[{"d", "+",
RowBox[{"2", " ", "e", " ", "f"}]}],
")"}]}]}],
RowBox[{"2", " ",
SqrtBox["e"]}]], "]"}]}], "-",
RowBox[{
SuperscriptBox["\[ExponentialE]",
RowBox[{
"2", " ", "\[ImaginaryI]", " ", "c", " ", "f"}]], " ",
RowBox[{"Erfi", "[",
FractionBox[
RowBox[{"c", "+",
RowBox[{"\[ImaginaryI]", " ",
RowBox[{"(",
RowBox[{"d", "-",
RowBox[{"2", " ", "e", " ",
RowBox[{"(",
RowBox[{"1", "+", "f"}], ")"}]}]}],
")"}]}]}],
RowBox[{"2", " ",
SqrtBox["e"]}]], "]"}]}], "-",
RowBox[{
SuperscriptBox["\[ExponentialE]",
RowBox[{"2", " ", "d", " ", "f"}]], " ",
RowBox[{"Erfi", "[",
FractionBox[
RowBox[{"c", "+",
RowBox[{"\[ImaginaryI]", " ",
RowBox[{"(",
RowBox[{"d", "+",
RowBox[{"2", " ", "e", " ",
RowBox[{"(",
RowBox[{"1", "+", "f"}], ")"}]}]}],
")"}]}]}],
RowBox[{"2", " ",
SqrtBox["e"]}]], "]"}]}]}], ")"}]}],
RowBox[{"4", " ",
SqrtBox["e"]}]]], "Output",
CellLabel->"Out[10]="],
Cell[BoxData[
RowBox[{
RowBox[{"-", "0.013361219528374293`"}], "-",
RowBox[{
"0.002855508349311959`", " ", "\[ImaginaryI]"}]}]], "Output",
CellLabel->"Out[11]="]
}, Open ]]
"Pratik Desai" <pdesai1 at umbc.edu> a écrit dans le message de
news:djn3na$inr$1 at smc.vnet.net...
> Hi Folks
>
>
> I have an expression resulting from a fourier series (for a 1D wave
> equation for a string) (fourier coeffficient) of the form
>
> h[x_]=(-0.24982234345508192 - 0.0429732983215806*I)*
> Sin[(3.1734427242687215 + 0.3295480781081674*I)*x]*
> (Cosh[1000.*(-0.4 + x)^2] - Sinh[1000.*(-0.4 + x)^2])
>
> I try to integrate this on the domain x(0,1) to get the fourier
> coefficient. I get some results that I need help explaining
>
>
> Integrate[h[x],{x,0,1}]
>
> >>0+0 *I
>
> NIntegrate[h[x],{x,0,1}]
>
> >>-0.0133612 - 0.00285551 \[ImaginaryI]
>
> Is the result from NIntegrate valid
>
> The initial condition is essentially a smoothed delta function at x=0.4
>
> gxx[x_]=E^(-1000.*(-0.4 + x)^2)
>
> Please advise
>
>
> Regards
>
>
> Pratik .
>
> --
> Pratik Desai
> Graduate Student
> UMBC
> Department of Mechanical Engineering
> Phone: 410 455 8134
>
>
- Follow-Ups:
- Re: Re: Integrate vs Nintegrate for impulsive functions
- From: Pratik Desai <pdesai1@umbc.edu>
- Re: Re: Integrate vs Nintegrate for impulsive functions