0
$\begingroup$

I have an expression in multiple variables that is something like

4.85746*10^-7 Cos[ϕ] (1 + 
   1/2 (Abs[(-1.5782 Sqrt[1 - z^2 Sin[ϕ]^2] + 
          1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])/(1.5782 Sqrt[
           1 - z^2 Sin[ϕ]^2] + 
          1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2 + 
      Abs[(1.329 Sqrt[1 - z^2 Sin[ϕ]^2] - 
          1.5782 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])/(1.329 Sqrt[
           1 - z^2 Sin[ϕ]^2] + 
          1.5782 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2) Cos[
     2 ArcSin[
       z Sin[ϕ]]] - ((1 + 
        1/2 (-Abs[(-1.5782 Sqrt[1 - z^2 Sin[ϕ]^2] + 
                1.329 Sqrt[
                 1 - 0.70913 z^2 Sin[ϕ]^2])/(1.5782 Sqrt[
                 1 - z^2 Sin[ϕ]^2] + 
                1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2 - 
           Abs[(1.329 Sqrt[1 - z^2 Sin[ϕ]^2] - 
               1.5782 Sqrt[
                1 - 0.70913 z^2 Sin[ϕ]^2])/(1.329 Sqrt[
                1 - z^2 Sin[ϕ]^2] + 
               1.5782 Sqrt[
                1 - 0.70913 z^2 Sin[ϕ]^2])]^2))^2 (Cos[
         2 ArcSin[0.842099 z Sin[ϕ]] - 
          2 ArcSin[z Sin[ϕ]]] + 
        1/2 (Abs[(-1.5782 Sqrt[1 - z^2 Sin[ϕ]^2] + 
               1.329 Sqrt[
                1 - 0.70913 z^2 Sin[ϕ]^2])/(1.5782 Sqrt[
                1 - z^2 Sin[ϕ]^2] + 
               1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2 + 
           Abs[(1.329 Sqrt[1 - z^2 Sin[ϕ]^2] - 
               1.5782 Sqrt[
                1 - 0.70913 z^2 Sin[ϕ]^2])/(1.329 Sqrt[
                1 - z^2 Sin[ϕ]^2] + 
               1.5782 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2) Cos[
          2 ArcSin[z Sin[ϕ]]]))/(1 + 
      1/4 (Abs[(-1.5782 Sqrt[1 - z^2 Sin[ϕ]^2] + 
             1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])/(1.5782 Sqrt[
              1 - z^2 Sin[ϕ]^2] + 
             1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2 + 
         Abs[(1.329 Sqrt[1 - z^2 Sin[ϕ]^2] - 
             1.5782 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])/(1.329 Sqrt[
              1 - z^2 Sin[ϕ]^2] + 
             1.5782 Sqrt[
              1 - 0.70913 z^2 Sin[ϕ]^2])]^2)^2 + (Abs[(-1.5782 \
Sqrt[1 - z^2 Sin[ϕ]^2] + 
             1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])/(1.5782 Sqrt[
              1 - z^2 Sin[ϕ]^2] + 
             1.329 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2 + 
         Abs[(1.329 Sqrt[1 - z^2 Sin[ϕ]^2] - 
             1.5782 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])/(1.329 Sqrt[
              1 - z^2 Sin[ϕ]^2] + 
             1.5782 Sqrt[1 - 0.70913 z^2 Sin[ϕ]^2])]^2) Cos[
        2 ArcSin[0.842099 z Sin[ϕ]]]))

I want to integrate this expression first w.r.t. ϕ with limits 0 to 7 π/18 and then indefinite integral Integrate[F, z] w.r.t z. I tried it in many ways, but it is very difficult for me to solve this integral. Can anyone help to find out the solution of this integral. I would be highly obliged.

$\endgroup$
3
  • 1
    $\begingroup$ I highly doubt you can find an indefinite integral here. Such complicated functions are usually best solved numerically. $\endgroup$
    – Feyre
    Jul 1, 2016 at 11:08
  • $\begingroup$ Are you certain that you need a symbolic result? What do you want to use it for? $\endgroup$
    – Szabolcs
    Jul 1, 2016 at 11:31
  • $\begingroup$ after this integral i want to plot graph between thisfunction and z. $\endgroup$ Jul 2, 2016 at 13:55

2 Answers 2

2
$\begingroup$

The integrand cannot be solved when $|z|\rightarrow1$ Therefore, let's integrate the function on a possible domain, numerically.

zdat=Table[NIntegrate[f, {Phi, 0, 7 Pi/18}, {z, 0, i}], {i, -0.95, 0.95, 0.1}];

This gives us a list of values, from which we can approximate a function for this part of the domain for z. Plotting this list gives us:

lp = ListPlot[data = Transpose[{Table[i, {i, -0.95, 0.95, 0.1}], zdat}]]

enter image description here

We can use this to formulate an approximate function for z. The function appears to be odd, and includes the point {0,0}, and we can try an odd polynomial.

nlm = NonlinearModelFit[data, a z + b z^3, {a, b}, z]//Normal

1.2737*10^-8 z + 8.36705*10^-9 z^3

Show[Plot[nlm, {z, -0.95, 0.95}, PlotStyle -> Red], lp]

enter image description here

Adding a fifth order term barely changes the plot.

nlm2 = NonlinearModelFit[data, a z + b z^3 + c z^5, {a, b, c}, z] // 
  Normal

Plot[{nlm, nlm2}, {z, -0.95, 0.95}, PlotStyle -> {Red, {Dashed, Black}}]

enter image description here

Therefore the third order polynomial appears to approximate the function you seek quite well.

$$1.2737\times 10^{-8} z + 8.36705\times 10^{-9} z^3$$

When we extend the domain, the integrand becomes highly oscillatory, the errors in the numerical integration become quite large.

enter image description here

At this point, the function becomes rather more complicated, the function is then better approximated with an interpolating function:

zdat = Table[NIntegrate[f, {\[Phi], 0, 7 Pi/18}, {z, 0, i}, 
    Method -> {"GlobalAdaptive",MaxErrorIncreases -> 10000}], {i, -2.01, 2.01, 0.1}];

data = Re[zdat];
data = Transpose[{Table[i, {i, -2.01, 2.01, 0.1}], data}];
ip = Interpolation[data];
Show[Plot[ip[z], {z, -2.01`, 1.9900000000000002`}, PlotStyle -> Red],ListPlot[data]]

enter image description here

$\endgroup$
16
  • $\begingroup$ but i want to plot in -2 to 2 range.Is their any possible solution for that . $\endgroup$ Jul 3, 2016 at 10:27
  • $\begingroup$ @AnitaMaheshwari I've extended my answer. $\endgroup$
    – Feyre
    Jul 3, 2016 at 12:28
  • $\begingroup$ I am running these command again and again but it is showing me some error like its not a valid command for z and so, $\endgroup$ Jul 4, 2016 at 4:15
  • $\begingroup$ I have one more question this is the plot only for phi integral.their is any possiblity to integrate this function w.r.t z?? $\endgroup$ Jul 4, 2016 at 4:16
  • $\begingroup$ whatever you did may be its correct but the nature of the curve is not correct because the way you did in this is you are integrating w.r.t particular value every time that's why it will give you the nature of curve same as after integrating phi if you plot after phi integration is same as this curve.That's why i want separate indefinite integral of z. $\endgroup$ Jul 4, 2016 at 9:48
1
$\begingroup$

One can use NDSolve to construct a particular "indefinite" integral, e.g., $$f(z) = \int_0^z f'(ζ) \; dζ$$

First define integrand to be the OP's expression. The the following computes its integral.

Clear[df];
df[z0_?NumericQ] := 
  df[z0] = NIntegrate[integrand /. z -> z0, {ϕ, 0, 7 Pi/18}, 
    Method -> {"GaussKronrodRule", "Points" -> 11}, 
    MaxRecursion -> 20];
{fsol} = NDSolve[{f'[z] == df[z], f[0] == 0}, 
    f, {z, -2., 2.}]; // AbsoluteTiming
(*  {1.89007, Null}  *)

The function is an InterpolatingFunction that can be obtained with f /. fsol or plotted with f[z] /. fsol. See the documentation for NDSolve for more examples.

Plot[f[z] /. fsol, {z, -2., 2.}]

Mathematica graphics

$\endgroup$
5
  • $\begingroup$ when I run this integral in my mathematica 10.0 it showed me many error .Can you please tell me what should i do to remove all these error? $\endgroup$ Jul 4, 2016 at 4:27
  • $\begingroup$ @AnitaMaheshwari Did you define integrand to be your integrand? $\endgroup$
    – Michael E2
    Jul 4, 2016 at 5:08
  • $\begingroup$ whatever you did may be its correct but the nature of the curve is not correct because the way you did in this is you are integrating w.r.t particular value every time that's why it will give you the nature of curve same as after integrating phi if you plot after phi integration is same as this curve.That's why i want separate indefinite integral of z. $\endgroup$ Jul 4, 2016 at 9:47
  • $\begingroup$ @AnitaMaheshwari Like I said from the get-go, integrating this function symbolically is impossible. An interpolating function, is as good as it gets. $\endgroup$
    – Feyre
    Jul 4, 2016 at 11:02
  • $\begingroup$ can you please explain your code briefly because i tried that thing in mathematica 10 and i found nothing.Its a humble request if you can do this??taking main function to f. $\endgroup$ Jul 6, 2016 at 4:18

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.