Press "Enter" to skip to content

How to Make a Bonsai Tree Out of Math | Paul Cantrell | TEDxMacalesterCollege


I’m Paul Cantrell I teach computer

I’m Paul Cantrell I teach computer science here at McAllister which raises

science here at McAllister which raises

science here at McAllister which raises an interesting question why why do I

an interesting question why why do I

an interesting question why why do I teach computer science at a liberal arts

teach computer science at a liberal arts

teach computer science at a liberal arts college well the short answer to that

college well the short answer to that

college well the short answer to that question is that computer science is or

question is that computer science is or

question is that computer science is or at least can be more than just job

at least can be more than just job

at least can be more than just job training and so should education to help

training and so should education to help

training and so should education to help illustrate what I mean by that I want to

illustrate what I mean by that I want to

illustrate what I mean by that I want to talk about a project that I wrote with

talk about a project that I wrote with

talk about a project that I wrote with my excellent colleagues at bust out

my excellent colleagues at bust out

my excellent colleagues at bust out solutions for the Como Zoo and

solutions for the Como Zoo and

solutions for the Como Zoo and conservatory they wanted an interactive

conservatory they wanted an interactive

conservatory they wanted an interactive iPad exhibit to go with their bonsai

iPad exhibit to go with their bonsai

iPad exhibit to go with their bonsai tree exhibit that would let kids make

tree exhibit that would let kids make

tree exhibit that would let kids make their own virtual bonsai tree on an iPad

their own virtual bonsai tree on an iPad

their own virtual bonsai tree on an iPad keep him busy for five minutes while

keep him busy for five minutes while

keep him busy for five minutes while their parents look at the trees and

their parents look at the trees and

their parents look at the trees and hopefully maybe even educate and engage

hopefully maybe even educate and engage

hopefully maybe even educate and engage and inspire them which gave us an

and inspire them which gave us an

and inspire them which gave us an interesting problem to solve we had to

interesting problem to solve we had to

interesting problem to solve we had to create a tree in software and I don’t

create a tree in software and I don’t

create a tree in software and I don’t just mean a picture of a tree we want

just mean a picture of a tree we want

just mean a picture of a tree we want you to be able to trim your own tree

you to be able to trim your own tree

you to be able to trim your own tree your choice is your tree that means we

your choice is your tree that means we

your choice is your tree that means we need an algorithm that makes things that

need an algorithm that makes things that

need an algorithm that makes things that look and feel like trees the way we do

look and feel like trees the way we do

look and feel like trees the way we do that is using something called an L

that is using something called an L

that is using something called an L system and the way it works is we start

system and the way it works is we start

system and the way it works is we start with just one segment we’re gonna build

with just one segment we’re gonna build

with just one segment we’re gonna build tree out of these segments we start with

tree out of these segments we start with

tree out of these segments we start with a segment and we apply a rule to it

a segment and we apply a rule to it

a segment and we apply a rule to it that’s the rule at the lower left there

that’s the rule at the lower left there

that’s the rule at the lower left there take that segment and replace it with

take that segment and replace it with

take that segment and replace it with several segments and then we take each

several segments and then we take each

several segments and then we take each of these several segments and apply the

of these several segments and apply the

of these several segments and apply the same rule to them and apply the rule to

same rule to them and apply the rule to

same rule to them and apply the rule to each of these segments and we get a

each of these segments and we get a

each of these segments and we get a structure a plant like structure that we

structure a plant like structure that we

structure a plant like structure that we can work with here’s what that looks

can work with here’s what that looks

can work with here’s what that looks like on an iPad this doesn’t look like a

like on an iPad this doesn’t look like a

like on an iPad this doesn’t look like a tree yet but we’ll get there the first

tree yet but we’ll get there the first

tree yet but we’ll get there the first thing we need to do to make it look like

thing we need to do to make it look like

thing we need to do to make it look like a bonsai is that on one side trees start

a bonsai is that on one side trees start

a bonsai is that on one side trees start out dents and shrubby so that you have

out dents and shrubby so that you have

out dents and shrubby so that you have material to trim away we need to make

material to trim away we need to make

