Ask Your Question
0

3D tree(fractal)

asked 2019-06-07 09:26:32 +0200

updated 2019-06-08 17:04:18 +0200

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.

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2019-06-07 09:51:20 +0200 )edit

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 ( 2019-06-07 14:35:51 +0200 )edit

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 ( 2019-06-08 17:05:16 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-08 17:13:42 +0200

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)
edit flag offensive delete link more

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: 2019-06-07 09:26:32 +0200

Seen: 458 times

Last updated: Jun 08 '19