Items tagged with print print Tagged Items Feed


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});

I want to use a do loop to calculate some values of a function and print out the answers.
The result I want is of the form f(1)=17, f(2) = 21, etc. If I try

for j from 1 to 3 do
print( 'f(j)'=f(j) )
end do;

the j is not evalued and I get f(j)=17, f(j) = 21, etc.

I am now using Maple 15 and 16.



In a worksheet how can one see all of the page breaks.  I want to be able to size plots to minimize white space.


Imagine I want to calculate this loop:

nn := nextprime(10^100); zz := 1;

for ii from 0 to 100000 do zz := mod(zz^2+1, nn) end do;

How can I avoid that Maple prints every iteration? I just want Maple to do it quietly, storing the value and get the last zz value  just by evaluating zz after the loop ends.



for ex. i put the function X^2+2 on y. y:=x->x^2+2

how can i display what function is behind y later? of course i always could scroll up to the point where i defined it, but is there a shorter way? with variables, you enter them and see their value. it something similar possible with functions?

i now that i can see the function inmy example with y(x), but what if you have a function with 5 more?


thanks for help

I have a model with 3 parameter blocks containing a lot of constants. I would like to know how can i print those lists to papper, .pdf, word or something like that.




  Excuse me, I have a code


for i from 1 to 5 do
end do:




  In windows, the output is



                              1, 2

Dear everyone,


  I have a weird question about the "print" command. Suppose I have somthing like




 It will print

1 2 3 Page 1 of 3