material to trim away we need to make our tree look shrubby the way I do that

our tree look shrubby the way I do that

our tree look shrubby the way I do that is at each step of the substitution I

is at each step of the substitution I

is at each step of the substitution I remove a few segments so instead of

remove a few segments so instead of

remove a few segments so instead of substitute substitute substitute it’s

substitute substitute substitute it’s

substitute substitute substitute it’s now

now

now that you remove a few substitute remove

that you remove a few substitute remove

that you remove a few substitute remove a few that kind of keeps it dense as it

a few that kind of keeps it dense as it

a few that kind of keeps it dense as it grows here’s what it looks like and it

grows here’s what it looks like and it

grows here’s what it looks like and it looks shrubby for sure but it’s like

looks shrubby for sure but it’s like

looks shrubby for sure but it’s like some kind of grassy tumbleweed maybe we

some kind of grassy tumbleweed maybe we

some kind of grassy tumbleweed maybe we want something that looks like a woody

want something that looks like a woody

want something that looks like a woody tree so how do we do that how do we make

tree so how do we do that how do we make

tree so how do we do that how do we make it look like wood well perhaps we might

it look like wood well perhaps we might

it look like wood well perhaps we might want to get an image of some bark right

want to get an image of some bark right

want to get an image of some bark right something better than this generic Brown

something better than this generic Brown

something better than this generic Brown some maybe even the texture of the bark

some maybe even the texture of the bark

some maybe even the texture of the bark but no it turns out there’s a much

but no it turns out there’s a much

but no it turns out there’s a much simpler and more effective way to make

simpler and more effective way to make

simpler and more effective way to make it look like a woody tree which is that

it look like a woody tree which is that

it look like a woody tree which is that we take each of these segments that the

we take each of these segments that the

we take each of these segments that the tree is built out of and we make them

tree is built out of and we make them

tree is built out of and we make them thicker depending on how many

thicker depending on how many

thicker depending on how many descendants they have up the tree and we

descendants they have up the tree and we

descendants they have up the tree and we make them just slightly taller if

make them just slightly taller if

make them just slightly taller if they’re closer to the root of the tree

they’re closer to the root of the tree

they’re closer to the root of the tree and there we have something that

and there we have something that

and there we have something that actually I think looks like it’s made

actually I think looks like it’s made

actually I think looks like it’s made out of wood doesn’t it it’s still just a

out of wood doesn’t it it’s still just a

out of wood doesn’t it it’s still just a bunch of cylinders stuck together

bunch of cylinders stuck together

bunch of cylinders stuck together there’s not a lot going on here but what

there’s not a lot going on here but what

there’s not a lot going on here but what turned out to be a problem of shape and

turned out to be a problem of shape and

turned out to be a problem of shape and proportion might have seemed at first

proportion might have seemed at first

proportion might have seemed at first like a problem of color and texture um

like a problem of color and texture um

like a problem of color and texture um something that happens when we write

something that happens when we write

something that happens when we write software it asks us to look at things

software it asks us to look at things

software it asks us to look at things very closely software involves close

very closely software involves close

very closely software involves close seeing and therefore software becomes a

seeing and therefore software becomes a

seeing and therefore software becomes a way of seeing like any creative endeavor

way of seeing like any creative endeavor

way of seeing like any creative endeavor software is a way of seeing the work

software is a way of seeing the work

software is a way of seeing the work we’re doing right here this is this is

we’re doing right here this is this is

we’re doing right here this is this is not scientific seeing we’re not forming

not scientific seeing we’re not forming

not scientific seeing we’re not forming a hypothesis about a tree we’re trying

a hypothesis about a tree we’re trying

a hypothesis about a tree we’re trying to do something artistic the goal is not

to do something artistic the goal is not

to do something artistic the goal is not accuracy it’s to it’s to make something

accuracy it’s to it’s to make something

accuracy it’s to it’s to make something convincing now there’s a problem with

convincing now there’s a problem with

convincing now there’s a problem with this it’s a pretty serious one you’ll

this it’s a pretty serious one you’ll

this it’s a pretty serious one you’ll see it when i zoom in the cylinders

