# 3D tree(fractal)

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 close merge delete

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.

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?

Sort by » oldest newest most voted

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)

more