Items tagged with integration integration Tagged Items Feed

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

Leading on from this post I made before:

http://www.mapleprimes.com/questions/210359-Integrating-Very-Large-Sums

I have a script that can now integrate larger sums thanks to the tips I was given. I now have a question regarding cpu usage when the calculation is run through a loop. I have attached two files. One contains the sum (large_sum.txt) which is then read in to the main Maple script (large_sum_int.mw).

When the loop is run, the first few points are calculated quite consistently with very similar cpu times. However, as the calculation progresses the cpu time suddenly increases (with larger sums than the one given it is a very severe increase) it then decreases again and returns to the time it took for the initial points to be calculated.

Is there a reason there is a sticking point in this calculation? is there a more efficient way to simplify it before it reaches the integration stage? When using simplify(...,size) the initial block takes a very long time to execute hence is not included here. This is not the largest sum that needs to be processed so I am looking for means to speed up calculation time/make it more consistent.

Any help is appreciated

large_sum.txt

large_sum_int.mw

-Yeti

A calculation I am currently doing has gotten to the stage where the time taken to integrate is just too much.
I have attached a minimal working example Maple script showing an example of the integration which is very messy. When this is run it takes ~ 10 seconds on my machine which is no issue. However the polynomial sum in this example is only a small version, and it can get, much, much larger. To the point it takes over a day to calculate (but it does evaluate).

The reason for this is that the boole integration method does not scale well with more terms in the sum. It beats the other methods for small sums (like in the example) but when the sum gets larger is not that good. The Riemann method appears to be the best for larger sums, but once again is still slow.

Is there any way to speed this up? As the Boole method is fast for this example and gives a good answer, I was thinking to break the much larger sums into smaller seperate sums and then process them all seperately with the Boole method and add up all the results?

Large_sum_integration.mw

 

Any feedback would be appreciated :)

The attached worksheet shows a small selection of new and improved results in integration for Maple 2016. Note that integration is a vast topic, so there will always be more improvements that can be made, but be sure that we are working on them.

Maple2016_Integration.mw

A selection of new and improved integration results for Maple 2016

New answers in Maple 2016

 

 

Indefinite integrals:

 

int(sqrt(1+sqrt(z-1)), z);

(4/5)*(1+(z-1)^(1/2))^(5/2)-(4/3)*(1+(z-1)^(1/2))^(3/2)

(1.1)

int(arctan((-1+sec(x))^(1/2))*sin(x), x);

-arctan((-(1/sec(x)-1)*sec(x))^(1/2))/sec(x)+(1/2)*(-1+sec(x))^(1/2)/sec(x)+(1/2)*arctan((-1+sec(x))^(1/2))

(1.2)

int(((1+exp(I*x))^2+(1+exp(-I*x))^2)/(1-2*c*cos(x)+c^2), x);

-x-2*x/c-x/c^2+I*exp(I*x)/c-I*exp(-I*x)/c-I*c*ln(exp(I*x)-1/c)/(c-1)-I*ln(exp(I*x)-1/c)/(c-1)-I*ln(exp(I*x)-1/c)/(c*(c-1))-I*ln(exp(I*x)-1/c)/(c^2*(c-1))+I*c*ln(-c+exp(I*x))/(c-1)+I*ln(-c+exp(I*x))/(c-1)+I*ln(-c+exp(I*x))/(c*(c-1))+I*ln(-c+exp(I*x))/(c^2*(c-1))

(1.3)

int(x^4/arccos(x)^(3/2),x);

(1/4)*(-x^2+1)^(1/2)/arccos(x)^(1/2)-(1/4)*2^(1/2)*Pi^(1/2)*FresnelC(2^(1/2)*arccos(x)^(1/2)/Pi^(1/2))+(3/8)*sin(3*arccos(x))/arccos(x)^(1/2)-(3/8)*2^(1/2)*Pi^(1/2)*3^(1/2)*FresnelC(2^(1/2)*3^(1/2)*arccos(x)^(1/2)/Pi^(1/2))+(1/8)*sin(5*arccos(x))/arccos(x)^(1/2)-(1/8)*2^(1/2)*Pi^(1/2)*5^(1/2)*FresnelC(2^(1/2)*5^(1/2)*arccos(x)^(1/2)/Pi^(1/2))

(1.4)

 

Definite integrals:

int(arcsin(sin(z)), z=0..1);

1/2

(1.5)

int(sqrt(1 - sqrt(1+z)), z=0..1);

((4/5)*I)*(2^(1/2)-1)^(3/2)*2^(1/2)+((8/15)*I)*(2^(1/2)-1)^(3/2)

