Items tagged with integration integration Tagged Items Feed

Hi
I want to solve this integration simbolic:


I use this cammand :

But Maple return this:

Would you Please Help me , thanks

I'm running into a very simple problem with the way that Maple integrates Heaviside functions. Naively, it should act like a step function, but it is not integrating properly. See the attached document.

int(int(Heaviside(-x^2-y^2+1), x = -1 .. 1), y = -1 .. 1)

0

(1)

evalf(Int(Heaviside(-x^2-y^2+1), [x = -1 .. 1, y = -1 .. 1]))

3.141592654

(2)

int(piecewise(-x^2-y^2+1 > 0, 1, 0), [x = -1 .. 1, y = -1 .. 1])

Pi

(3)

``


Note that the symbolic integration of the Heaviside function (defined to be 1 inside the unit circle and 0 outside) gives zero, whereas it should clearly give the area of the unit circle, which the numerical integration does. I even checked that the (suposedly equivalent) piecewise definition symbolically evaluates to the area, and it, too, gets the right answer.

Anyone have any clue as to why the symbolic integration of this Heaviside function is so wrong? My understanding is that if we do the integral as two nested 1D integrals, the returned function (as a function of y) is zero everywhere except at y=0, but that result cannot be right either.

Thoughts?

 

Download Heaviside-error.mw

Greetings to all. The title describes it well, I am writing about testing the limits of the Maple integration engine. A recent discussion at math.stackexchange.com features a family of integrals that involve the product of a power of the natural logarithm and a rational function, more precisely,

int((log(x))^n/(x^3+1), x=0..infinity);

These integrals can be evaluated recursively as described at the MSE link using a technique that generalizes to other types of rational factors. Unfortunately Maple apparently only finds a simple closed form for a few small initial values of n. The following transcript of a Maple session illustrates the problem. Mathematica was successful here. Also observe the memory allocation in the Maple session.

    |\^/|     Maple 18 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2014
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> restart; read `cl.maple`;
alpha := (n, k) ->

                                                           n
    -1/3 exp(1/3 I Pi + 2/3 I Pi k) (1/3 I Pi + 2/3 I Pi k)

Q := proc(n)
local res;
option remember;
    if n = 0 then return 2/9*sqrt(3)*Pi end if;
    res := -add(alpha(n + 1, k), k = 0 .. 2)/(n + 1) - add(
        binomial(n + 1, p)*(2*I*Pi)^(n - p)*Q(p),
        p = 0 .. n - 1)/(n + 1);
    simplify(res)
end proc

                               infinity
                              /               n
                             |          log(x)
              VERIF := n ->  |          ------- dx
                             |           3
                            /           x  + 1
                              0

> Q(6);
                                7  1/2
                          910 Pi  3
                          ------------
                              6561

> VERIF(6);
memory used=3.8MB, alloc=40.3MB, time=0.18
       7  1/2
9890 Pi  3       490    5  1/2
------------- + ----- Pi  3    Psi(1, 1/3)
   177147       19683

        490    5  1/2                10    3  1/2            2
     + ----- Pi  3    Psi(1, 2/3) + ---- Pi  3    Psi(1, 1/3)
       19683                        2187

        20   1/2   3
     + ---- 3    Pi  Psi(1, 2/3) Psi(1, 1/3)
       2187

        10    3  1/2            2    40                 4
     + ---- Pi  3    Psi(1, 2/3)  + ----- Psi(2, 2/3) Pi
       2187                         19683

        10   1/2               3
     + ---- 3    Pi Psi(1, 1/3)
       2187

       10               1/2               2
     + --- Psi(1, 2/3) 3    Pi Psi(1, 1/3)
       729

       10   1/2                           2
     + --- 3    Pi Psi(1, 1/3) Psi(1, 2/3)
       729

        10   1/2               3    40     4
     + ---- 3    Pi Psi(1, 2/3)  - ----- Pi  Psi(2, 1/3)
       2187                        19683

        20             2  1/2
     + ---- Psi(2, 2/3)  3    Pi
       6561

        40               1/2
     - ---- Psi(2, 2/3) 3    Psi(2, 1/3) Pi
       6561

        40    2
     + ---- Pi  Psi(2, 2/3) Psi(1, 1/3)
       2187

        40    2
     + ---- Pi  Psi(2, 2/3) Psi(1, 2/3)
       2187

        20   1/2            2
     + ---- 3    Psi(2, 1/3)  Pi
       6561

        40    2
     - ---- Pi  Psi(1, 1/3) Psi(2, 1/3)
       2187

        40    2
     - ---- Pi  Psi(1, 2/3) Psi(2, 1/3)
       2187

> evalf(Q(6));
                          725.5729634