see it when i zoom in the cylinders

see it when i zoom in the cylinders don’t quite join up in some places there

don’t quite join up in some places there

don’t quite join up in some places there are these visible seams between them

are these visible seams between them

are these visible seams between them because when you take a bunch of

because when you take a bunch of

because when you take a bunch of cylinders with their hard edges and you

cylinders with their hard edges and you

cylinders with their hard edges and you stick them together sometimes there are

stick them together sometimes there are

stick them together sometimes there are little gaps well one way to solve that

little gaps well one way to solve that

little gaps well one way to solve that might be to round off the ends right so

might be to round off the ends right so

might be to round off the ends right so let’s see what that looks like

let’s see what that looks like

let’s see what that looks like oh that’s arguably even worse

oh that’s arguably even worse

oh that’s arguably even worse to understand why this is so bad we need

to understand why this is so bad we need

to understand why this is so bad we need to know a little bit about how computers

to know a little bit about how computers

to know a little bit about how computers do shading in 3d graphics when you have

do shading in 3d graphics when you have

do shading in 3d graphics when you have a 3d model you compute what’s called the

a 3d model you compute what’s called the

a 3d model you compute what’s called the normals these are just lines that stick

normals these are just lines that stick

normals these are just lines that stick straight out from the surface then you

straight out from the surface then you

straight out from the surface then you imagine light falling on the surface and

imagine light falling on the surface and

imagine light falling on the surface and you say well if one of these normals is

you say well if one of these normals is

you say well if one of these normals is placing is is pointing straight at the

placing is is pointing straight at the

placing is is pointing straight at the light then we should give it a little

light then we should give it a little

light then we should give it a little high light and if it’s pointing more

high light and if it’s pointing more

high light and if it’s pointing more away from the light than not then we

away from the light than not then we

away from the light than not then we should put it in shadow that’s how we do

should put it in shadow that’s how we do

should put it in shadow that’s how we do shading the reason it looks so bad when

shading the reason it looks so bad when

shading the reason it looks so bad when we put two of these rounded ends next to

we put two of these rounded ends next to

we put two of these rounded ends next to each other is that when we do that we

each other is that when we do that we

each other is that when we do that we end up with normals pointing very

end up with normals pointing very

end up with normals pointing very different directions right next to each

different directions right next to each

different directions right next to each other which means that the light and the

other which means that the light and the

other which means that the light and the shadow make an abrupt transition now we

shadow make an abrupt transition now we

shadow make an abrupt transition now we might fix this by saying trying to fill

might fix this by saying trying to fill

might fix this by saying trying to fill in those little gaps but it turns out

in those little gaps but it turns out

in those little gaps but it turns out mathematically and programmatically

mathematically and programmatically

mathematically and programmatically that’s very difficult to do and there’s

that’s very difficult to do and there’s

that’s very difficult to do and there’s an easier faster better way which is

an easier faster better way which is

an easier faster better way which is that we just take these normals and he

that we just take these normals and he

that we just take these normals and he lie we straight up lie we say actually

lie we straight up lie we say actually

lie we straight up lie we say actually it’s always pointing straight off to the

it’s always pointing straight off to the

it’s always pointing straight off to the side even when it isn’t that makes it so

side even when it isn’t that makes it so

side even when it isn’t that makes it so that when there’s a joined point between

that when there’s a joined point between

that when there’s a joined point between two of these rounded edges there’s not

two of these rounded edges there’s not

two of these rounded edges there’s not such an abrupt transition and in fact

such an abrupt transition and in fact

such an abrupt transition and in fact that fixes the problem we’ve only

that fixes the problem we’ve only

that fixes the problem we’ve only changed the shading and not the shape it

changed the shading and not the shape it

changed the shading and not the shape it seemed like it was a problem of shape

seemed like it was a problem of shape

seemed like it was a problem of shape it’s really a problem of light and dark

it’s really a problem of light and dark

it’s really a problem of light and dark and shading on which is the beautiful

and shading on which is the beautiful

and shading on which is the beautiful thing about software we come up with

thing about software we come up with

thing about software we come up with ideas notions assumptions hopes wishes