(1.6)

int(z/(exp(2*z)+4*exp(z)+10),z = 0 .. infinity);

(1/20)*dilog((I*6^(1/2)-3)/(-2+I*6^(1/2)))-((1/60)*I)*6^(1/2)*dilog((I*6^(1/2)-3)/(-2+I*6^(1/2)))+(1/20)*dilog((I*6^(1/2)+3)/(2+I*6^(1/2)))+((1/60)*I)*6^(1/2)*dilog((I*6^(1/2)+3)/(2+I*6^(1/2)))+((1/120)*I)*6^(1/2)*ln(2+I*6^(1/2))^2-((1/120)*I)*6^(1/2)*ln(2-I*6^(1/2))^2+(1/40)*ln(2+I*6^(1/2))^2+(1/40)*ln(2-I*6^(1/2))^2+(1/60)*Pi^2

(1.7)

simplify(int(sinh(a*abs(x-y)), y=0..c, 'method'='FTOC'));

(1/2)*(piecewise(x < 0, 0, 0 <= x, 2*exp(-a*x))+piecewise(x < 0, 0, 0 <= x, -4)+2*piecewise(c <= x, -cosh(a*(-x+c))/a, x < c, (cosh(a*(-x+c))-2)/a)*a-exp(-a*x)+piecewise(x < 0, 0, 0 <= x, 2*exp(a*x))+4-exp(a*x))/a

(1.8)

int(ln(x+y)/(x^2+y), [x=0..infinity, y=0..infinity]);

infinity

(1.9)


Definite integrals with assumptions on the parameters:

int(x^(-ln(x)),x=0..b) assuming b > 0;

(1/2)*erf(ln(b)-1/2)*Pi^(1/2)*exp(1/4)+(1/2)*Pi^(1/2)*exp(1/4)

(1.10)

int(exp(-z)*exp(-I*n*z)*cos(n*z),z = -infinity .. infinity) assuming n::integer;

undefined

(1.11)


Integral of symbolic integer powers of sin(x) or cos(x):

int(sin(x)^n,x) assuming n::integer;

` piecewise`(0 < n, -(Sum((Product(1+1/(n-2*j), j = 1 .. i))*sin(x)^(n-2*i-1), i = 0 .. ceil((1/2)*n)-1))*cos(x)/n+(Product(1-1/(n-2*j), j = 0 .. ceil((1/2)*n)-1))*x, n < 0, (Sum((Product(1-1/(n+2*j+1), j = 0 .. i))*sin(x)^(n+2*i+1), i = 0 .. -ceil((1/2)*n)-1))*cos(x)/n+(Product(1+1/(n+2*j-1), j = 1 .. -ceil((1/2)*n)))*ln(csc(x)-cot(x)), x)

(1.12)

int(cos(x)^n,x) assuming n::negint;

-(Sum((Product(1-1/(n+2*j+1), j = 0 .. i))*cos(x)^(n+2*i+1), i = 0 .. -ceil((1/2)*n)-1))*sin(x)/n+(Product(1+1/(n+2*j-1), j = 1 .. -ceil((1/2)*n)))*ln(sec(x)+tan(x))

(1.13)

int(cos(x)^n,x) assuming n::posint;

(Sum((Product(1+1/(n-2*j), j = 1 .. i))*cos(x)^(n-2*i-1), i = 0 .. ceil((1/2)*n)-1))*sin(x)/n+(Product(1-1/(n-2*j), j = 0 .. ceil((1/2)*n)-1))*x

(1.14)

Improved answers in Maple 2016

 

int(sqrt(1+sqrt(x)), x);

(4/5)*(1+x^(1/2))^(5/2)-(4/3)*(1+x^(1/2))^(3/2)

(2.1)

int(sqrt(1+sqrt(1+z)), z= 0..1);

-(8/15)*2^(1/2)-(8/15)*(1+2^(1/2))^(3/2)+(4/5)*(1+2^(1/2))^(3/2)*2^(1/2)

(2.2)

int(signum(z^k)*exp(-z^2), z=-infinity..infinity) assuming k::real;

(1/2)*(-1)^k*Pi^(1/2)+(1/2)*Pi^(1/2)

(2.3)

int(2*abs(sin(x*p)*sin(x)), x = 0 .. Pi) assuming p> 1;

-2*(sin(Pi*p)*signum(sin(Pi*p))*cos(Pi/p)-p*sin(Pi/p)*cos(Pi*(floor(p)+1)/p)+sin(Pi*(floor(p)+1)/p)*cos(Pi/p)*p-sin(Pi*p)*signum(sin(Pi*p))-sin(Pi*(floor(p)+1)/p)*p+sin(Pi/p)*p)/((cos(Pi/p)-1)*(p^2-1))

