• To: mathgroup at smc.vnet.net
• Subject: [mg109802] Re: need your help!
• From: dh <dh at metrohm.com>
• Date: Tue, 18 May 2010 02:14:06 -0400 (EDT)
• References: <hsgnhg\$d3r\$1@smc.vnet.net>

```Hi,
I would guess that the problem is not with Plot but with your function.
Try if you function returns numeric values for some specific input.
Probably you will then see what is wrong.
cheers, Daniel

Am 13.05.2010 13:24, schrieb Ben:
> In[1]:= s[\[Omega]_, t_] =
>   FullSimplify[
>    Integrate[
>     Sin[\[Omega] \[Tau]] Sin[\[Omega]0 \[Tau]], {\[Tau], 0, t}]]
>
> Out[1]= (\[Omega]0 Cos[t \[Omega]0] Sin[t \[Omega]] - \[Omega] Cos[
>     t \[Omega]] Sin[t \[Omega]0])/(\[Omega]^2 - \[Omega]0^2)
>
> In[2]:= c[\[Omega]_, t_] =
>   FullSimplify[
>    Integrate[
>     Cos[\[Omega] \[Tau]] Cos[\[Omega]0 \[Tau]], {\[Tau], 0, t}]]
> d[\[Omega]_, t_] =
>   FullSimplify[
>    Integrate[
>     Cos[\[Omega] \[Tau]] Sin[\[Omega]0 \[Tau]], {\[Tau], 0, t}]]
>
> Out[2]= (\[Omega] Cos[t \[Omega]0] Sin[t \[Omega]] - \[Omega]0 Cos[
>     t \[Omega]] Sin[t \[Omega]0])/(\[Omega]^2 - \[Omega]0^2)
>
> Out[3]= (-\[Omega]0 + \[Omega]0 Cos[t \[Omega]] Cos[
>     t \[Omega]0] + \[Omega] Sin[t \[Omega]] Sin[
>     t \[Omega]0])/(\[Omega]^2 - \[Omega]0^2)
>
> Jpbg[\[Omega]_] = If[\[Omega]>  0, 1/Sqrt[\[Omega]], 0];
>
> J1[\[Alpha]_, \[Omega]0_, t_] =
>    FullSimplify[
>     Integrate[ \[Alpha]^2/
>       Sqrt[\[Omega]]*(\[Omega] Cos[t \[Omega]0] Sin[
>          t \[Omega]] - \[Omega]0 Cos[t \[Omega]] Sin[
>          t \[Omega]0])/(\[Omega]^2 - \[Omega]0^2), {\[Omega],
>       0, \[Infinity]},
>      Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, t>  0}], {\[Alpha]>
>       0, \[Omega]0>  0, \[Omega]>  0, t>  0}];
>
>
> \[CapitalDelta][\[Alpha]_, \[Omega]0_, t_] :=
>    Re[Simplify[J1[\[Alpha], \[Omega]0, t]]];
>
> In[7]:= \[CapitalDelta][0.1, 0.5, 0.1, 5.]
>
> Out[7]= 0.199423
>
> J2[\[Alpha]_, \[Omega]0_] =
>    FullSimplify[
>     Integrate[ \[Alpha]^2/
>       Sqrt[\[Omega]]*-\[Omega]0/(\[Omega]^2 - \[Omega]0^2), {\[Omega],
>       0, \[Infinity]},
>      Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, \[Lambda]>
>         0}], {\[Alpha]>  0, \[Omega]0>  0}];
> J3[\[Alpha]_, \[Omega]0_, t_] =
>    FullSimplify[
>     Integrate[ \[Alpha]^2/
>       Sqrt[\[Omega]]*(\[Omega]0 Cos[t \[Omega]] Cos[
>         t \[Omega]0])/(\[Omega]^2 - \[Omega]0^2), {\[Omega],
>       0, \[Infinity]},
>      Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, t>  0}], {\[Alpha]>
>       0, \[Omega]0>  0, t>  0}];
>
>
> During evaluation of In[8]:= Integrate::idiv: Integral of 1/((\
> \[Lambda]^2+\[Omega]^2) (\[Omega]^2-\[Omega]0^2)) does not converge \
> on {0,\[Infinity]}.>>
>
> J4[\[Alpha]_, \[Omega]0_, t_] =
>    FullSimplify[
>     Integrate[ \[Alpha]^2/
>       Sqrt[\[Omega]]*(\[Omega] Sin[t \[Omega]] Sin[
>         t \[Omega]0])/(\[Omega]^2 - \[Omega]0^2), {\[Omega],
>       0, \[Infinity]},
>      Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, t>  0}], {\[Alpha]>
>       0, \[Omega]0>  0, t>  0}];
>
>
> \[CapitalPi][\[Alpha]_, \[Omega]0_, t_] :=
>    Re[Simplify[
>      J2[\[Alpha], \[Omega]0] + J3[\[Alpha], \[Omega]0, t] +
>       J4[\[Alpha], \[Omega]0, t]]];
>
> In[12]:= \[CapitalPi][0.1, 0.5, 0.1, 5.]
>
> Out[12]= 0.42693
>
> J5[\[Alpha]_, \[Omega]0_, \[Lambda]_, t_] =
>    FullSimplify[
>     Integrate[ \[Alpha]^2/
>       Sqrt[\[Omega]]*(\[Omega]0 Cos[t \[Omega]0] Sin[
>          t \[Omega]] - \[Omega] Cos[t \[Omega]] Sin[
>          t \[Omega]0])/(\[Omega]^2 - \[Omega]0^2), {\[Omega],
>       0, \[Infinity]},
>      Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, \[Lambda]>  0,
>        t>  0}], {\[Alpha]>  0, \[Omega]0>  0, \[Lambda]>  0, t>  0}];
>
> \[Gamma][\[Alpha]_, \[Omega]0_, t_] :=
>    Re[Simplify[J5[\[Alpha], \[Omega]0, t]]];
>
> In[15]:= \[Gamma][0.1, 0.5, 0.1, 5.]
>
> Out[15]= 0.168173
>
> \[CapitalGamma][\[Alpha]_, \[Omega]0_, t_] =
>    FullSimplify[
>     Integrate[2*\[Gamma][\[Alpha], \[Omega]0, s], {s, 0, t},
>      Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0}], {\[Alpha]>
>       0, \[Omega]0>  0}];
>
> Subscript[\[CapitalDelta], \[CapitalGamma]][\[Alpha]_, \[Omega]0_,
>     t_] = FullSimplify[
>     Integrate[J1[\[Alpha], \[Omega]0, s], {s, 0, t},
>      Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0}], {\[Alpha]>
>       0, \[Omega]0>  0}];
>
> In[18]:= Subscript[\[CapitalDelta], \[CapitalGamma]][0.1, 0.5, 0.1, \
> 5.]
>
> Out[18]= 1.04639
>
>
> \[CapitalDelta]co[\[Alpha]_, \[Omega]0_, t_] =
>    Re[FullSimplify[
>      Integrate[
>       J1[\[Alpha], \[Omega]0, s]*Cos[2 \[Omega]0 (t - s)], {s, 0, t},
>       Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, t>  0}], {\[Alpha]>
>         0, \[Omega]0>  0, t>  0}]];
>
> \[CapitalDelta]si[\[Alpha]_, \[Omega]0_, t_] =
>    Re[FullSimplify[
>      Integrate[
>       J1[\[Alpha], \[Omega]0, s]*Sin[2 \[Omega]0 (t - s)], {s, 0, t},
>       Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, \[Lambda]>  0,
>         t>  0}], {\[Alpha]>  0, \[Omega]0>  0, t>  0}]];
>
> \[CapitalPi]co[\[Alpha]_, \[Omega]0_, t_] =
>    Re[FullSimplify[
>      Integrate[(J2[\[Alpha], \[Omega]0, s] +
>          J3[\[Alpha], \[Omega]0, s] + J4[\[Alpha], \[Omega]0, s])*
>        Cos[2 \[Omega]0 (t - s)], {s, 0, t},
>       Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, t>  0}], {\[Alpha]>
>         0, \[Omega]0>  0, \[Lambda]>  0, t>  0}]];
>
> \[CapitalPi]si[\[Alpha]_, \[Omega]0_, t_] =
>    Re[FullSimplify[
>      Integrate[(J2[\[Alpha], \[Omega]0, s] +
>          J3[\[Alpha], \[Omega]0, s] + J4[\[Alpha], \[Omega]0, s])*
>        Sin[2 \[Omega]0 (t - s)], {s, 0, t},
>       Assumptions ->  {\[Alpha]>  0, \[Omega]0>  0, t>  0}], {\[Alpha]>
>         0, \[Omega]0>  0, t>  0}]];
>
> Out[22]= \$Aborted
>
> \[CapitalDelta]co[0.1, 0.5, 0.1, 5.]
>
> -0.198356 - 1.08996*10^-17 \[ImaginaryI]
>
> \[CapitalDelta]si[0.1, 0.5, 0.1, 5.]
>
> 0.404226+ 0. \[ImaginaryI]
>
> \[CapitalPi]co[0.1, 0.5, 0.1, 5.]
>
> 0.148022- 5.29091*10^-17 \[ImaginaryI]
>
> \[CapitalPi]si[0.1, 0.5, 0.1, 5.]
>
> 0.54091- 5.42101*10^-17 \[ImaginaryI]
>
> Clear[A0]
>
> A0[r_] = {{Cosh[2 r], 0}, {0, Cosh[2 r]}};
> B0 = {{b, 0}, {0, b}};
>
> Clear[At]
>
> At[\[Alpha]_, \[Omega]0_, t_, r_] :=
>    Re[A0[r] + {{Subscript[\[CapitalDelta], \[CapitalGamma]][\[Alpha], \
> \[Omega]0,
>          t] + (\[CapitalDelta]co[\[Alpha], \[Omega]0,
>            t] - \[CapitalDelta]si[\[Alpha], \[Omega]0,
>            t]), -(\[CapitalDelta]si[\[Alpha], \[Omega]0,
>            t] - \[CapitalPi]co[\[Alpha], \[Omega]0,
>            t])}, {-(\[CapitalDelta]si[\[Alpha], \[Omega]0,
>            t] - \[CapitalPi]co[\[Alpha], \[Omega]0, t]),
>        Subscript[\[CapitalDelta], \[CapitalGamma]][\[Alpha], \[Omega]0,
>           t] - (\[CapitalDelta]co[\[Alpha], \[Omega]0,
>            t] - \[CapitalDelta]si[\[Alpha], \[Omega]0, t])}}];
>
> MatrixForm[ArrayFlatten[At[0.1, 0.5, 0.1, 5., 1.]]]
>
> \!\(\*
> TagBox[
> RowBox[{"(", "\[NoBreak]", GridBox[{
> {"4.206008542870848`",
> RowBox[{"-", "0.25620413800854397`"}]},
> {
> RowBox[{"-", "0.25620413800854397`"}], "5.411172395695137`"}
> },
> GridBoxAlignment->{
>        "Columns" ->  {{Left}}, "ColumnsIndexed" ->  {},
>         "Rows" ->  {{Baseline}}, "RowsIndexed" ->  {}},
> GridBoxSpacings->{"Columns" ->  {
> Offset[0.27999999999999997`], {
> Offset[0.7]},
> Offset[0.27999999999999997`]}, "ColumnsIndexed" ->  {}, "Rows" ->  {
> Offset[0.2], {
> Offset[0.4]},
> Offset[0.2]}, "RowsIndexed" ->  {}}], "\[NoBreak]", ")"}],
> Function[BoxForm`e\$,
> MatrixForm[BoxForm`e\$]]]\)
>
> Ct[\[Omega]0_, t_, r_] =
>    ArrayFlatten[{{Sinh[2 r]/2  Cos [2 \[Omega]0 t],
>       Sinh[2 r]/2 Sin [2 \[Omega]0 t]}, {Sinh[2 r]/2  Cos [
>         2 \[Omega]0 t], -Sinh[2 r]/2  Cos [2 \[Omega]0 t]}}];
>
> MatrixForm[ArrayFlatten[Ct[0.1, 5., 1.]]]
>
> \[Sigma]t[\[Alpha]_, \[Omega]0_, t_, r_] =
>    ArrayFlatten[{At[\[Alpha], \[Omega]0, t, r],
>      Ct[\[Omega]0, t, r]}, {Transpose[Ct[\[Omega]0, t, r]],
>      At[\[Alpha], \[Omega]0, t, r]}];
> MatrixForm[ArrayFlatten[\[Sigma]t[0.1, 0.5, 5., 1.]]]
>
> Subscript[I, 1] =
>   Simplify[Det[
>     At[\[Alpha], \[Omega]0, t, r]], {\[Alpha]>  0, \[Omega]0>  0,
>     t>  0, r>  0}]
>
> Subscript[I, 3] =
>   Simplify[Det[Ct[\[Omega]0, t, r]], {\[Omega]0>  0, t>  0, r>  0}]
>
>
>
> Subscript[I, 4] =
>    Simplify[Det[\[Sigma]t[\[Alpha], \[Omega]0, t, r]], {\[Alpha]>
>       0, \[Omega]0>  0, t>  0, r>  0}];
>
> Subscript[C, +] =
>    Simplify[Sqrt[(
>     Subscript[I, 1]^2 + Subscript[I, 3]^2 - Subscript[I, 4] +
>      Sqrt[(Subscript[I, 1]^2 + Subscript[I, 3]^2 - Subscript[I,
>         4])^2 - (2 Subscript[I, 1]*Subscript[I, 3])^2        ])/(
>     2 Subscript[I, 1])]];
> Subscript[C, -] =
>    Simplify[Sqrt[(
>     Subscript[I, 1]^2 + Subscript[I, 3]^2 - Subscript[I, 4] -
>      Sqrt[(Subscript[I, 1]^2 + Subscript[I, 3]^2 - Subscript[I,
>         4])^2 - (2 Subscript[I, 1]*Subscript[I, 3])^2        ])/(
>     2 Subscript[I, 1])]];
>
> Subscript[a, n] = Simplify[Sqrt[Subscript[I, 1]]];
>
> Subscript[\[Kappa], -] =
>    Simplify[
>     Sqrt[(Subscript[a, n] - Subscript[C, +])*(Subscript[a, n] -
>        Subscript[C, -])]];
>
> Subscript[x, m] =
>    Simplify[(Subscript[\[Kappa], -]^2 + 1/4)/(
>     2 Subscript[\[Kappa], -])];
>
> Subscript[E, F][\[Alpha]_, \[Omega]0_, \[Lambda]_, t_, r_] :=
>    Re[(Subscript[x, m] + 1/2) ln [
>        Subscript[x, m] + 1/2] - (Subscript[x, m] - 1/2)  ln [
>        Subscript[x, m] - 1/2]];
>
> Subscript[E, F][0.1, 0.5, 5., 1.]
>
> Plot[Subscript[E, F][0.1, 0.5, t, 1.],
>   {t, 0, 5}]
>
>

--

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>

```

• Prev by Date: Washington DC Area Mathematica SIG
• Next by Date: Re: Execute .m file with JLink