ideas notions assumptions hopes wishes

ideas notions assumptions hopes wishes and dreams we encode them we literally

and dreams we encode them we literally

and dreams we encode them we literally encode them and then the computer throws

encode them and then the computer throws

encode them and then the computer throws them back at us with mindless literalism

them back at us with mindless literalism

them back at us with mindless literalism and we see our own ideas and our ideas

and we see our own ideas and our ideas

and we see our own ideas and our ideas talk back to us software makes our ideas

talk back to us software makes our ideas

talk back to us software makes our ideas talk back to us if we let it right now

talk back to us if we let it right now

talk back to us if we let it right now we need people desperately need people

we need people desperately need people

we need people desperately need people who will listen to that because software

who will listen to that because software

who will listen to that because software is doing a lot of things in our world

is doing a lot of things in our world

is doing a lot of things in our world it’s talking back to us in surprising

it’s talking back to us in surprising

it’s talking back to us in surprising ways and we need to listen to that now

ways and we need to listen to that now

ways and we need to listen to that now we throw a few leaves on that thing and

we throw a few leaves on that thing and

we throw a few leaves on that thing and you got something that looks like it

you got something that looks like it

you got something that looks like it looks like a tree right it’s pretty cool

looks like a tree right it’s pretty cool

looks like a tree right it’s pretty cool and the beautiful thing about having an

and the beautiful thing about having an

and the beautiful thing about having an algorithm for this is that if we just

algorithm for this is that if we just

algorithm for this is that if we just change the art for the leaves and tweak

change the art for the leaves and tweak

change the art for the leaves and tweak a few parameters in the algorithm we get

a few parameters in the algorithm we get

a few parameters in the algorithm we get not only an endless variety of maples

not only an endless variety of maples

not only an endless variety of maples but also junipers ficuses the only

but also junipers ficuses the only

but also junipers ficuses the only difference between these three species

difference between these three species

difference between these three species of trees is a few numbers in an

of trees is a few numbers in an

of trees is a few numbers in an algorithm and different art for the

algorithm and different art for the

algorithm and different art for the leaves what we’re doing here this is

leaves what we’re doing here this is

leaves what we’re doing here this is this is essentially art we’re making a

this is essentially art we’re making a

this is essentially art we’re making a tree drawing a tree but we’re making it

tree drawing a tree but we’re making it

tree drawing a tree but we’re making it with algorithms it’s art and the medium

with algorithms it’s art and the medium

with algorithms it’s art and the medium is algorithms you can see why software

is algorithms you can see why software

is algorithms you can see why software companies put a huge premium on people

companies put a huge premium on people

companies put a huge premium on people who can cross boundaries and synthesize

who can cross boundaries and synthesize

who can cross boundaries and synthesize ideas from different fields if we take a

ideas from different fields if we take a

ideas from different fields if we take a look at the finished app here’s somebody

look at the finished app here’s somebody

look at the finished app here’s somebody working on their tree after a few

working on their tree after a few

working on their tree after a few minutes perfecting their masterpiece

minutes perfecting their masterpiece

minutes perfecting their masterpiece here’s math software art and graphic

here’s math software art and graphic

here’s math software art and graphic design a smidge of botany also

design a smidge of botany also

design a smidge of botany also psychology if the user putting ourselves

psychology if the user putting ourselves

psychology if the user putting ourselves in the user’s shoes which is something

in the user’s shoes which is something

in the user’s shoes which is something that we get actually from reading

that we get actually from reading

that we get actually from reading literature and there’s also the many

literature and there’s also the many

literature and there’s also the many factors that went into this nonprofit

factors that went into this nonprofit

factors that went into this nonprofit their mission what do they want all

their mission what do they want all

their mission what do they want all these different disciplines are coming

these different disciplines are coming

these different disciplines are coming together just like we do in a liberal

together just like we do in a liberal

together just like we do in a liberal arts education like this one liberal

arts education like this one liberal

arts education like this one liberal arts is fantastic background for writing

arts is fantastic background for writing

arts is fantastic background for writing software but that’s not the question

software but that’s not the question

software but that’s not the question that I asked we get confused about this

