Items tagged with numerical-integral

I want to calculate the following integral numerically with required precision.

First, the functions are defined:

G1:=-0.9445379894;
f:= (x) -> 0.9/abs(x-0.4)^(1/3)+0.1/abs(x-0.6)^(1/2);
U1 := unapply(-exp(-x)*(evalf(Int(f(t)*exp(t), t = 0 .. x))+G1)/2-exp(x)*(evalf(Int(f(t)*exp(-t), t = 0 .. x))+G1)/2, x);
U:= unapply(-exp(x)/2*(evalf(Int(f(t)*exp(-t),t=0..x))+G1)+exp(-x)/2*(evalf(Int(f(t)*exp(t),t=0..x))+G1), x);

Next, I calculate the integral in numerical form:

evalf(Int(U1(x)^2+U(x)^2-2*f(x)*U(x), x=0..1, digits=4, method = _Gquad));

If I specify digits=4, Maple return the answer -0.4291

If I use digits=5 or larger, Maple return someting like this

Is it possible to increase precision of calculation?


 

 

Hi, I try this numerical integral with:
int((1/2)*exp(-(1/2)*z^2)*Jo*sqrt(2)*(1-tanh(sqrt(q)*z/T)^2)/(sqrt(Pi)*T), z = -infinity .. infinity, numeric)
But does not work.
I have also tried it without success with:

evalf(Int((1/2)*exp(-(1/2)*z^2)*Jo*sqrt(2)*(1-tanh(sqrt(q)*z/T)^2)/(sqrt(Pi)*T), z = -infinity .. infinity, method = _d01amc, methodoptions = [maxintervals = 1000]))
How can i do?
Regards.

Hello! 

I got a set of data imported from excel which is of the size 2001x2. I've use DataPlot to plot the graph of this data but I can't seem to find a way to integrate it. I've used BSplineCurve to make the discreate values continious but I cant seem to integrate this new curve. Can someone please give me a solution or an alternative way to find an approximative way to find the area under the curve.

Thanks

I'm trying to numerically integrate components of the procedure-vector.

interim:=t->evalf(int(r1_lab_deriv(x)[1],x=0..t));

interim(5);

Getting this type of error:

Error, (in r1_rot_deriv) invalid input: fdiff expects its 2nd argument, N, to be of type {integer, name, list(integer), list(name), list(name = constant), set(name), set(name = constant), name = constant}, but received t = x

 A bit of googling gave me an impression that integration of procedures can be rather quirky.

File: ProcIntergration.mw (Problem occurs in the last lines of the file.)

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 :)

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

I am trying to integrate solutions to a set of differential equations I have obtained numerically but keep getting this error:

Error, (in solW) invalid input: subs received sol(r), which is not valid for its 1st argument

For simplicity, let's say I am interested in integrating the function W(r), which I obtain from 

sol := dsolve({eqns, ics}, numeric, abserr = 10^(-10), relerr = 10^(-10), range = ymin .. ymax)

I then use

solW := r -> subs(sol(r), W(y))

This gives me W(r) for any r in the range ymin to ymax. But I cannot do anything with this function. For example, 

int(solW(r),r=ymin..ymax) or plot(solW(r),r=ymin..ymax) give the error above. I know that I can plot the solutions using odeplot, but is there something analogous for integrating the solutions? 

Thanks!

I would like integrate and plot the following double integral:

 

I enclosed tryingdf.mw

Hi,

I would like to plot E2(t) , but It gives errors. How can I avoid the singularity and solve this problem?


restart: with(plots):
with(Student[NumericalAnalysis]):
g1:=(x,t)->(-sqrt(t)/(2*sqrt(Pi*r^3)))*(sin((r*(x-1)^(2)/(4*t))+(Pi/4))-sin((r*(x+1)^(2)/(4*t))+(Pi/4))):

g2:=(x,t)->int(g1(x,t),r=1..infinity);

g3:=(x,t) -> (diff(g2(x,t),t)):


g4:=(x,t) -> (diff(g2(x,t),x,x)):


g5:=(x,t) -> ((1/2)*(g3(x,t)^2+g4(x,t)^2)):


E2:=t->(int(g5(x,t),x=0..100)):

evalf(E2(0));
Error, (in g1) numeric exception: division by zero
evalf(E2(1));
Error, (in g3) invalid input: diff received 1, which is not valid for its 2nd argument
plot(E2(t),t=0..20);

Best regards,

 

Page 1 of 1