sand15

922 Reputation

15 Badges

10 years, 287 days

MaplePrimes Activity


These are replies submitted by sand15

@acer

The  "export as a text file" (whichever the format is) followed by an "open the text file" with an ad hoc format generates an execution arror as soon as the body of the procedure contained in the mw file exceeds 80 characters.
Each 80 characters a "\n" is generated and is interpreted as a block-break when the text file is read.

 

So the example given in my previous mail works perfectly, but it is no longer true if you replace a:=1:  by
a:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.]:

(this will return something like
> a:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
and an error message such that “misplaced comma …)


I typed a long enough procedure directly from the ECLIPSE's editor (just an example) and tried to read this file from a Maple session: I encountered no problem at all.
But the same procedure typed in a worksheet (same syntax), imported as a mpl or a text file, which is finally open with a suitable format, produces execution error
 

 

 

  1. In my own words I would say there are two ways to approach the versioning issue :
    1. (the one I thought to initially) my “reference” code is a worksheet and I need to translate it in some text file to run the version control process (in this case I have to use File > Export … or WorksheetToMapleText).
    2. (the one you use if I am not mistaken) the “reference” is a text file build with some editor and directly usable in a version control process, and its testing needs a translation into Maple input style.

I have decided to use your approach and thus to translate into text files all my mw files.

 

  1. WorksheetToMapleText looked to be the clever tool to use.
    But it works fine if the mw file contains a few commands or simple Maple objects, and fails as soon as it contains procedures with embedded references to other (user) procedures (in case you would be interested in that I could develop the issue and send you the error message).
    Do you thing that it worth to invest further this solution ?

I then came back to the manual “File > Export as” operation.
There are many proposals (mpl, plain text, …) to generate a text file and 3 “open” possibilities to load it in a worksheet file.
Unfortunately I was not able to do the things correctly in this simple case :

  > F := proc()   # here is a “shift+enter”
     local a:         #   idem
     a := 1;          #   idem
     end proc:     # here is a simple “enter”
  > F()
  >

Amongst the many export and open format combinations, even those that seem to produce a “correct” worksheet lead to an execution error
This is due to the fact that the “shift+enter” keys combination is transformed into an “enter” section breaking command.

So the body of the procedure F is broken after the first line and I get an error message indicating that “local” is misplaced

  > F := proc()   # here is a “shift+enter”
  >  local a:         #   idem
  >  a := 1;          #   idem
  > end proc:     # here is a simple “enter”
  > F()
  >

How can I fix this ?

PS 1 : the worksheet

  > a := [   # here is a “shift+enter”
     1,         #   idem
     2]:        #   here is a simple “enter”
becomes after back and forth translation  > a := [1, 2]:   giving no break in the list structure.


PS 2 : I am working with Maple 2015 & 2016 on Windows 7

 

I thank you in advance
  

 

@Carl Love

 

Hi Carl,

You write “ I like one file per module.“ : me too, but I have no good argument for that except that I do the same thing in Fortran (for example).
Nevertheless I understand acer and his “a procedure = a file” stance  ; but it seems to require a strong discipline I am not sure to possess.
 
So if I understand your answer correctly, you use text files for versioning purposes, just as acer does too ?
In this case (I could have ask the same question to acer), let us say you “code” in vi or emacs or whichever editor and next you load your text file within a worksheet to test it ?
Is this not to wieldy?


Thanks for your answer

 

@acer

Hi acer,

Several points :

  • The TestTools package :  I did not know it, I am going to see how it might be helpful
     
  • You write “.mw is completely at odds with decent, workable revision control…” : this is also what it seemed to me (maybe there is this Maple IDE which could help ?)
     
  • The text file approach was the one I was looking at ; but I thought it had a main drawback (in my opinion) : I like to develop “my reference” code within the worksheet/text mode, which means that exporting it as plain text or mpl format is a manual operation I cannot vouch for (how can I be sure that this text file is the image of the worksheet  ?)
    Maybe a few elements of answer are given in your  next reply (packages Worksheet and FileTools)
     
  • About the Maplets : Why did  I use them ?
    (1) The data the user has to provide are naturally structured in “groups”  which should  be described sequentially  :  using Maplets  is a way to force the user to do the job  in the desired  order (seemed less simple with embedded components).
    (2) I knew a little about Maplets when I began working on the interface but nothing about embedded components (beyond their names) … ok, it’s probably a loose argument

    I am aware that Maplets are fell into disrepair today and that embedded components are often promoted instead : for this reason I had in mind to “migrate” one day to embedded components

Thanks for the time passed to complete your previous answer

 

@acer 

Thank you acer for your fruitful answer.
My “application” has two components :

  • first is a graphical maplet-based  interface made of about 50 procedures (not all contain maplets) ; all the stuff is contained in a single worksheet with 52 sections : one per procedure ; one for the module definition  (in which  use 50 commands such as proc1 := eval(:-proc1) in the export directive) and the last one for creating the mla.
  • Second is the “computational code” itself, made of a “main” worksheet, plus a lots of modules written as the previous one.

From your answer I realize that the way I used to build the code is not at all adapted for code versioning, for I have to split all my modules in individual text files.
(I guess the .mv to .mpl translation has to be done manualy from the “export as” menu ?).
Of course it will take some time but nothing complicated.

I’m not familiar with the $include directive in modules (not am I with $define) : I need to take a look in these.


By the way, on your answer, does it means that you make the developments directly in a text file, or that you do them in a  worksheet and then export it as a text file ?

Thanks again,  all that remains for me to do is to roll up my sleeves


PS : I intend to us GIT to do the versioning : does it exist a plugin to do syntactic colouring ? (for example tomments in one color, MAPLE keywords in another ...)

@ThU 

from Google with keywords "eclipse plugin maple" I came upon http://fr.maplesoft.com/products/toolboxes/IDE/index.aspx

and found this info

       Looking for Maple IDE?
       Maplesoft is no longer acting as a reseller for this product from DigiArea Inc.
       Maple includes many features to support application development, including a Code Editor. Learn more

that made me think to Maple IDE as an abandoned product  (Eclipse claims the plugin is no longer operational since 2012)

I'll be taken a look on the site you give,

Thanks for the answer

@acer ... it works perfectly well, thanks.

PS : I had misunderstood "interface(displayprecision=5)" which acts (as its name indicates), on the display alone, with evalf[5](...) which truly modifies the evaluation itself

@Kitonum 

It is really diffficult to rank the many solutions provided here, but yours is brilliant while being more versatile

The Sylvester's criterion is often use to check if square real valued matrix can be a variance matrix : as I am concerned with this issue your procedure will be of great help here too.

Thanks for all the work you did

@acer 
You write "FWIW"  ...
In french  "For What It's Worth" has some kind of negative significance, something like "I give you this information but it's not worth much, just look if you can find any interest in it".
Maybe its english significance is subtly different ?
For, personally, I find it very instructive (so from "french acceptation" this information matters), specially the one contained in the first grey rectangle : thinking to split the problem (more generally a problem) is an idea that could be useful in other situations.


Thanks acer
 

@John May 
I had used the command solve this way
solve(r^2-r*s+s^2 = 0, r)
and next checked if the solutions were complex (wich gave just a part of the answer) ... but it looked far too articifial

 

The way you handle the issue is undoubtedly more clever than mine.

Great thanks

@vv  it's all clear to me now.

You wrote :  is(I, positive)  is of course false (not being real) ... I now understand why

Thanks a lot

@vv  I have just done those few elementary tests : all if them return the correct "true" answer

restart;

assume(r, positive):

assume(s, positive):           

is(r^2+s^2, positive);                                  

is(r^2+s^2 > 0);                   

restart:                               

is(r^2+s^2 > 0) assuming r > 0, s > 0;                   

is(r^2+s^2 > 0) assuming positive                      

@vv ...  unfortunately disappointing answer (Maple handles only relatively simple conditions when dealing with several variables)

Point [1]
Strangely I did not obtained a FAIL answer by using
is( r^2 - r*s + s^2> 0) assuming r >0, s>0;

or
assume(r>0): #or assume(r, positive)
assume(s>0): #or assume(s, positive)
is( r^2 - r*s + s^2> 0) ;


but always "false"

Note : even writing r^2 - r*s + s^2  in the following form   1/2*(r - s)^2 + (1/2)*(r^2  + s^2 ) has the same result (which suggests checking r^2+s^2 will also fail (?)).


Point [2]
I guess you refer to my auxiliary message  ?
            is(I, 'complex')                          # obviously true
            is(I, 'positive')                          # returns false
I know the set of real numbers is contained in the set of real numbers and, as a rule Maple operates over the latter , but how can Maple decide if a pure imaginary number is positive ? Or some complex number ?

Finally I did know the way you use assuming in the commang
is( r^2 - r*s + s^2> 0) assuming positive;
What are the inderterminates "assuming positive" refers to ?

Thanks again for the time spent

assume(r, 'positive')
is(r, 'complex')                 # returns  true, just as coulditbe does too
                                        # Is this suggest that being 'positive' is consistent with being complex ?

Now let's try this
is(I, 'complex')                          # obviously true
is(I, 'positive')                           # returns false

then an object of complex type is not positive (at first hand I would have thought Maple will return FAIL ???)
 

@Markiyan Hirnyk I will remember that

First 22 23 24 25 26 27 28 Page 24 of 29