> evalf(VERIF(6));
                          725.5729630

> quit
memory used=22.4MB, alloc=44.3MB, time=0.47
user@host:~/complex-logint$ math
Mathematica 10.0 for Linux x86 (64-bit)
Copyright 1988-2014 Wolfram Research, Inc.

In[1]:= Integrate[Log[z]^6/(1+z^3), {z, 0, Infinity}]

                7
          910 Pi
Out[1]= ------------
        2187 Sqrt[3]

In[2]:= N[Out[1]]

Out[2]= 725.573

In[3]:=
user@host:~/complex-logint$

My question for you all is what the appropriate techniques would be to get Maple to at least simplify the rather involved output from the integration engine to obtain a match of the closed form from the recursive equation.

Best regards, Marko Riedel.

cl-maple.txt

Hello Mapleprime users

I am having an issue with a numerical integration calculation. I have a large(ish) polynomial integrand and need to apply two integrations which I am using the _cuhre method for. See attached the minimum working example file.

Numerical_integration_HF.mw

Firstly some simplifications are done to the integrand and then a basic for loop which calculates the integration for r from 0 to 20 in steps of 0.1. The issue occurs when the loop hits r~2.5 (on my machine, Maple 2015, i5, 16GB ram). Up to that point the calculation is steady with the following stats per point calculated:

memory used=87.59MiB, alloc change=0 bytes, cpu time=3.45s, real time=3.15s, gc time=439.16ms


Then when the calculation gets to ~2.5 it just hangs and will not calculate past it. Any ideas as to what is going on here?

Any help would be appreciated with this issue.

Thank you in advance

Yeti

 

 

Hello,i cant solve this expression in maple,What is the integral result?

Thanks.

Hi, Maple community

I am trying to integrate a 3D data numerical set. I managed to execute an array interpolation algorithm and apply it to plot a smooth surface but I do not know how to integrate it numerically. I want to be able to integrate the data not only in its domain but also in sub-domains for multiple purposes.

I've found here a topic about it and tried to apply suggestions made with no success.

Here I copy the worksheet steps:

restart:
with(LinearAlgebra):
with(CurveFitting):
with(plots):

Initial Parameters

Nx:=8;    Points in the x direction
Nz:=6;    Points in the z direction
Lx:=3;    This means x goes from 0 to 3
Lz:=2;    This means z goes from 0 to 2
Delta[ze]:=evalf(Lz/(Nz-1));
Delta[xe]:=evalf(Lx/(Nx-1));

DataPn:=Matrix(Nx,Nz,0):         Matrix to store values in the 3rd direction

The following step is a function that I used to simulate data that I will later on will get by measurings.

for i from 1 to Nx do
 for j from 1 to Nz do
  DataPn[i,j]:=evalf(sin(Pi*(i-1)*Delta[xe]/Lx)*sin(Pi*(j-1)*Delta[ze]/Lz)):
 end do;
end do;

Setting data to use ArrayInterpolation

datax:=Array([seq((i-1)*Delta[xe],i=1..Nx)]);
dataz:=Array([seq((j-1)*Delta[ze],j=1..Nz)]);

In this step here, I don't really understand what this argument [[a],[b]] means but ArrayInterpolation cannot work without it.

MI:=(a,b)->ArrayInterpolation([datax, dataz],Array(DataPn),[[a],[b]],'method' = 'spline')[1,1];

Plot and display the interpolation and the real function to compare the quality of the interpolation, actually it does an excellent job, at least with this data.

G1:=plot3d(MI, datax[1]..datax[Nx], dataz[1]..dataz[Nz],labels=[x,z,Pn]);
G2:=plot3d(evalf(sin(Pi*x/Lx)*sin(Pi*z/Lz)),x=0..3,z=0..2,color=red);
display(G1,G2);

And finally I found this integration method here in mapleprimes

evalf(Int(x->evalf(Int( y->MI(x,y), 0..3,method=_d01akc)),0..2,method=_d01akc));

And the result is 1.102279199. I thought maybe I was setting wrongly the integration limits or the order in the command but in any case the result was near the analytic case which was:

int(evalf(sin(Pi*x/Lx)*sin(Pi*z/Lz)),x=0..3,z=0..2);

2.431708408

In this scenario I know the result is wrong because I can compute the exact solution, but later on I won't be able to do so. Also, later I'm interested in the integration, let's say, x from 0..0.5 and later from 0.5..1 and so on (keeping z always from 0 to 2) So, the main questions are:

1. Am I setting something wrong?
2. If I delete the method option in the integral, it takes a lot of time for the program to compute any result. Why?
3. Is there any other way to integrate this? I mean, any other way to write the command to compute the integral.
4. What does the [[a],[b]] argument stands for in ArrayInterpolation?

