Repeatative piping

Doug dougsweetser-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Sun Feb 22 12:11:27 EST 2009


Hello:

Just sitting around the house on a Sunday, trying to create the group
U(1), a group involved with light.  I wrote a program that does one of
the steps:

> g_u1 1 2 3 4
0.1825741858350554 0.3651483716701107 0.5477225575051661 0.7302967433402214

That is a normalized quaternion.  To make more members of the group,
square the result:

> g_u1 1 2 3 4 | q_square
-0.933333 0.133333 0.200000 0.266667

I'd like to do this a thousand times:

> g_u1 1 2 3 4 | q_square | q_square | q_square ...

There are lots of ways to do this.  One easy approach for me is write
q_square_n, that given an n, does the loop.  I was curious if there
was command line way to accomplish the same thing.  I don't know if I
have used a for loop in a command line setting before.

Doug





More information about the Discuss mailing list