Items tagged with print print Tagged Items Feed

To begin with my code is:




for i from 1 by 1 to 100 do


end do


for i from 1 by 1 to 100 do


  from j from 1 by 1 to 1000 do


  end do

end do


My goal is to produce as an output in the software's screen the values of 1000 bootstrap means for each of 100 original samples in order to export the results to Excel. Based on my basic knowledge of programming I thought that I can do that through the use of the vectors. Unfortunately though when I trigger the operation the software seems to be evaluating (with the homonymous indication in the bottom left corner of the screen) it for an indefinite period of time, obliging me to stop it at some point. However, let me point out that when I do the same process for i and j 4 and 10 for example then I have results, therefore presumably my code is correct. I know that I can do the same operation in Excel and I have already created a respective macro, however I wanted to use Maple in order to take advantage of its fast operation of calculations, which is pointless in case that I have to wait more time for the results than I have already waited to be eventually produced.

Any thought and idea would be appreciated, thank you very much in advance!

for i from 0 to 3 do print("rawData[", i, "] = new double[] { ", hello(i+1), ",", data[i+1], "};") end do

wrong format after copy to notepad from the maple 15

do not know why it insert a empty line, and make "};" in another line

and there is unexpected " 


wrong format example:

"rawData[", 0, "] = new double[] { ", 73.25, ",", 0.1510425143,

"rawData[", 1, "] = new double[] { ", 73.15, ",", 0.3974080269,

"rawData[", 2, "] = new double[] { ", 72.85, ",", 0.4661517269,

"rawData[", 3, "] = new double[] { ", 73.25, ",", 0.3974080269,


expected format:
rawData[0] = new double[] { 25.0, 20.0 };
rawData[1] = new double[] { 27.0, 34.0 };

Let's say I have something like


p1:=((a+b+c)*t + (a^2 + b^2)*t^3)*(c^3a^b + a*b)*t^2 + (1/(b^2 + a^3)) + b + 1/c^7)*t^7 = 0;


or something complicated like that.


Would it be possible to print the polynomail up to say order 3?


I want to be able to print


collect(expand(p1),t) up to order 3 and see the resulting coefficients

