Melvin Brown

124 Reputation

7 Badges

18 years, 332 days

Social Networks and Content at Maplesoft.com

Maple Application Center

MaplePrimes Activity


These are replies submitted by Melvin Brown

@acer 

Thanks again for engaging with this.    I am running MAPLE 18 under Windows 7.  I was unable to generate a dll using g77, as the latter seems not to recognise the -shared option.  

So I switched to using CYGWIN, and successfully used the -shared option to generated a dll file there:

$ gfortran -c test2.for

$ gfortran -c Mtest.for

$ gfortran -shared -o mult.dll test2.o

However, that dll file was not accepted by MAPLE, in which the line

fmult:=define_external('mult',LIB="c:/shared/mult.dll",FORTRAN,'a'::(float[4]),'b'::(float[4]),RETURN::(float[4]));

produced the following error:

Error, external linking: error loading external library c:/shared/mult.dll: The specified module could not be found.

Am I correct in thinking that a dll generated under CYGWIN will not be correctly parsed by MAPLE running under Windows, which presumably requires a dll targetted at Windows?  Can flags can be used to tell gfortran (under CYGWIN) to generate a dll targetted at Windows? Ideally, I am looking for a working example.

Regards

MRB

 

Thanks for your quick response.  I am working on Windows 7, hence use of dll.    I am also using g77 which appears not to support the -shared option; at least for me on Windows !! I have now separately compiled the main and function fortran files.  However, it remains the case that I am unable to create a dll that does not generate an error from the external function call.

MRB

I have some old (R3,4,5..) MAPLE files of types:

.mwz and .msz

and would like to open these files asndf convert them for viewing in MAPLE 16.

Is the way of doing this?

MRB 

 

 

I have some old (R3,4,5..) MAPLE files of types:

.mwz and .msz

and would like to open these files asndf convert them for viewing in MAPLE 16.

Is the way of doing this?

MRB 

 

 

Thanks; I sent an email asking for help to that email address on Jun 6 2011, but have not yet received a repy!  I have just re-sent that email.

 

MRB

Thanks; I sent an email asking for help to that email address on Jun 6 2011, but have not yet received a repy!  I have just re-sent that email.

 

MRB

Thanks for responding.  The plotted data is just an example, and the result you obtained is what I expect and also obtain on my old XP machine. I could have used any other function.  That is not my problem.  The problem is that I do not get that plot on my VISTA machine when N is sufficiently large; i.e when N=180, MAPLE just stalls and no plot appears.  So this seems to be a problem for plots of datasets above a certain size, on my installation of MAPLE 14 on VISTA.

MRB

Thanks for responding.  The plotted data is just an example, and the result you obtained is what I expect and also obtain on my old XP machine. I could have used any other function.  That is not my problem.  The problem is that I do not get that plot on my VISTA machine when N is sufficiently large; i.e when N=180, MAPLE just stalls and no plot appears.  So this seems to be a problem for plots of datasets above a certain size, on my installation of MAPLE 14 on VISTA.

MRB

Thanks, both.  I have added the shape=hermitian parameter in defining the matrix.

Just to illustrate what seemed to be the consequences:

One may, under certain conditions, see sudden polarity changes in the difference between eigenvalues.  The following code exemplifies the effect, which is not seen in EigenHerm2b2, but is observed in Eigenvectors. (This is an extreme case; in my application, in quantum mechanics, the polarity switches were far less frequent.) This was the motivation for writing EigenHerm2b2 for my application. I wish to track the dependence of the sum and difference of the eigenvalues against t, and although eigenvalues/vectors may change smoothly with t, were their ordering to swap over, while my addresses for them were fixed, might then the sum be unaffected and the difference change sign?! Still, I do have a work around for the 2x2 case.

>K:=(t)->evalf(Matrix(2,2,[[(cos(t)),sin(t/2)*(1-I)],[sin(t/2)*(1+I),(cos(t))]],shape=hermitian));Kperiod:=12:
 
>plot([(''EigenHerm2b2(K(tt))[1][1]''+''EigenHerm2b2(K(tt))[1][2]''),(''EigenHerm2b2(K(tt))[1][1]''-''EigenHerm2b2(K(tt))[1][2]''),Determinant(K(tt))], tt=0..Kperiod,legend=["sum","difference","determinant"],numpoints=100,title="sum and difference of eigenvalues (using EigenHerm2b2)");

>plot([(''Eigenvectors(K(tt))[1][1]''+''Eigenvectors(K(tt))[1][2]''),(''Eigenvectors(K(tt))[1][1]''-''Eigenvectors(K(tt))[1][2]''),Determinant(K(tt))], tt=0..Kperiod,legend=["sum","difference","determinant"],numpoints=100,title="sum and difference of eigenvalues (using Eigenvectors)");

MRB
 

 

 

 

I ran into the ordering problem when using Eigenvectors procedure to diagonalise a 2x2 Hermitian matrix J(t) parameterised by time t. At a certain time J(t) was such that the labelling/ordering of the eigenvectors and eigenvalues would swap, so introducing discontinuity in themasa function of time. I wrote the following procedure to get around the problem, using the same inputs and outputs as for Eigenvectors. While it has worked well for me, no guarantees are given as to its correctness. >EigenHerm2b2:=proc(Mi::Matrix) description "Determine the eigenvectors and eigenvalues of the 2 x 2 Hermitian matrix Input: Mi - Hermitian matrix; Output:(eigenvalues [column], eigenvectors [col1, col2])"; > local mtol,a,b,c,d,V1k,V2k,V,sroot,v,k,vnorm; > mtol:=1.0e-9; > if( not (is( is(Im(Mi[1,1]+Mi[2,2])< mtol) and is(abs(Mi[1,2]-Mi[2,1]^*) < mtol) ) ) ) then > print(`Matrix not Hermitian in EigenHerm2b2 =>`);print(Mi);return; > end if; > a:=(Mi[1,1]+Mi[2,2])/2;b:=(Mi[1,2]+Mi[2,1])/2;c:=(Mi[2,1]-Mi[1,2])/2/I;d:=(Mi[1,1]-Mi[2,2])/2; > sroot:=sqrt(b^2+c^2+d^2); > v[1]:=a+sroot;v[2]:=a-sroot; > for k from 1 by 1 to 2 do > V1k:=(v[k]-(a-d))/(b+I*c); > vnorm:=1/sqrt(1+(abs(V1k))^2); > V[k]:=[V1k*vnorm, vnorm]; > end do; > (Vector(2,[v[1],v[2]]),(Matrix(2, 2,[V[1],V[2]]))^+); > end proc: MRB
1 2 3 4 Page 4 of 4