that I asked we get confused about this

that I asked we get confused about this so easily we see that education is

so easily we see that education is

so easily we see that education is useful for jobs and we say well it must

useful for jobs and we say well it must

useful for jobs and we say well it must be worthwhile but that’s not enough

be worthwhile but that’s not enough

be worthwhile but that’s not enough that’s not enough I didn’t ask why is

that’s not enough I didn’t ask why is

that’s not enough I didn’t ask why is liberal arts education good for software

liberal arts education good for software

liberal arts education good for software I asked why does software belong in a

I asked why does software belong in a

I asked why does software belong in a liberal arts education there was a

liberal arts education there was a

liberal arts education there was a moment in this project when somebody

moment in this project when somebody

moment in this project when somebody asked how do we stop kids using this

asked how do we stop kids using this

asked how do we stop kids using this from taking their tree and just trimming

from taking their tree and just trimming

from taking their tree and just trimming it down to a stump I said what you don’t

it down to a stump I said what you don’t

it down to a stump I said what you don’t stop them

stop them

stop them you never a child yourself you walk up

you never a child yourself you walk up

you never a child yourself you walk up to this thing you can trim the tree

to this thing you can trim the tree

to this thing you can trim the tree what’s the first thing you’re gonna do

what’s the first thing you’re gonna do

what’s the first thing you’re gonna do and it’s true kid after kid you watch

and it’s true kid after kid you watch

and it’s true kid after kid you watch them using this thing at the Como Zoo

them using this thing at the Como Zoo

them using this thing at the Como Zoo they walk up to it and they trim it down

they walk up to it and they trim it down

they walk up to it and they trim it down to a stump and they say good I did yeah

to a stump and they say good I did yeah

to a stump and they say good I did yeah and then you can see it hit him they

and then you can see it hit him they

and then you can see it hit him they said wait

said wait

said wait nobody’s policing me I can trim my tree

nobody’s policing me I can trim my tree

nobody’s policing me I can trim my tree down to a stump if I want this is my

down to a stump if I want this is my

down to a stump if I want this is my tree and then it comes over them they

tree and then it comes over them they

tree and then it comes over them they become absorbed and they just lose

become absorbed and they just lose

become absorbed and they just lose themselves in that tree as they work on

themselves in that tree as they work on

themselves in that tree as they work on their personal masterpiece time after

their personal masterpiece time after

their personal masterpiece time after time you can watch this happen I walked

time you can watch this happen I walked

time you can watch this happen I walked in once and her two kids ain’t mommy

in once and her two kids ain’t mommy

in once and her two kids ain’t mommy mommy my tree is in the virtual

mommy my tree is in the virtual

mommy my tree is in the virtual collection it happens to adults too

collection it happens to adults too

collection it happens to adults too don’t tell and that moment that moment

don’t tell and that moment that moment

don’t tell and that moment that moment of realizing that this is my tree and

of realizing that this is my tree and

of realizing that this is my tree and I’m free to make it what I want that is

I’m free to make it what I want that is

I’m free to make it what I want that is what liberal arts education is about do

what liberal arts education is about do

what liberal arts education is about do any of you know what liberal arts

any of you know what liberal arts

any of you know what liberal arts actually means

actually means

actually means I confess I didn’t when I was a student

I confess I didn’t when I was a student

I confess I didn’t when I was a student I knew that it didn’t just mean

I knew that it didn’t just mean

I knew that it didn’t just mean politically liberal something bigger

politically liberal something bigger

politically liberal something bigger than that I thought it meant like

than that I thought it meant like

than that I thought it meant like liberal maybe all inclusive something

liberal maybe all inclusive something

liberal maybe all inclusive something something along those lines in fact know

something along those lines in fact know

something along those lines in fact know the Latin phrase that liberal arts comes

the Latin phrase that liberal arts comes

the Latin phrase that liberal arts comes from artist liberalist the Liebherr

from artist liberalist the Liebherr

from artist liberalist the Liebherr Alice here means of free people this was

Alice here means of free people this was

Alice here means of free people this was the education centuries ago that free

the education centuries ago that free

the education centuries ago that free people received as opposed to slaves

