Items tagged with print print Tagged Items Feed

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.

   David

"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:

restart;
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:

x:=readline(terminal):

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

restart;
with(LibraryTools):
LibLocation:=cat(kernelopts(mapledir),"/lib/maple.mla");
c:=ShowContents(LibLocation):


First quesionNow, when I do
c[1];
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:

interface(verboseproc=3);
print(AiryBiZeros);

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
       else
   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)

Hi,

print_result.mw

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");
printf("x=2.257\n");
printf("y=0.000\n");

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

 

Thanks,

 

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 ("+");

od:

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");
print(X[j-1]);
printf("The length of the synchronising word is");
print(length(X[j-1]));
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:

[Sum(1/(k^2-p),k=0..infinity),And(k<>p)]

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: ");
  x
end proc

This displays as follows:
test(2)

"x is equal to: "

2

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,

Martin

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:

 

proc_cerny1:=proc(A::Matrix,B::Matrix,C::Vector)
local s, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, e, f, g, h;
s:=C.A;
s1:=C.B;
s2:=C.A.B;
s3:=C.B.A;
s4:=C.A.A;
s5:=C.B.B;
s6:=C.A.A.A;
s7:=C.B.B.B;
s8:=C.A.B.B;
s9:=C.A.B.A;
s10:=C.B.B.A;
s11:=C.B.A.A;
s12:=C.A.A.B;
s12:=C.B.A.B;
s13:=C.B.A.A;
s14:=C.B.A.A.A;
e:=Vector([4,0,0,0],orientation=row);
f:=Vector([0,4,0,0],orientation=row);
g:=Vector([0,0,4,0],orientation=row);
h:=Vector([0,0,0,4],orientation=row);
g:=Vector([0,0,4,0],orientation=row);
if (s7 = e)then
print("Synchronising")
elif (s7 = g) then
print ("Synchronising")
elif (s7 = h) then
print ("Synchronising")
elif (s7 = g) then
print("Synchronising")
else
print("Not Synchronising");
end if;

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

 

Thanks 

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.

 

Thanks

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

Hi

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.

regards

hi

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.

Thanks

1 2 3 Page 1 of 3