First time here? Check out the FAQ!

Ask Your Question
0

3D tree(fractal)

asked 5 years ago

updated 5 years ago

slelievre gravatar image

We want to make this tree by using fractal.

sage: T = sum(Cone(exp(-n/5), 4/3*exp(-n/5),
....:              color=(0, .5, 0)).translate(0, 0, -3*exp(-n/5))
....:         for n in [1 .. 7])
sage: T += Cone(1/8, 1, color='brown').translate(0, 0, -3)
sage: T.show(aspect_ratio=1, frame=False)

We find this code. but error we want to get 3D tree graph.

Preview: (hide)

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 5 years ago )

I edited the post, so that the code is somehow readable. (Simply by marking it, followed by Control+K on the marked block.) It is hard to understand what is wanted, where is the fractal, the tree, and which picture should be constructed in 3D. Please use words to describe in detail what is wanted. If some piece of code works with "a single Cone", then mention it, and based on it explain what is wanted.

dan_fulea gravatar imagedan_fulea ( 5 years ago )

Please provide enough code to reproduce the problem in a fresh Sage session.

Please indicate what error you get. I get an error from Cone.

Maybe you have another definition of Cone and you get an error from sum?

Or do you get an error from show?

slelievre gravatar imageslelievre ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 5 years ago

slelievre gravatar image

Not quite clear what you are asking. It would seem you defined your own Cone which returns a 3d graphics object.

In that case the error you get might be from sum, and this modified code might work for you:

sage: brown = Cone(1/8, 1, color='brown').translate(0, 0, -3)
sage: green = (Cone(exp(-n/5), 4/3*exp(-n/5),
....:               color=(0, .5, 0)).translate(0, 0, -3*exp(-n/5))
....:          for n in [1 .. 7])
sage: T = sum(green, brown)
sage: T.show(aspect_ratio=1, frame=False)
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 5 years ago

Seen: 822 times

Last updated: Jun 08 '19