(2.4)

int(1/(x^4-x+1), x = 0 .. infinity);

-(sum(ln(-_R)/(4*_R^3-1), _R = RootOf(_Z^4-_Z+1)))

(2.5)


In Maple 2016, this multiple integral is computed over 3 times faster than it was in Maple 2015.

int(exp(abs(x1-x2))*exp(abs(x1-x3))*exp(abs(x3-x4))*exp(abs(x4-x2)), [x1=0..R, x2=0..R, x3=0..R, x4=0..R], AllSolutions) assuming R>0;

(1/8)*exp(4*R)-29/8+(7/2)*exp(2*R)-5*R*exp(2*R)+2*exp(2*R)*R^2-(5/2)*R

(2.6)

Austin Roche
Mathematical Software, Maplesoft

Hello Mapleprime

I have a complicated integration to solve that I can not find an analytical solution for or even a simplification. I thus defaulted to using a Riemann sum to evaluate it which works well but is slow. I have had great speed increase using quadrature methods before so thought to try this.

The general form of the integration is as follows:

int(int(f(a,b),a=0..10),b=1-a..1+a)

The integration domains are coupled which is causing the issue. a is independent but then b depends on a. The quadrature methods require the end points of integration to evaluate to a floating point number which the second integration cannot do. Is there any way to bypass this issue and use Quadrature methods?

 

Thank you in advance

Good Morning,

This is the script that I have used to to an integration, as the command ''int'' didn't work because the coputation was really heavy.


p_old := 0;

g := 0; #index

E_tot_net_Point := 0;

for g to 2 do

 h := g+1;

 loopstart := SP_time[g];

 loopend := SP_time[h];

  for tt from loopstart by 0.01 to loopend do

   t := tt;

   P_tot_net_Fkt := t -> C_motore[g]*omega_motore[g]

if t≠SP_time[g] and t ≠ SP_time[h] then

 P_tot_net_Point := P_tot_net_Fkt(t);

 P_tot_net_Point_next := P_tot_net_Fkt(t+0.001);

 plt_P_tot_net_plt[t] := pointplot([t, P_tot_net_Point]);

 E_tot_net_Point := E_tot_net_Point+(P_tot_net_Point*0.01);

 plt_E_tot_net_plt[t] := pointplot([t, E_tot_net_Point]);

 p_old := P_tot_net_Point;

end if;      

  end do:

end do:

plots:-display(entries(plt_E_tot_net_plt, 'nolist'), title = "Energy", color = "Red", symbol = point, symbolsize = 20, gridlines = true, size = [1000, 500], labels = ['[s]', '[Watt*s]'], font = [axes, 12])


I have plotted the function as a series of points over the orizontal axis (t).

 

Now I would like to calculate the last value of the curve (which is itself a point) as a function of the orizontal axes t. How can I do it?

Something like E_tot_net_Point = f(t)

 

Thank you for the help

Hello everyone !

I have a problem when I want to calculate the following multiple integration numerically:

>evalf(Int(exp(sum(x[i],i=1..6)^2),[seq(x[i]=-1..1,i=1..6)]));
  value(%);

It doesn't work. But when I replace sum(x[i],i=1..6)^2 with sum(x[i],i=1..6), it works. Is there any feasible solution to my problem ?

Thank you for reading !

 

I think Simpson's rule for integration is very simple and it is just function evaluation over a few points on the interval of integration. So we expect it to be fast.

When I use it as a summation command (using Simpson's formula) it is really fast but when I use the command ApproximateInt with Simpson method it is sometimes really slow. For example

restart;

f := unapply(x^2/(sin(x)+x+1), x);

with(Student[Calculus1]);

evalf(ApproximateInt(f(x), x = 1 .. 2, method = simpson, partition = 20));

or even with partition=10 you must wait for a long time.

Please help.

Thank you

HI,

 

wondered if anyone knows how to make proper use of the large operators pallete on the list of pallettes on the left. For example when using the contour integration symbol on the left how do you enter the delimiters. 

I always get the error: "Error, unable to match delimiters". The help on this is not useful for this case. 

 

Thanks. 

 

It seem absurd that in Maple 18, why int(f(t),t) do not work instead one have to write Int(f(t),t) for indefinite integration?

 

How to compute integral of complicated function in maple 

int(e^(-s)*ln(1+s*e^-s)ds)from 0 to t 

i can not computed and how to simplify the integral because the wieght of calculation is to big?


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