people received as opposed to slaves

people received as opposed to slaves this was the education that gave people

this was the education that gave people

this was the education that gave people the power to determine their own lives

the power to determine their own lives

the power to determine their own lives meaning and the ability to take

meaning and the ability to take

meaning and the ability to take responsibility for that power this was

responsibility for that power this was

responsibility for that power this was the education that people deserved and

the education that people deserved and

the education that people deserved and needed who weren’t completely defined as

needed who weren’t completely defined as

needed who weren’t completely defined as people by their economic value think

people by their economic value think

people by their economic value think about what it means that we think that

about what it means that we think that

about what it means that we think that liberal arts education is something

liberal arts education is something

liberal arts education is something narrow and specialized that only a few

narrow and specialized that only a few

narrow and specialized that only a few people need to bother with think about

people need to bother with think about

people need to bother with think about what that means this is something that

what that means this is something that

what that means this is something that every human being should have I don’t

every human being should have I don’t

every human being should have I don’t mean that everyone should go to a

mean that everyone should go to a

mean that everyone should go to a four-year private liberal arts

four-year private liberal arts

four-year private liberal arts I don’t mean that this needs to happen

I don’t mean that this needs to happen

I don’t mean that this needs to happen in school at all education is much

in school at all education is much

in school at all education is much bigger than school but this is something

bigger than school but this is something

bigger than school but this is something that every human being deserves and I

that every human being deserves and I

that every human being deserves and I don’t mean to shortchange job training

don’t mean to shortchange job training

don’t mean to shortchange job training it’s important it’s necessary but it is

it’s important it’s necessary but it is

it’s important it’s necessary but it is not sufficient we need education to be

not sufficient we need education to be

not sufficient we need education to be more than that yes we should help

more than that yes we should help

more than that yes we should help students answer the question how will I

students answer the question how will I

students answer the question how will I make money but we should also help them

make money but we should also help them

make money but we should also help them answer the question what should I do

answer the question what should I do

answer the question what should I do with that money when I have it what do I

with that money when I have it what do I

with that money when I have it what do I value what change do I want to create in

value what change do I want to create in

value what change do I want to create in the world I can trim my life to a stump

the world I can trim my life to a stump

the world I can trim my life to a stump so who do I want to be and software

so who do I want to be and software

so who do I want to be and software software can help answer these questions

software can help answer these questions

software can help answer these questions it asks us to see closely

it asks us to see closely

it asks us to see closely it makes our ideas talk back to us it

it makes our ideas talk back to us it

it makes our ideas talk back to us it shows us that everything is connected to

shows us that everything is connected to

shows us that everything is connected to everything software is kind of an ideal

everything software is kind of an ideal

everything software is kind of an ideal liberal art probably any discipline can

liberal art probably any discipline can

liberal art probably any discipline can be liberal arts is not about what we

be liberal arts is not about what we

be liberal arts is not about what we teach but about how we teach that we

teach but about how we teach that we

teach but about how we teach that we teach with the belief that every human

teach with the belief that every human

teach with the belief that every human being deserves to be the author of their

being deserves to be the author of their

being deserves to be the author of their own life’s meaning and needs to be able

own life’s meaning and needs to be able

own life’s meaning and needs to be able to take responsibility for that power

to take responsibility for that power

to take responsibility for that power that’s what liberal arts education is

that’s what liberal arts education is

that’s what liberal arts education is now I don’t know what software will look

now I don’t know what software will look

now I don’t know what software will look like in 20 or 40 years job training has

like in 20 or 40 years job training has

like in 20 or 40 years job training has kind of a short shelf life but I do know

kind of a short shelf life but I do know

kind of a short shelf life but I do know that the things that my students learn

that the things that my students learn

that the things that my students learn from writing software will serve their

from writing software will serve their

from writing software will serve their unforce evil lives in unforeseen ways

unforce evil lives in unforeseen ways

unforce evil lives in unforeseen ways and that is why I choose to spend my

and that is why I choose to spend my

and that is why I choose to spend my life teaching computer science at a

life teaching computer science at a

life teaching computer science at a liberal arts college

”

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *