135 Reputation

6 Badges

11 years, 335 days

MaplePrimes Activity

These are replies submitted by das1404

@ThU  Thanks for that, but I'm still using Maple version 7 and the wildcard match I don't think is supported.  I"ll be able to manage with the select command.

Thanks, David

@Preben Alsholm 

Thanks for your help.   I have managed to incorporate your ideas and code into my program to make it work.  

   I was nonplussed by Tom Leslie's comments regarding print, printf  and the use of filler spaces.  I disagree with him as I'm trying to line up a line of output to match numbers on the previous line. I'm using Maple 7, and some of the terms, like the tilde ~ I'm not conversant with.   I've been programming for a while, but it is only as a hobby.   I learnt Fortran and Cobol over fifty years ago, so I possibly have a tendency to use old methods . When the language C came along, I mistakenly thought it was just another flash in the pan - how wrong could I be!?😊

 Apologies for my late reply, but it's been hot today in NZ.  It's after 8:30 pm and the temperature has dropped to 24C.  If you really want to help, you might send a few icebergs down here in the South Pacific.☺

Thanks again for your much appreciated help.


Many thanks for your reply, which I haven't had time yet to fully peruse.  I was trying to write a program to analyze a passage of text.  A portion of the program is here:

#Start of updated sentence length frequencies
> for k from 1 to 80 do
> if sl[k]>maxsentlen then
> maxsentlen:=sl[k]:
> end if:
> if slf[k]=0 then
> m:=8:
> else
> m:=9-length(slf[k]):
> end if:
> filler[k]:=SubString(" ", 1..m);
> end do: #for k from 1 to 80

Previous attempts of my using op(map(op...etc

> print("test=",test);
> test2:=op(map(op,[seq([%s,%d],k=1..3)])):
> print("test2=",test2);
"test=", " ", 14, " ", 1, " ", 1, " ", 1, " ", 1, " ", 12, " ", 0,

" ", 1, " ", 1, " ", 1 "test2=", %s, %d, %s, %d, %s, %d

thanks again.


Thanks for your very prompt reply,  which works.  However, the output gives commas and quotes.  I was hoping to incorporate it in a print statement.   The slf [] are sentence length frequencies, which line up with the previous line of the numbers 1 to 10,  of sentence lengths. Further down the track I was hoping to print the slf []  from 1 to the maximum sentence length, max sentence,  so I would have k=1..maxsentlen  

Cheers, David

Thanks for that information.  I should be right now! David 


I had already opened the file and used readline eg partial code below:



for c in line do

     Rather than a total rewrite will I be able to convert the character c to bytes, using


   ...and then test to see if c_in_bytes is a control character.

Thanks for your reply.



Thanks for your reply. Am rather embarrassed  that the solution was so simple!   I was just digging myself deeper & deeper in a hole, with tunnel vision, thinking there must be some other function like 'solvec' which solved for complex solutions. Thanks again.

@acer Thanks for your prompt reply.  I am using Maple version 7.

  I am not conversant with the terms Execution Group and Document Block so had to check them out.  As I understand it a Document Block is a block of Maple code bounded by a square bracket on the left hand side.  Similarly an Execution Group is a block of Maple output bounded by a square bracket.

   If I have understood the term Execution Group correctly, then my Maple ouput has three execution groups, viz:

[1  Enter the number of players:

[2 >4

[2 Number of players is 4



Suppose the above is the first  exectution run, and then the cursor is placed in the document block and Enter is pressed to execute the ode again.   [2 >4 is displayed, and suppose the number of players entered is 2,then the output displayed is similar to above, but with 2 replacing 4.  If the code is run yet again, thankfully the ouput is not accumulated: it just outputs the above, but with the newly entered number of players.  Hope this helps. and thanks for your help.





printf("Number of players is %s\n",numplayers);

again to clear the output from last run, did not work.  I am unsure as to why you thought it would?


@Carl Love 

Regards my previous queries re ouput not being cleared, I think I have isolated the problem to readline statements.  I have put up another question titled:

readline - output not being cleared



I included the f:=proc code & ran my Multicube program.  I'm not au fait with procedures, so experimented with different ones.  Initially I forgot to put in return "foo"  - but it didn't complain! It didn't give me an error message.  In some I just left it as proc(), others I gave it a name proc(test1).  I wasn't sure where to place f:=proc() - so did a couple of different places - one close ti=o thestart - ie includung restart; and print level options in the proc() body.  Apart from one instance which came up with the error message:

Error(in f) invalid subscript selector.

  all seemed to "work",  Some complained about local variables giving me about three screens of warnings  This seemed better than my original, but am not happy about the extra hassle of writing proc() every time.  I suspect here is something awry in the input statements: readline and scanf so will check them out next.

    Thanks for your comments.



Thanks, Acer & Carl for your prompt comments, thogh I was hoping for an easier solution - like, writing "clear all;" at the end of my program!:-)

fyi I did comment out the print statements, with no effect - the output still remained.  I'll have a go at the proc procedure later.  Thanks again for the info.  David



Rather than ask the question on how to clear the output, I should have really posed the question:  "Why is the program not automatically removing old,or previous, output?  All other programs I have written do this - so what is so different about this one? 

    I have looked at some unusual aspects of the program and will pose some similar questions to try and get an explanation - it will be about a "pretty" print(plots[display](seq(...  statement in my program which I would have expected to not run - but works fine!!



Thanks for that.  I actually found that after sending the post.  However it's not quite what I want.  Pressing the Remove button only clears the graphic output.  Values which were entered still remain on the screen.  I deleted these using a "drag-over" and ridding the highlighted text using the Del key.

  Rather than go through this procedure every time, I was hoping there's a way of doing this automatically in my Maple program.

Thanks for your prompt and very comprehensive answer.  I did mention that I'm using a now old version 7 of Maple, which does not appear to work with negative (or positive other than 1).

Instead of seq(i,i=5..1,-1); I used a workaround:  seq(6-i, i=1..5); which gives the same output.
Cheers, and thanks again. David


5 6 7 8 Page 7 of 8