demo

Project 2:  The Competitive World of Design

Some hints on Maple and the math you'll need

You're going to be doing more complicated plots than usual, so you'll need to load a special Maple package.  Here it is:

> with(plots):

The reason I ended the line with colon rather than a semi-colon was to  surpress the output.  Otherwise Maple gives you lines and lines of commands you've added by loading this package.

For this demo, I'll make a simple little posy vase.  Designing it lying on it's side is easier (it avoids the whole problem with functions not having two outputs for any input).  I'm going to start with a simple parabola.  This is not my first attempt;  I shifted it up and over several times until I got it where I wanted it to be:

> f := x -> 4-(x-2.8)^2;

f := proc (x) options operator, arrow; 4-(x-2.8)^2 end proc

> plot(f(x), x=1..4, y=0..4, scaling=constrained);

[Plot]

I forced the graph to be to scale by using the scaling=constrained command, so I'll have a feel for what my shape really is going to look like.

I want to be able to plot this curve along with several others I have yet to define, each one over a different interval.  I could do this by defining a piecewise function, but I don't want to.  (If you *do* want to do it that way, look up piecewise in the help menu).

Instead, I'm going to name each of my plots, and then display them all at one time.

> plot1:=plot(f(x),x=1.2..4, y=0..4, color=green, scaling=constrained):

I again surpressed the output when I defined plot1 by ending the line with a colon rather than a semi-colon, because if you don't, you get long lines of gobbledook.

My next piece is going to be part of another parabola:

> g:=x -> 4*(x-1)^2+1.5;

g := proc (x) options operator, arrow; 4*(x-1)^2+1.5 end proc

> plot(g(x), x=.4..1.5, scaling=constrained);

[Plot]

> plot2:=plot(g(x),x=.4..1.5, y=0..4, color=gold, scaling=constrained):

> display(plot1,plot2);

[Plot]

These two curves come awfully close at around 1.4, but they don't actually meet.That would make for a bumpy surface.

I'm going to create a third curve going from about x=1.2 to x=1.6 that would connect the two smoothly.  So I want to cut out that section of both and replace it with a curve that will match g(x) (brown) at x=1.2 and f(x) (in green) at x=1.6 smoothly.

In order for my new function, which I'll call h(x), to match g(x) smoothly on the left, the y-coordinates of both g(1.2) and h(1.2) must be the same AND the slope of g at 1.2 and the slope of h at 1.2 must be the same.  

That is, we want h(1.2)=g(1.2) and h'(1.2)=g'(1.2).

And, of course, in order for h(x) to match f(x) smoothly on the right,  we need h(1.6)=f(1.6) and h'(1.6)=f'(1.6).

So here's the big idea.

We want h(x) to satisfy 4 conditions.  That means we basically have four unknowns.  There will usually exist a polynomial wth four coefficients to satisfy these four unknowns.  (It may not look like you expect it to, though!)

Four coefficients means a cubic polynomial.

> h:= x -> a*x^3+b*x^2+c*x+d;

h := proc (x) options operator, arrow; a*x^3+b*x^2+c*x+d end proc

We also need to use h', so I need to find it (which is easy enough) and enter it:

> dh:= x -> 3*a*x^2+2*b*x+c;

dh := proc (x) options operator, arrow; 3*a*x^2+2*b*x+c end proc

Now we need to find a, b, c, and d so that h(1.2)=g(1.2), h(1.6)=f(1.6), dh(1.2)=dg(1.2), and dh(1.6)=df(1.6).  This is four equations in four unknowns, which would be a pain for us to do, but easy for Maple:

First, we have Maple do the derivatives (I know you can, but in this case it's easier, because then you can just cut and paste as you tweak your functions to get them to look like you want them to), and then define derivative functions in Maple:

> diff(f(x),x);

-2*x+5.6

> df:= x -> -2*x+5.6;

df := proc (x) options operator, arrow; -2*x+5.6 end proc

> diff(g(x),x);

8*x-8

> dg:= x -> 8*x-8;

dg := proc (x) options operator, arrow; 8*x-8 end proc

And now we're ready to have Maple do the solving for us:

> solve( { h(1.2)=g(1.2), h(1.6)=f(1.6), dh(1.2)=dg(1.2), dh(1.6)=df(1.6)});

{c = -18.80000000, b = 14.12500000, d = 9.280000000, a = -3.125000000}

Important:  to avoid confusion later, it's best to now name my new function something other than h, so that I can use h again!!!

Let's see what this gets us.  Remember it's quicker to cut and paste, when dealing with numbers like this!  (You could just define your new function to be a*x^3+b*x^2 etc, but then when you do your next curve-matching, you have to use all new letters, and you can quickly run out!)

> m := x -> -3.125000000*x^3+14.12500000*x^2-18.80000000*x+9.280000000;

m := proc (x) options operator, arrow; -3.125000000*x^3+14.12500000*x^2-18.80000000*x+9.280000000 end proc

> plot3:= plot(m(x), x=1.2..1.6, color=black, scaling=constrained):

> display(plot1,plot2,plot3);

[Plot]

This looks like it will probably be pretty good (although it's hard to tell).  I'll now go back and change the domains of plot 1 and plot 2.  In the ordinary course of events, I would just go back up there and change them there, but for your benefit, I'll redo them here:

> plot1:=plot(f(x),x=1.6..4, y=0..4, scaling=constrained): plot2:=plot(g(x),x=.4..1.2, y=0..4, color=blue, scaling=constrained):

> display(plot1,plot2,plot3);

[Plot]

Look at how smooth that is! I smoothed out the connection between the curves (in fact, I made a connection where there wouldn't have been one.)

The bottom of the posy vase would be a vertical line, which is hard to get Maple to draw, since it's not a function.

If 1 unit = 1 inch, this posy vase will be close to 6 inches in diameter at the base, 8 inches in diameter at its widest point, and about 6 inches wide in diameter at the top.  Maybe posy vase isn't quite the right word for it!

I don't want the inside, where the flowers go, to be that wide -- they'll just flop around all over the place.  I also want it to be less curvy, since that'll make it easier to wash.  I think I want a sideways opening parabola .  It took some experimenting to decide I wanted a tenth root.  In order to open in the direction I want it to, I'll need it to be (-x)^(1/10).  In order to have a vertex over at  3.5, I need to have the inside of the root be -(x-3.5).

> z:= x -> .95*(3.5-x)^(1/10);

z := proc (x) options operator, arrow; .95*(3.5-x)^(1/10) end proc

> plot(z(x),x=0..3.5, y=0..2, scaling=constrained);

[Plot]

> plot4:=plot(z(x), x=.4..3.5, color=coral, scaling=constrained):

> display(plot1, plot2, plot3, plot4);

[Plot]

Okay, it's kind of boring, but this is just demo, after all.

Now, I need to see what this would look like  revolved around the x-axis.

> t1:=tubeplot( [x,0,0], x=.4..1.2, radius= g(x)):  t2:=tubeplot([x,0,0], x=1.2..1.6, radius=m(x)): t3:=tubeplot([x,0,0], x=1.6..4, radius=f(x)):                t4:=tubeplot([x,0,0], x=.4..3.5, radius=z(x)):

> display(t1,t2,t3,t4, scaling=constrained);

[Plot]

>

This is more or less what it would like from the outside.  To see the inside and the outside together, I can do this:

> t1:=tubeplot( [x,0,0], x=.4..1.2, radius= g(x),style=wireframe, color=black):         t2:=tubeplot([x,0,0], x=1.2..1.6, radius=m(x),style=wireframe, color=black): t3:=tubeplot([x,0,0], x=1.6..4, radius=f(x),style=wireframe, color=black):                            t4:=tubeplot([x,0,0], x=.4..3.5, radius=z(x), style=patchnogrid):

> display(t1, t2, t3, t4, scaling=constrained);

[Plot]

Okay, so I've made my little vase. It's a little distorted, and not what I'd submit to Cindy, but it's enough to show you some ideas.

Things to make note of:

1) Make sure that your design is the scale you want it to be.  That means paying attention to what your curves look like when you use "scaling=constrained", even in the tubeplots.

> display(t1,t2,t3, scaling=constrained);

>

2) Remember, you need to calculate the volume, using the techniques you've learned, (and putting them in the units you're using for your to-scale object).  

Do not put this off either -- it will often not be as easy as it sounds, as you'll have several different curves.  In fact, if you go for the more interesting shapes, as Cindy wants you to do, where the inside doesn't match the outside exactly, you may have to break your volume- finding process into many different intervals.