Regards and thanks for your help.

Hello Everyone

 

I have an expression which I would like to integrate from x=0 to x=L. The expression is 

x1:=(sin(beta*x)*cos(m*Pi*x/L))/(1+alpha*x)

 

Here, beta, m, alpha are constant. However I want the result in terms of these quantities.

 

I will be grateful if you could help mw in this regard.

Thanks a lot.

Dear all,

I have somme difficulties to calculate this integral.

int(I*sqrt((R*exp(I*theta)+1)/(R*exp(I*theta)-a)), theta = 0 .. Pi);

Thanks

I have the following integration:

 

Int(c-sqrt(a+b*(v*x+u)^2), x = -(b*u+sqrt(b*c^2-a*b))/(b*v) .. (-b*u+sqrt(b*c^2-a*b))/(b*v));

This integration is equivalent to the following integration (between dashed lines):

-----------------------------

NumericEventHandler(invalid_operation = `Heaviside/EventHandler`(value_at_zero = 1)):

Heaviside(0)

Heaviside(x) = convert(Heaviside(x), piecewise)

Int(Heaviside(x+(b*u+sqrt(b*c^2-a*b))/(b*v))*(c-sqrt(a+b*(v*x+u)^2)), x = -infinity .. (-b*u+sqrt(b*c^2-a*b))/(b*v));

-----------------------------

In this form the function, which is to be integrated, is taken as equal to zero for x < -(b*u+sqrt(b*c^2-a*b))/(b*v).

Now I want to write a form such that the function is also taken as equal to zero for x > (-b*u+sqrt(b*c^2-a*b))/(b*v).

How should I do this? Can this also be done with Heaviside?

Hello people in mapleprimes,

 

I cannot obtain a proper result from the following code.

a:=int(((beta/beta[1,2])^(-theta/(1-theta))-kappa[1]^(-theta/(1-theta)))*m*beta^(m-1),beta=0 .. kappa[1]*beta[1,2]);

 

Please tell me if you know how to have maple calculate it.

 

Thanks in advance.

 

taro

Doing the following:

Why is int used when defining F not evaluated to x^2/2 when used to defined function F as shown in (2), when the int is evaluated when used separately in (3)?

Dear all

I need a help to compute the integral from -1 to 1 of product of derivative of legendre polynomial

> restart;
> with(orthopoly);

P(n, x); # Designe the legendre polynomial of degree n
I would like to compute

int(diff(P(n,x),x)*diff(P(m,x),x),x=-1..1) ;

 

In this previous formula when I put n=2 and m=3 I can get the result but in general  case i cannot,

Many thanks

 

 

I have written a code which generates a Gaussian like curve as a set of points and have written some basic commands to find several important quantities from the plot. The three of importance here are the peak position, peak height and Full Width at Half Maximum.

See the attached minimal working example maple worksheet.

It can find the peak position and the peak height no problem, but another quantity I want it to find is the Full Width at Half Maximum (FWHM). I use the aforementioned calculated values to find the left and right components of the FWHM but the fsolve command just hangs.

In the worksheet this is not evident but in the much longer full code which I run through the terminal and prints the values to a file, it begins the fsolve command and reaches a particular value and it just hangs. No amount of waiting time makes it continue the calculation.

However if I use an approximate integration scheme (such as Riemann sums) then the fsolve part executed perfectly. fslove seems to get stuck during the numerical integration step.

There is probably an easy answer to this problem which I am missing. Any help is appreciated.

fsolve_numerical_integration.mw

 

- Yeti

Hi all,

I'm trying to perform some calculations containing exponential integrals. Here is a snippet of my code:

restart;

H:=0.5:

q[0]:=10^5:
Es := 4*10^9:

p[0]:=10^6:
q[s]=10^10:

C := (q) -> q^(H+1.5):

G := (q) -> (int(q^3*C(q), q = q[0] .. q)):
P := (q) -> 1/sqrt(G(q)):

p := (xi) -> p[0]/P(xi*q[0]):
w:= (q,xi) -> 1/(Pi*(int(C(qs)*qs^3, qs = xi*q[0] .. q)))^(1/2):

U := (xi) -> (int(q*C(q)*w(q,xi)*(Int(exp(-(w(q, xi)*ps/Es)^2)/ps,ps=p(xi)..infinity)),q=xi*q[0]..q[s])):

My objective is to evaluate U for a set of discrete values of xi for further processing e.g. visualisation via plots. Neither value(U(xi)) nor evalf(U(xi)) produces a numerical result so I keep searching for solution. Does anybody have an advice how to solve U?

Regards, lassa

1 2 3 4 5 6 7 Last Page 1 of 13