Re: Weird Print Result
- To: mathgroup at smc.vnet.net
- Subject: [mg74167] Re: [mg74122] Weird Print Result
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 13 Mar 2007 03:40:31 -0500 (EST)
- Reply-to: hanlonr at cox.net
Put a semi-colon after the Print statement.
The output of--vice the action (print) of--a Print statement is a Null. You mapped Print onto a Plus with four terms and the result is the Plus of four Nulls (4 Null). Similarly,
Print /@ (A*B)
A
B
Null^2
Times of two Nulls is Null squared. Again, a semi-colon would have suppress the output of--but not the action of--the Print.
Bob Hanlon
---- Bruce Colletti <vze269bv at verizon.net> wrote:
> Re Mathematica 5.2 under WinXP.
>
> The code below creates the correct output, except for a strange concluding "4 Null."
>
> What does this weird last line of output mean (list length?), why does it print, and how can it be suppressed?
>
> Thankx.
>
> Bruce
>
>
> n = 2;
> T = Array[p, {n, n}];
> X0 = Array[x, {n}];
> X = (Expand /@ (X0.MatrixPower[T, 2]));
> Print /@ X[[1]]
>