Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: plotting integrals
Replies: 2   Last Post: Sep 21, 2013 4:24 AM

 Messages: [ Previous | Next ]
 Dr. Wolfgang Hintze Posts: 195 Registered: 12/8/04
Re: plotting integrals
Posted: Sep 21, 2013 4:24 AM

Am Freitag, 20. September 2013 12:52:58 UTC+2 schrieb Herman:
> Dear All,
>
>
>
> I would like to plot the function Subscript[\[Eta], B] but I got errors.
>
>
>
>
>
>
> \[Psi][x_, \[Omega]_] := (\[Omega]/\[Pi])^(1/4)
>
> Exp[-1/2 \[Omega] x^2]
>
>
>
> \[Psi]1[x_, a_, n_] := Sqrt[(2 n)!!/((2 n - 1)!! \[Pi])] Cos [a*x]^n
>
>
>
> Subscript[F, TPT][x_, a_, n_] :=
>
> NIntegrate[\[Psi]1[x, a, n]*\[Psi][x,
>
> a*Sqrt[2 n (n - 1)]], {x, -\[Pi]/2, \[Pi]/2}]
>
>
>
> Subscript[\[Eta], B][x_, a_,
>
> n_] := Sqrt[(1 - Subscript[F, TPT][x, a, n])]
>
>
>
> Plot[Subscript[\[Eta], B][x, 1, 3], {x, -\[Pi]/2, \[Pi]/2}]

I don't understand why you still have the variable x which was integrated "away" in NIntegrate.

Ok, here is a piece of code very similar to yours which works.
Maybe it is close to what you intended ...

\[Psi][x_, \[Omega]_] := (\[Omega]/Pi)^(1/4)*
Exp[(-2^(-1))*\[Omega]*x^2]
\[Psi]1[x_, a_, n_] := Sqrt[(2*n)!!/((2*n - 1)!!*Pi)]*Cos[a*x]^n
fTPT[a_, n_] :=
NIntegrate[\[Psi]1[x, a, n]*\[Psi][x, a*Sqrt[2*n*(n - 1)]], {x, -Pi/
2, Pi/2}]
etaB[a_, n_] := Sqrt[1 - fTPT[a, n]]
Plot[etaB[a, 3], {a, 0, 10}]

Best regards,
Wolfgang

Date Subject Author
9/20/13 Herman
9/21/13 Bill Rowe
9/21/13 Dr. Wolfgang Hintze