0
$\begingroup$

I came across a very complicated expression as the first following picture shows, it makes normal processing such as coordinate conversion difficult, so I thought it would be nice to use an approximation of it, but I also met some difficulties when using Series[] and NIntegrate[].

d

so So what methods do you usually use with Mathematica to deal with/simplify this complex expression?

The above is a sub-problem that I think can solve the problem, and my final problem is this(second picture shows):i want plot streamline of {vr,vθ} but failed due to the complexity of the vθ.

enter image description here

code if you need

H=\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), 
FractionBox[
SuperscriptBox[\(r\), \(2\)], \(2\)]]\(
\*SuperscriptBox[\(E\), \((\(-s\)\  + \ 3 \(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(s\)]
\*FractionBox[\(1 - 
\*SuperscriptBox[\(E\), \(-\[Tau]\)]\), \(\[Tau]\)] \[DifferentialD]\[Tau]\))\)] \[DifferentialD]s\)\)
Series[H,{r,0,3}]

code if you need

v\[Theta]=\[CapitalGamma]0/(2 \[Pi] r) \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Eta]\)]\(
\*SuperscriptBox[\(E\), \((\(-s\)\  + \ 3 \(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(s\)]
\*FractionBox[\(1 - 
\*SuperscriptBox[\(E\), \(-\[Tau]\)]\), \(\[Tau]\)] \[DifferentialD]\[Tau]\))\)] \[DifferentialD]s\)\)/H\[Infinity]; (*a function of r*)
vr=-a r + (6\[Nu])/r (1-E^(-((a r^2)/(2 \[Nu])))); (*a function of r*)


\[Eta]=(a r^2)/(2 \[Nu]);
H\[Infinity]=37.905;


\[CapitalGamma]0=1;a=1;\[Nu]=1;
{vx,vy}=TransformedField["Polar"->"Cartesian",{vr,v\[Theta]},{r,\[Theta]}->{x,y}]; (*won't work out*)
StreamPlot[{vx,vy},{x,-5,5},{y,-5,5}] 

@Mariusz Iwaniuk @Mauricio Fernández, Thanks for your answers, but still a little confusion: indeed before I asked here, I had tried to use Assume[] according to the hint Mathematica gives, below picture&code is my trial but failed, the only difference between your and mine is the condition Assume[] use, but why r∈Reals will fail?

enter image description here

the code of the picture:

Clear["Global`*"]

a=1;
\[Nu]=1;
H=Assuming[r\[Element]Reals,\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), 
FractionBox[\(a\ 
\*SuperscriptBox[\(r\), \(2\)]\), \(2\ \[Nu]\)]]\(
\*SuperscriptBox[\(E\), \((\(-s\)\  + \ 3 \(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(s\)]
\*FractionBox[\(1 - 
\*SuperscriptBox[\(E\), \(-\[Tau]\)]\), \(\[Tau]\)] \[DifferentialD]\[Tau]\))\)] \[DifferentialD]s\)\)];
Assuming[r\[Element]Reals,Series[H,{r,0,3}]]
$\endgroup$
3
  • 1
    $\begingroup$ Add Assuming, e.g., f[r_] := Integrate[ Exp[-s + 3*Integrate[(1 - Exp[-tau])/tau, {tau, 0, s}]] , {s, 0, r^2/2} ] with Normal@Assuming[r > 0, Series[f[r], {r, 0, 10}]] works fine on Mathematica 13.0. $\endgroup$ Jan 30 at 9:43
  • 3
    $\begingroup$ Please share your code in Raw InputForm and not as Notebook Boxes which is close to unreadable for humans. . $\endgroup$
    – rhermans
    Jan 30 at 10:14
  • $\begingroup$ @ Mauricio Fernández, mind seeing my following-asking in the above(new edits) (because the picture, so i can't ask here) $\endgroup$ Feb 2 at 8:59

2 Answers 2

6
$\begingroup$

Using comment of user: Mauricio Fernández:

H\[Infinity] = 37.905;
\[CapitalGamma]0 = 1;
a = 1;
\[Nu] = 1;
\[Eta] = (a r^2)/(2 \[Nu]);
f[r_] := Integrate[Exp[-s + 3*Integrate[(1 - Exp[-tau])/tau, {tau, 0, s}]], {s, 0, \[Eta]}] ;
integral = Normal@Assuming[r > 0, Series[f[r], {r, 0, 20}]]

v\[Theta] = \[CapitalGamma]0/(2 \[Pi] r) *(integral)/H\[Infinity]; (*a function of r*)
vr = -a r + (6 \[Nu])/
 r (1 - E^(-((a r^2)/(2 \[Nu])))); (*a function of r*)
{vx, vy} = TransformedField["Polar" -> "Cartesian", {vr, v\[Theta]}, {r, \[Theta]} -> {x, y}]; 
StreamPlot[{vx, vy}, {x, -5, 5}, {y, -5, 5}] 

enter image description here

$\endgroup$
3
  • $\begingroup$ mind seeing my following-asking in the above(new edits) (because the picture, so i can't ask here) $\endgroup$ Feb 2 at 8:59
  • $\begingroup$ @Aerterliusi Well I don't no why Assuming fail's. I'm just a regular user, not a WOLFRAM developer. $\endgroup$ Feb 2 at 9:17
  • $\begingroup$ @ Mariusz Iwaniuk, still thanks! $\endgroup$ Feb 2 at 9:59
3
$\begingroup$

Try the following: First, let us observe that one calculates the inner integral precisely:

Assuming[{s > 0}, Integrate[(1 - Exp[-t])/t, {t, 0, s}]]

(*  EulerGamma + Gamma[0, s] + Log[s]  *)

Thus, one only needs to calculate the integral of Exp[-s + EulerGamma + Gamma[0, s] + Log[s]. The latter cannot be calculated precisely. Then let us first do this numerically:

lst = ParallelTable[{r, 
    NIntegrate[
     Exp[-s + EulerGamma + Gamma[0, s] + Log[s]], {s, 0, r^2/2}]}, {r,
     0, 10, 0.1}];

Now we see two regimes of behavior with a crossover between them (look at the image below). At small r, one can make a polynomial approximation:

model = k1*r^(7/4) + k2*r^(37/20);
ff = FindFit[lst, model, {k1, k2}, r]
(*   {k1 -> 1.78231, k2 -> -1.39256}   *)

while at r>4, one has the horizontal asymptote

int=2.325...

Altogether, one finds this:

Show[{
  ListPlot[lst, AxesLabel -> {"r", "int"}],
  Plot[model /. ff, {r, 0, 1}, PlotStyle -> Red],
  Plot[2.325, {r, 8, 10}, PlotStyle -> Green]
  }]

yielding the following:

enter image description here

Have fun!

$\endgroup$
4
  • $\begingroup$ Thanks, I learn something especially ParallelTable[], but as far as this issue is concerned, how do you get the model?(ie 7/4&37/20 ) $\endgroup$ Feb 2 at 9:56
  • 1
    $\begingroup$ @Aerterliusi I just tried the model model = k1*r^a + k2*r^b with b>a>0. Then I played with these two parameters within Manipulate. However, now I think this model is not the best I would take. I used it because you intended to make a series expansion. If the series is what you are after, it is OK. If, in contrast, you need an analytic function approximating the result of the integration, I would propose to search for the model around the following expression: model = k1*r^a/(1 + k2*r^b). $\endgroup$ Feb 2 at 15:32
  • $\begingroup$ Manipulate -- clever trick! $\endgroup$ Feb 2 at 23:32
  • $\begingroup$ later, I just find a function called FindFormula[], powerful! $\endgroup$ Feb 3 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.