Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1868

Re: How to roll up multiple Line calls into a loop

From Yves Klett <yves.klett@googlemail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to roll up multiple Line calls into a loop
Date 2011-04-24 12:24 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ip14qm$ged$1@smc.vnet.net> (permalink)
References <iorih5$o6t$1@smc.vnet.net>

Show all headers | View raw


Hi,

or as an excercise in Part (although the Cases approach is more versatile):

g = Graphics[{Line[{{0, 10}, {1, 0}}], Line[{{0, 9}, {2, 0}}],
    Line[{{0, 8}, {3, 0}}], Line[{{0, 7}, {4, 0}}],
    Line[{{0, 6}, {5, 0}}], Line[{{0, 5}, {6, 0}}],
    Line[{{0, 4}, {7, 0}}], Line[{{0, 3}, {8, 0}}],
    Line[{{0, 2}, {9, 0}}], Line[{{0, 1}, {10, 0}}]}];

g[[1, All, 1, -1]]

Out[3]= {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8,
  0}, {9, 0}, {10, 0}}

Regards,
Yves

Am 22.04.2011 11:41, schrieb Sol Lederman:
> Hi,
> 
> I'm new to Mathematica.
> 
> I have the following bit of graphics:
> 
>    Graphics[{
>   Line[{{0, 10}, {1, 0}}],
>   Line[{{0, 9}, {2, 0}}],
>   Line[{{0, 8}, {3, 0}}],
>   Line[{{0, 7}, {4, 0}}],
>   Line[{{0, 6}, {5, 0}}],
>   Line[{{0, 5}, {6, 0}}],
>   Line[{{0, 4}, {7, 0}}],
>   Line[{{0, 3}, {8, 0}}],
>   Line[{{0, 2}, {9, 0}}],
>   Line[{{0, 1}, {10, 0}}],
>   }]
> 
> 
> I want to simplify it to do some sort of iteration to compute the end points
> of the lines. I can do this easily in a variety of procedural languages but
> I haven't yet grokked how Mathematica would do this.
> 
> 
> Would someone please show me the short way, I imagine using Table somehow?
> 
> 
> Thanks.
> 
> 
> Sol

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to roll up multiple Line calls into a loop Sol Lederman <sol.lederman@gmail.com> - 2011-04-22 09:41 +0000
  Re: How to roll up multiple Line calls into a loop Dan <dflatin@rcn.com> - 2011-04-23 11:50 +0000
    Re: How to roll up multiple Line calls into a loop "Christopher O. Young" <cy56@comcast.net> - 2011-04-25 11:29 +0000
  Re: How to roll up multiple Line calls into a loop Albert Retey <awnl@gmx-topmail.de> - 2011-04-23 11:51 +0000
  Re: How to roll up multiple Line calls into a loop "Christopher O. Young" <cy56@comcast.net> - 2011-04-23 11:51 +0000
  Re: How to roll up multiple Line calls into a loop Helen Read <readhpr@gmail.com> - 2011-04-23 11:51 +0000
  Re: How to roll up multiple Line calls into a loop Peter Pein <petsie@dordos.net> - 2011-04-23 11:52 +0000
  Re: How to roll up multiple Line calls into a loop roby <roby.nowak@gmail.com> - 2011-04-23 11:52 +0000
  Re: How to roll up multiple Line calls into a loop Yves Klett <yves.klett@googlemail.com> - 2011-04-24 12:24 +0000
    Short-cut for reiteration, via postfix usage of Table as pure "Christopher O. Young" <cy56@comcast.net> - 2011-04-25 11:27 +0000
    Short-cut for reiteration, via postfix usage of Table as pure "Christopher O. Young" <cy56@comcast.net> - 2011-04-25 11:27 +0000
      Re: Short-cut for reiteration, via postfix usage of Table as pure Peter Pein <petsie@dordos.net> - 2011-04-26 10:51 +0000
      Re: Short-cut for reiteration, via postfix usage of Table as pure Peter Pein <petsie@dordos.net> - 2011-04-26 10:50 +0000
        Re: Short-cut for reiteration. Concise, readable symbols and "Christopher O. Young" <cy56@comcast.net> - 2011-04-27 09:38 +0000

csiph-web