ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 08 Jun 2019 17:13:42 +02003D tree(fractal)https://ask.sagemath.org/question/46846/3d-treefractal/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.Fri, 07 Jun 2019 09:26:32 +0200https://ask.sagemath.org/question/46846/3d-treefractal/Comment by slelievre for <p>We want to make this tree by using fractal.</p>
<pre><code>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)
</code></pre>
<p>We find this code. but error
we want to get 3D tree graph.</p>
https://ask.sagemath.org/question/46846/3d-treefractal/?comment=46847#post-id-46847Welcome to Ask Sage! Thank you for your question!Fri, 07 Jun 2019 09:51:20 +0200https://ask.sagemath.org/question/46846/3d-treefractal/?comment=46847#post-id-46847Comment by dan_fulea for <p>We want to make this tree by using fractal.</p>
<pre><code>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)
</code></pre>
<p>We find this code. but error
we want to get 3D tree graph.</p>
https://ask.sagemath.org/question/46846/3d-treefractal/?comment=46854#post-id-46854I 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.Fri, 07 Jun 2019 14:35:51 +0200https://ask.sagemath.org/question/46846/3d-treefractal/?comment=46854#post-id-46854Comment by slelievre for <p>We want to make this tree by using fractal.</p>
<pre><code>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)
</code></pre>
<p>We find this code. but error
we want to get 3D tree graph.</p>
https://ask.sagemath.org/question/46846/3d-treefractal/?comment=46867#post-id-46867Please 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`?Sat, 08 Jun 2019 17:05:16 +0200https://ask.sagemath.org/question/46846/3d-treefractal/?comment=46867#post-id-46867Answer by slelievre for <p>We want to make this tree by using fractal.</p>
<pre><code>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)
</code></pre>
<p>We find this code. but error
we want to get 3D tree graph.</p>
https://ask.sagemath.org/question/46846/3d-treefractal/?answer=46868#post-id-46868Not 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)
Sat, 08 Jun 2019 17:13:42 +0200https://ask.sagemath.org/question/46846/3d-treefractal/?answer=46868#post-id-46868