mapj

183 Reputation

9 Badges

12 years, 8 days

MaplePrimes Activity


These are answers submitted by mapj

Your definition of AA gives an error. It looks like you want the Euler-Lagrange equation, so you can use the command in the Variational Calculus package (see help). This will give the ODE, which then can be solved with dsolve.

I was the one working on this back then. I don't have the files anymore as I switched to another approach, but the process I gave back then worked.

You can try being more explicit about the arguments like this:

forsub :=
define_external('forsub',
                'FORTRAN',
                'argreala'::ARRAY(float[8]),
                'arginta'::ARRAY(integer[4]),
                'argrealb'::ARRAY(float[8]),
                'argrealc'::ARRAY(float[8]),
                'argintb'::integer[4],
                LIB="forlib.dll"):

where a normal Fortran call would be

call forsub(argreala,arginta,argrealb,argrealc,argintb)

where argreala, arginta, argrealb and argrealc are real or integer matrices as appropiate, and argintb is an integer in Fortran. The Fortran subroutines are in the library called forlib.dll.

After defining the arguments as the appropriate types in your Maple code like

argreala:=Matrix(5,3,datatype=float[8]): # fill in the terms in argreala after this

the call in Maple is just

forsub(argreala,arginta,argrealb,argrealc,argintb);

This process worked for a single Fortran subroutine when I used it back then, and so hopefully it still does.

I suggest you try the old var package by Michal Marvan. It's part of the Maple share library at http://www.maplesoft.com/applications/view.aspx?SID=1691.

M.D.

This works for me.

v:=Vector([0.001,0.001,0,0,0,0],datatype=float[8]);

sf1(v); # works

Your problem has a nonlinear objective function so you need to use NLPSolve to try to find a solution.

I asked a similar question here: http://www.mapleprimes.com/questions/203480-Define-And-Use-Abstract-Linear-Operator

Does that help you?

 

Is this what you want?

with(LinearAlgebra):

with(RandomTools):

n:=3;

dwanted:=2;

a:=RandomMatrix(n,n,generator=-1.0..1.0,shape=symmetric);

da:=Determinant(a);

# swap rows 1 and 2 if da < 0

if da < 0 then a:=RowOperation(a,[1,2]); fi:

a:=(dwanted/abs(da))^(1/n)*a;

da:=Determinant(a);

I avoid the Maple docs like the plague and use straight text files that I read into a Maple session.

Text files are easy to edit and you can cut and paste code quickly.

Any decent editor will do the job. On Windows, Winedt and TSE Pro are good choices.

 

The terms in your eqns are large. Why not non-dimensionalizing them so that your eqns terms are around unity. This may make the dsolve error estimator more accurate. Also you could experiment with higher accuracy and different values of absolute and relactive errors.

Thanks to everyone for the solutions.

The latest Classical doesn't work for me on 32-bit Windows 7. A simple plot will freeze the system.

I think the Standard interface is terrible if you just want to get things done. My approach is to use Standard interface but I've changed the "input display" under options to Maple notation. This makes it behave more like Classical.

Page 1 of 1