AmusingYeti

165 Reputation

8 Badges

9 years, 321 days

MaplePrimes Activity


These are questions asked by AmusingYeti

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

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

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

Hello Maple primers

I am trying to do a coordinate transformation which involves a number of partial derivatives. I turned to the PDETools[dchange] to accomplish this but it will just return 0 when run through.

The problem is as such. First two functions are defined which contain a lot of "stuff". Then the forward and reverse transformations are defined between the coordinates; and finally the transformation is done.

   del_1:=Diff(Y,r1,r1)+2/r1*(Diff(Y,r1)) + Diff(Y,r2,r2)+2/r2*(Diff(Y,r2))+2*(Diff(Y,r3,r3))+4/r3*(Diff(Y,r3))+((r1^2-r2^2+r3^2)/(r1*r3))*(Diff(Y,r1,r3))+(r2^2-r1^2+r3^2)/(r2*r3)*(Diff(Y,r2,r3)):

   del_2:=Diff(Y,r1,r1)+2/r1*(Diff(Y,r1))+(r1^2-r2^2+r3^2)/(r1*r3)*Diff(Y,r1,r3)+Diff(Y,r2,r2)+2/r2*(Diff(Y,r2))+(-r1^2+r2^2+r3^2)/(r2*r3)*(Diff(Y,r2,r3))+4/r3*(Diff(Y,r3))+2*(Diff(Y,r3,r3)):

#Forward transformation

R1:=0.5*(v)+0.25*(w):
R2:=0.5*(u)+0.25*(w):
R3:=0.5*(u)+0.5*(v):

tr:={r1=R1,r2=R2,r3=R3}:

#Reverse transformation
rR1:=(-r1+r2+r3):
rR2:=(r1-r2+r3):
rR3:=2*(r1+r2-r3):

rtr:={u=rR1,v=rR2,w=rR3}:
nv:={u,v,w}:
AA:=simplify(del_1+del_2);
PDEtools[dchange](tr,AA,nv,rtr);

This will return zero. Is there something obvious I am missing here? I have used the dchange tool before in a similar manner and it has worked without issue.

1 2 3 4 5 Page 4 of 5