When I print a Table with graphs in it, the graphs are compressed vertically to an extreme extent. There has to be some compression from the screen, of course, since I have a wide-screen (although the actual worksheet does not use the whole screen width because of the palette and the fact that I don't use full-screen mode. However, the vertical compression  (that is, in a direction where there is plenty of room on the page) is many times more than the horizontal compression. In order to get the printed graph to look normal, I have to stretch the screen graph vertically an extreme amount, which, of course, looks horribly distorted on the screen.

Also when printing a graph as part of a Table, the graph area is clipped so that the title and legend do not print.

I thought that the Table struction would be a good way to display related graphs. But this behavior is making the use of Tables tedious and much less satisfactory because of the missing titles and legends.

None of these things happen when I print a graph in a regular execution group outside a Table structure.

Has anybody else had this problem, and have you found a way to avoid the compression and get the legends?

How do we print "Hello" in green in a .mw file in Maple 13?



Short question version:

print(plots[display](seq(seq...   ...)):  works fine!  Why??

Longer, more detailed question:
  print(plots[display](seq(seq...   ...)):   This Maple statement ends in a colon - so I would not have expected any output.  I'm using "pretty" print, as opposed to printf, because it automatically centers the output

    This question is actually an extension of one I posed  yesterday, under the title "How to clear Maple output" - but the question I should have been asking is: "Why is the previous output not automatically cleared?"  The main points of that question are stated below.  Any comments, suggestions gratefully received.


"How to clear Maple output"

I'd like to know how the screen previous ouput can be cleared.   ...or what is the likely cause.

   At the start of my program I have:

interface(echo=0, verboseproc=0, warnlevel=0, prettyprint=1):

#I thought restart; would automatically have cleared any previous output.

The program reads necessary input (eg no of players, ..)  using:


I have couple questions on displaying/printing items I see from ShowContents(LibLocation). Here is an example


First quesionNow, when I do
then I see

When is "%?.m" there? Is this suppoed to be an actual function one can print?

second question

c[30]; gives

But when I do:


I get listing that ends up calling

proc(n::{algebraic, algebraic .. algebraic})
local fn;
   1   if nargs <> 1 then
   2     error "wrong number of arguments"
       end if;
   3   fn := traperror(evalf(n));
   4   if type(fn,'numeric') and not type(n,'posint') or type(fn,('numeric') .. ('anything')) and not type(op(1,n),'posint') or type(fn,('anything') .. ('numeric')) and not type(op(2,n),'posint') then
   5     error "expecting positive integers in argument"
       elif type(n,('integer') .. ('integer')) and op(2,n) < op(1,n) then
   6     NULL
   7     ('AiryBiZeros')(n)   <----- Is this C function/compiled that is why it does not show?
       end if
end proc

Which is the same name I printed. So it seems to be another internal procedure with same name? How can I print it as well?

Is there a better way to print Maple procedures/command than what I am doing above so one gets full listing?
I tried Browse(); command in LibraryTools, but found it very cluncky to use (keeps losing listing and screen become blank. Very buggy)


How could I convert HFloat type number to a number?

My ultimate aim is to print the ouput in a "nicer" wa, like this


printf("Minimum value is: 2.440\n");

and possibly can be written to a file (using writeto).




I have a function. It's calculating coefficients of a polynomial.

So when it's done, I have the variables a0, a1, a2,a3 ... aN

where N is an input value and could be any positive integer.


Now, I just want to show them on the screen. So if I have, say , a0=1.3 and a1=5.76, I want this to appear:

1.3x + 5.76x2


That's all. I just want a loop that does this:

for term from 1 to N do:

    print( a0 ); print (x^N); print ("+");


so all the terms come out on the same line, as in my example above. I've tried so many ways, but each time it ignores the numerical values of a0 and just writes "a0" on the screen, or breaks it up into a set, or puts || marks everywhere, or does it on sequential lines, or something or something or something.

Hi, i'm wondering if theres anything i can do printf and print and have the outputs on the same line. I want the string wihtout any quotations so i think i can only do printf to get this, but then i'm putting an entry out of an array after this. This is a small example out of my code, i would like the output to be all on one line:

The synchronising vector is (S[j-1]) The synchronising word is (X[j-1]) The length of the synchronising word is ...


if (sync=true) then 
printf("The Synchronising vector is"); print(S[j-1]);
printf("The sychronising word is");
printf("The length of the synchronising word is");
else printf("There is no synchronising word"); 
end if;

 At the moment its outputing each print on a new line.

Any help would be much appreciated, thanks.


Is there any simple way to print the sum of a series with exceptions?

For example, the following works (sort of), but its not consistent with mathematical notation, where one would expect to see something like a Sigma^' printed out, and the condition, alongw ith ther limits appear under the Sigma sign:


M:= Matrix ([[a,b], [c,d]])

If a.d-b.c=0 then print (Matrix(2)); else print (Matrix ([[(d/a.d-b.c), (-b/a.d-b.c)], [-c/a.d-b.c, a/a.d-b.c]]); end if;


I don't understand where I have gone wrong. If anybody could help I would be greatly appreciative

Thank you

I know how to define a procedure and use print() as follows:

test := proc (x)
  print("x is equal to: ");
end proc

This displays as follows:

"x is equal to: "


But i would like to appear as follows:

x is equal to: 2


Where the "x is equal to: "-part is standard a "text-mode-block" with green color.

Can i accomplish this in Maple, and can i do more advanced formatting?


Best regards,


Hi, I am currently creating a procedure so that i can input two matrices and a vector and multiply them together in different patterns, I want the result to be either one of the vectors {4,0,0,0} or {0,4,0,0} or {0,0,4,0} or {0,0,0,4}, I am trying to create an if loop that says is one of the S's is equal to one of these print ("Synchronising"), I have decalred these vectors inside the procedure and all the S's but my if statement is still not working. I think S needs to be decalred more clearly inside but i'm unsure what to do, any help would be much appreciaited! Here is my procedure:


local s, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, e, f, g, h;
if (s7 = e)then
elif (s7 = g) then
print ("Synchronising")
elif (s7 = h) then
print ("Synchronising")
elif (s7 = g) then
print("Not Synchronising");
end if;

return s, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
end proc:



I need the list of x and y separately of S[2] like the:

[.8098169753, 0.8098169753, .8098169753, .8098169753, .8098169753, .8098169753]

[1.339721710, 1.309892054, 1.282898312, 1.258277638, 1.235670705, 1.214793049]



restart; with(LinearAlgebra);
a := 2; b := .29; d := 1.85; for h from .5 by .1 to 1 do
eq1 := x*(-b*x^2-x+1);
eq2 := y*((a*x*x)/(b*y^2)-d-h*y);
S := solve({eq1, eq2}, {x, y});

1 2 3 Page 1 of 3