Melvin Brown

119 Reputation

6 Badges

15 years, 87 days

Social Networks and Content at Maplesoft.com

Maple Application Center

MaplePrimes Activity


These are replies submitted by Melvin Brown

@Kitonum 

Thanks very much for re-drafting my code; your results are what I was aiming for...

MRB

@Preben Alsholm 

Preben thanks for your help on this...

plrPt := proc (t) options operator, arrow; plots[polarplot]([[sin(t), 0], [cos(t), (1/3)*Pi], [cos(2*t), (2/3)*Pi]], axiscoordinates = polar, symbol = solidcircle, style = point, color = red, symbolsize = 12) end proc

MRB

@Melvin Brown 

Just checked again...

Correction: 

plots[fieldplot3d]([2*x, 2*y, 2*z], x = -1 .. 1, y = -1 .. 1, z = -1 .. 1, grid = [5, 5, 5], arrows = SLIM,
colorscheme=["xyzcoloring", (x, y, z)->sin(x)*sin(y)*sin(z)]);

was indeed ignored, as you found.

MRB

@vv 

 

Thanks;

plots[fieldplot3d]([2*x, 2*y, 2*z], x = -1 .. 1, y = -1 .. 1, z = -1 .. 1, grid = [5, 5, 5], arrows = SLIM,
colorscheme=["xyzcoloring", (x, y, z)->sin(x)*sin(y)*sin(z)]);

does indeed work in my 2016.1 version.

MRB

@Preben Alsholm 

Thanks:

color = RGB(sin(x),sin(y),sin(z)) does indeed work in my 2016.1

 

MRB

 

@tomleslie 

....That seems to have worked.  Thanks

@roman_pearce 

Thanks for your help.  (It's getting close to decision time on whether to take the free upgrade to Windows 10 or to stay with Windows 7 for a few more years.)

MRB

@cskoog 

Many thanks; very helpful.

MRB

Thanks, acer.  I'll draw a line under that; it would have been very useful.

MRB

@acer

Ah...  the .mla seems to be in binary (or other obscure format)... at least from viewing in Notepad, it seemed so.  But perhaps there are MAPLE commands that will list the contents of a .mla?  

However, I've just found that one can at least write protect an .mla file

LibraryTools[WriteMode]("/home/user/mylib/MyLib.mla","READONLY");

to guard against accidental corrpution.  I guess one can easily reset the write mode, if necesaary?

MRB

 

 

@acer 

Many thanks. I did appreciate the distinction between those two options, but I was interested to see if it could done with an .mla, partly for security of the code, should that be required.

I'll take a look at the putting the code in the start up code section

MRB

@Carl Love 

@acer

Well, I've just tested this.  Here are my findings:

MAPLE 2015.1 running a Maple worksheet
==========================

I placed the following code in the Start up Code section

libname := libname, "S:/MRBwork/MAPLE/MRBlibrary/BealSearch/BealSearchSp8.mla";
with(BealSearchSp8);

This automatically links in the package I require, when the worksheet starts up.

I then use the Mathematical Expression component to embed a call to a procedure from this package. On pressing return outside the component box, I obtain the expected result.

Fine!

MAPLE Player 2015
=================

However, when I start the same worksheet in MAPLE Player, I have the following response:

0, "permission denied: no read access (%1)", "S:/MRBwork/MAPLE/MRBlibrary/BealSearch/BealSearchSp8.mla"

which presumably comes from the start up code section.

I then find (perhaps unsurprisingly) that the Mathematical Expression component calling the procedure evokes no result at all.

I have taken a look at the permissions on that file and all groups and users have read and read/excute permission.

Are you able to suggest a route forward?

MRB

@acer 

Thanks very much for the helpful tips; I'll work through your suggestions. I've not previously used the Startup Code Region.

MRB

Mac

 

Many thanks for that helpful answer; particularly that A knows about B and C.

 

Cheers MRB

@acer 

This problem of creating a fortran dll for calling in MAPLE is now solved. The solution is explained and exemplified below.

My first attempt at generating dll with fortran g77 failed because g77 does not have a -shared option to generate a dll.

The gfortran complier in the gcc collection does have the -shared option for dll generation. However, my attempt at using gfortran from the MinGw gcc compiler set (under Windows 7) failed to create an executable let alone a dll. I was unable to diagnose the cause.

Finally, I installed Cygwin (on a Windows 7 laptop). This includes the gcc collection of compilers, and I was thus able to successfully generate a dll. A key step was setting an environmental path variable to the cygwin1.dll in C:\cygwin64\bin to enable its link from the .dll to be resolved.

The gfortran compile sequence was as follows: First compile myfunc.c into object code:

gfortan -c myfunc.for

in which myfunc.for defines the FORTRAN function mult(a,b) where a and b are real numbers being multplied together. Then, using gfortran we build a shared library from the object file:

gfortran -shared -o myfunc.dll myfunc.o

The dll is then called up to define a function in MAPLE as follows:

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

We then find that:

fmult(3, 2.7);
8.10000038146972656

and

[seq(fmult(2*j, 5*(j-1)), j = 1 .. 10)];

[0., 20., 60., 120., 200., 300., 420., 560., 720., 900.]

This completes the example. The difficultly lay not with MAPLE, but with finding and apt implementation of the gcc compiler set.

MRB

 

 

1 2 3 4 Page 3 of 4