Message Boards Message Boards

0
|
5823 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Make this specific graph?

Posted 8 years ago

So here is my code

x= 32 Degree

y=30 Degree

Graphics[Line[AnglePath[{{x, 100}, {y, 40}, {2 x,100}, {2 y, 40}, {3 x, 100}, {3 y,40}, {4 x, 100}, {4 y], 40}.........]

The {100, 40} <----(lengths) are constants and will stay the same but x and y increases every step so in the end it ends up being .....{100 x,100},{100 y, 40} I want to keep it going to 100 without typing all the way and using manipulate in the end to see how this graph increases slowly. Any hints would be appreciated Thank you.

POSTED BY: Chris Maniel
2 Replies
Posted 8 years ago

As I understand it you mean that 100 and 40 are lengths and kx and ky are angles. Then the lists inside the list you should give to AnglePath will be the reverse of what you wrote since it needs the length first and the angle second. This Manipulate should do it:

Manipulate[
 Graphics[
  Line[AnglePath[
    ArrayFlatten[Table[{{100, k x}, {40, k y}}, {k, 1, n}], 1]]]],
 {{x, 32. Degree}, 1. Degree, 90 Degree, 1 Degree},
 {{y, 30. Degree}, 1. Degree, 90 Degree, 1 Degree},
 {n, 1, 2000, 1}]

I added . after some numbers to make the calculations numeric instead of symbolic. This is much faster and n can easily be 2000 and you can still move the sliders and get instant feedback.

This will give generate a table of some images that you can get by moving the sliders in the Manipulate. Thank you for this wonderful example.

Grid@Partition[
    With[{n = 500},
       Graphics[
          Line[AnglePath[
            ArrayFlatten[Table[{{100, k #[[1]] Degree}, {40, k #[[2]] Degree}}, {k, 1, n}], 1]]], 
        ImageSize -> Tiny] & /@
    ArrayFlatten[Table[{u, w}, {u, 1., 30, 5}, {w, 1., 30, 5}], 1]], 7]

enter image description here

POSTED BY: Peter Sjogren
Posted 8 years ago

Try this

x=32\[Degree] 
y=30\[Degree]
valx=Table[{i  x,100},{i,100}]
valy=Table[{i y,40},{i,100}]
comb=Riffle[valx,valy]
Graphics[Line[AnglePath[comb]]]

And the picture obtained is

image final

Enjoy it ...

POSTED BY: Luis Ledesma
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract