260 Reputation

13 Badges

10 years, 139 days

MaplePrimes Activity

These are replies submitted by Andriy

@Carl Love

@Carl Love 

The biggest matrix psi1(i).H.psi2(j) with wich I'd like to cope with is 3060 \times 3060. I need to get the lowest eigen value and the corresponding eigenvector of this matrix.  However, the matrix of size 276 \times 276 will give me some useful information too. Matrix psi1(i).H.psi2(j) is a sparse matrix. Is this explanation sufficient or should I give more details about psi1(i), H, psi2(j) so that you could help me?

I've tried to use Grid:-Seq but Maple gives an error. A test example of my program is attached to my reply. Two procedures MatrElems and MatrElemsGrid are the key procedures for calculations. Procedure MatrElemsGrid is the same as MatrElems but uses Grid:-Seq instead of seq.

@Carl Love

Thank you for comment! I guess that it'll be good for those using Threads in their calculations. Unfortunately, I couldn't find it out myself due to that simple reason that I carried out my tests with

elem := (i,j)->BesselJ(0, i)*BesselJ(1, i)*BesselJ(0, j)*BesselJ(1, i)

which is not a thread safe procedure. My tests with that procedure gave me results which, as I now understand, have no sense.

elem procedure that I need to use in my work is not thread safe too. My elem(i,j) is psi1(i).H.psi2(j) (matrix element of the Hamiltonian of some many-body quantum system). So, unfortunately, threads are useless in my case.

@Carl Love 
In my real code elem is a combersome procedure, so using Threads is appropriate.

I guess the declaration

A:= Matrix(N, N, shape= symmetric);

is excessive and I suppose that

A:= Matrix(N, N);

will work a bit faster. I've tried to do a test that could prove or disaprove my assumption, but test gave strange results and I cannot confidently assert that second declaration provides faster calculations.

One moment is still unclear. Maple says that A is Fortran_order. Fortran uses Column-major order, therefore it is natural to assume that

for j to N do
     A[..,j]:= <Threads:-Seq(Elem(i,j), i = 1..N)>
end do:

will work faster. However it is slower. Why?

Several derivative approaches can be suggested. It would be natural to assume that the following one is optimal

A := Matrix(N, N, shape = symmetric);
for i to N do
    A[i, i .. N] := <Threads:-Seq(elem(i, j), j = i .. N)>
end do:

but tests could not prove it.

@Carl Love 

A result with N=2^2 and elem(i,j)=i*j:

Hi. I guess you have to have a look in book

"A Treatise on the Theory of Bessel Functions" (Cambridge Mathematical Library)
by G. N. Watson.

@Carl Love
@Axel Vogt

In Fortran:

a) input:

f = exp(-x**2)*exp(2.0_nag_wp*x) 


d01amf example program results 
 ** Round-off error prevents the requested tolerance from being achieved:
    EPSABS =  0.0E+00  EPSREL =  1.0E-12.
 ** ABNORMAL EXIT from NAG Library routine D01AMF: IFAIL =     2
 ** NAG soft failure - control returned
 epsabs -      absolute accuracy requested =  0.00E+00
 epsrel -      relative accuracy requested =  0.10E-11
 result -    approximation to the integral =       NaN
 abserr -   estimate of the absolute error =       NaN
 iw(1)  -      number of subintervals used =   20

b) input:

f = exp(-x**2+2.0_nag_wp*x)


d01amf example program results 
 epsabs -      absolute accuracy requested =  0.00E+00
 epsrel -      relative accuracy requested =  0.10E-11
 result -    approximation to the integral =   4.81803
 abserr -   estimate of the absolute error =  0.33E-11
 iw(1)  -      number of subintervals used =    8

So, there is really trouble with NAG, not with Maple.

I guess that Axel Vogt is right. NAG-integration function can not recognize the damping
of the final result for exp(-x**2)*exp(x) and evaluates each of the factors separately,
where second factor diverges.
However, it is not always possible "to prepare the task for numerics", as Alex recomends.
For instance, you have to calculate the coefficients of Hermite-Fourier series.

But, as it became clear to me, CAS (in particular Maple) have advanteges over Fortran or C!
We can really 'prepare' the task for numerics in CAS!

Simplify command fixes the problem:


Thank you for help!

@Carl Love 
Good idea. I'll check it with Fortran.

@Carl Love 

Let's add digits option to the integration.

u := x -> Int(exp(-(xi-x)^2)*exp(xi), xi = -infinity .. infinity, method = _d01amc, digits = 5);

Error, (in evalf/int) NE_QUAD_ROUNDOFF_TOL:
  Round-off error prevents the requested tolerance from
  being achieved:  epsabs = 5.0e-008,  epsrel =  5.0e-005.

u := x -> Int(exp(-(xi-x)^2)*exp(xi), xi = -infinity .. infinity, digits = 5);


u := x-> Int(exp(-(xi-x)^2+xi), xi = -infinity .. infinity, method = _d01amc, digits=5);


Are you still think that it is OK with the Maple implementation of the NAG's method = _d01amc?


I'd like to create Sliders laid out in a tabe and triggered by action when content of the Textarea change. I need to have a possibility to destroy sliders too.


@Carl Love 
There is no significance to the brackets. It is exactly what I need. Thank you!

jzivku 265

Do persons with nicknames "admin" and "Maplesoft" take part in the competition? If no, isn't it better to move their apps. from the "Mobius@admin" group to "public" group?

@Joe Riel 

"It appears as though the pending embedded component actions are executed before the response to the dialog"

I agree.

@Joe Riel Conditional around

if assigned(Actions) then ... end if;

solves the problem. However, some points are still unclear to me. You say that "Maple first tries to execute any code in the startup region. Because that is not enabled, it doesn't occur." Why is not it enabled? I have a startup code where Actions module is described.

you say: "If you do not want to allow the startup region to execute automatically..." I want to allow the startup region to execute automatically. Does AutoExecute Security Level option 'Warn once for each worksheet' disable autoexecution?

1 2 3 4 5 6 7 Page 3 of 10