Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
math program????
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
scap1784
Apprentice
Apprentice


Joined: 25 Dec 2002
Posts: 225

PostPosted: Mon Jul 28, 2003 9:04 am    Post subject: Reply with quote

sure here is the problem from the book.

Code:
Find the max and min volumes of a rectangular box whose surface area is 1500 cm^2 and whose total edge lengthis 200 cm. 


Well there is the problem and don't spend to much time on this as the problem is due alread but i am still curious on how to get an answer since my way anit going so great. :)
Back to top
View user's profile Send private message
shimage
n00b
n00b


Joined: 18 Jul 2003
Posts: 48

PostPosted: Wed Jul 30, 2003 12:05 am    Post subject: Reply with quote

because i'm bored...

I'm going to make my own variable names: x,y,z, where V(x,y,z) is the volume.

200 = 2*(x + y + z)
1500 = 2*(x*y + y*z + x*z)
V(x,y,z) = x*y*z

from the problem statement. You then remove z:

z(x,y) = 100 - x - y

and then remove y via pythagorean theorem:

y(x) = 1/2*(+/-sqrt(-3*x^2 + 200*x + 7000) - x + 100)

Then minimize/maximize V(x) via traditional single variable methods. Ok, fixed my incorrect transcription of the problem statement. Is it correct now?

edit: I'm not convinced I know what sign it should be... I thought I did, but now I think I'm retarded. I'm going to stop thinking about this now. And now that I have thought just a little bit more, I'm thinking that my solution is ass ugly, though I suppose numerical (graphing) methods should solve it pretty quickly. Given that I"ve spent 20 minutes on it, there is probably a nicer way than this. Oh yeah, and shouldn't the min volume be 0?
Back to top
View user's profile Send private message
CrimsonScythe
Tux's lil' helper
Tux's lil' helper


Joined: 25 Sep 2002
Posts: 83
Location: Minneapolis, MN

PostPosted: Wed Jul 30, 2003 12:33 am    Post subject: Reply with quote

The first equation should be:
200 = 4*(x + y + z)
:)
_________________
If we weren't supposed to eat animals, then why are they made of meat?
Back to top
View user's profile Send private message
shimage
n00b
n00b


Joined: 18 Jul 2003
Posts: 48

PostPosted: Wed Jul 30, 2003 12:44 am    Post subject: Reply with quote

CrimsonScythe wrote:
The first equation should be:
200 = 4*(x + y + z)
:)

I am such a fucking putz. Thank you. But the method should still work, right?

edit: oh, and my reasoning for the min volume is that, after you set z=0, you still have 2 degrees of freedom and only 2 constraints, so there shouldn't be any reason why you couldn't set V=0, correct?
Back to top
View user's profile Send private message
CrimsonScythe
Tux's lil' helper
Tux's lil' helper


Joined: 25 Sep 2002
Posts: 83
Location: Minneapolis, MN

PostPosted: Wed Jul 30, 2003 1:40 am    Post subject: Reply with quote

Well, there can't be any problem in setting one of the parameters to 0, but then it wouldn't be 3d anymore. ;) Just kidding! The minimum value will obviously converge towards zero (for instance x = 91.83300132670378, y = 8.16699867329622, and z = 0), and if I'm not totally moronic here, the maximum value will converge towards a cubic shape. To find the maximum value, I think that you'll have to resort to partial differential equations...
_________________
If we weren't supposed to eat animals, then why are they made of meat?
Back to top
View user's profile Send private message
Brandy
Bodhisattva
Bodhisattva


Joined: 08 Jun 2003
Posts: 820
Location: New Zealand

PostPosted: Thu Jul 31, 2003 3:23 am    Post subject: Reply with quote

CrimsonScythe wrote:
Well, there can't be any problem in setting one of the parameters to 0 ..... The minimum value will obviously converge towards zero (for instance x = 91.83300132670378, y = 8.16699867329622, and z = 0)...

Sadly if we assume that all constraints are immutable then the minimum cannot be found by setting x, y or z to zero, since this will involve trying to solve 100x - 2x^2 - 1500 = 0 which has no real solutions.

The problem is not too difficult and any symbolic math program should allow you to follow the steps below (even if pen and paper is all you need). :wink:

Scap1784 was on the right track thinking about Lagrange Multipliers. We start off with the equations
Code:

V(x,y,z) = xyz
A(x,y,z) = 2(xy +xz + yz) = 1500
L(x,y,z) = 4(x + y + z)  = 200

Using Lagrange Multipliers we want f(x,y,z) where for some k, p we have
Code:

delta V(x,y,z) = k delta A(x,y,z) + p delta L(x,y,z)
A(x,y,z) = 2(xy +xz + yz) = 1500
L(x,y,z) = 4(x + y + z)  = 200

We can rearrange this to
Code:

yz = 2(y + z)k + 4p
xz = 2(x + z)k + 4p
xy = 2(x + y)k + 4p
2(xy + xz + yz) = 1500
4(x + y + z) = 200

Eliminating p is easy, giving us
Code:

(y - x)z = 2(y - x)k  --->  (y - x)(z - 2k) = 0
(z - x)y = 2(z - x)k  --->  (z - x)(y - 2k) = 0

From these last two equations we can see that any two of the variables x, y, z must be equal. i.e. x = y or x = z. (If x != y and x != z then z = 2k and y = 2k so y = z). Without loss of generality let's assume that x = y. Now the constraints look like this:
Code:

(1)     2x^2 + 4xz = 1500  --->  x^2 + 2xz = 750
(2)     8x + 4z = 200  --->  z = 50 - 2x

Substituting (2) into (1) gives us
Code:

3x^2 - 100x + 750 = 0

Now we can solve for x, y, z
Code:

x = y  =  (100 +- sqrt(10000 - 4*3*750)) / 6  =  5/3(10 +- sqrt(10))
z = 50 - 2x = 5/3(10 -+ 2sqrt(10))

Now we only need to calculate the volume
Code:

V(5/3(10 + sqrt(10)), 5/3(10 + sqrt(10)), 5/3(10 - 2sqrt(10)))  =  125/27(700 - 20sqrt(10))

which is a minimum subject to the constraints given.
Code:

V(5/3(10 - sqrt(10)), 5/3(10 - sqrt(10)), 5/3(10 + 2sqrt(10)))  =  125/27(700 + 20sqrt(10))

which is a maximum subject to the constraints given.

I hope this all makes sense. It's quite difficult to write symbolic notation in ASCII. :)

Ciao, Brandy
_________________
Faber est suae quisque fortunae.


Last edited by Brandy on Thu Jul 31, 2003 6:56 am; edited 1 time in total
Back to top
View user's profile Send private message
CrimsonScythe
Tux's lil' helper
Tux's lil' helper


Joined: 25 Sep 2002
Posts: 83
Location: Minneapolis, MN

PostPosted: Thu Jul 31, 2003 5:26 am    Post subject: Reply with quote

About the minimum volume, here are the complete computations.

Code:
200 = 4*(x + y + z)
1500 = 2*(x*y + y*z + x*z)


Setting z=0:
Code:
200 = 4*(x + y)
1500 = 2*x*y => 750 = x*y


Considering that z = 0, it's rather obvious that we now have a 2-dimensional "box"
and that means that the total edge length is now only:
Code:
200 = 2*(x + y) => y = 100 - x


Substituting y = 100 - x:
Code:
750 = x(100 - x) => -x^2 + 100*x - 750 = 0


Which give us:
Code:
x =  (-100 +- sqrt(100^2 - 4*(-1)*(-750)))/ (-2)
  = 50 +- 41.833
  = 91.833 or 8.167


and

Code:
y = 100 - 91.833 = 8.167
or
y = 100 - 8.16 = 91.833


Also, if we think about this practically we can see that with z = 0, knowing
that the total edge will be x + y = 100, the surface area can be between:
Code:
Minimum area when 1-dimensional, with y = z = 0:
x = 100 => area = 0

and
Code:
Maximum area when the "box" is square, x = y:
2*(x + x) = 200  =>  x = 50  => area = x*x = 2500


Obviously, the area = 1500 will lie in the interval 0 - 2500.

As we know, the optimum box for maximum volume per edge-length/surface will be cubical,
but due to our constraints that is not possible. (The area would be 1667 or the edge-length would be 189.7.) The
next best thing will then, in contrast to the minimum value problem, be to keep two of the variables equal (as you mentioned
in your post, Brandy.) Your maximum volume is correct. :)

-- Thomas
_________________
If we weren't supposed to eat animals, then why are they made of meat?
Back to top
View user's profile Send private message
shimage
n00b
n00b


Joined: 18 Jul 2003
Posts: 48

PostPosted: Thu Jul 31, 2003 6:41 am    Post subject: Reply with quote

you people gotta think more like physicists (that is, not at all).

You set z=0, and you have 2 degrees of freedom left. You have 2 constraints. There is NOTHING keeping you from fulfilling those constraints with z=0, therefore V_min=0. done (well, you can go through the motions, like CrimsonScythe did, but I don't see why that's necessary). damn I'm lazy.

Oh yes, and thank you for showing an easier way to do it.. except that it's been so long since I had to do real math it doesn't make any sense anymore...


Last edited by shimage on Thu Jul 31, 2003 6:43 am; edited 1 time in total
Back to top
View user's profile Send private message
Brandy
Bodhisattva
Bodhisattva


Joined: 08 Jun 2003
Posts: 820
Location: New Zealand

PostPosted: Thu Jul 31, 2003 6:42 am    Post subject: Reply with quote

CrimsonScythe wrote:

Considering that z = 0, it's rather obvious that we now have a 2-dimensional "box"

And this is from where the heart of the minimum problem arises - semantics. :)
Can a box be 2-dimensional? In my previous post I've assumed it cannot, but for the sake of completeness, let's assume it can. This means our 2-dimensional "box" is now a plane and must be treated as such.
Code:

(1)     A(x,y) = xy = 1500
(2)     L(x,y) = 2x + 2y = 200

Rearranging (1) and substituting into (2) gives us
Code:

2x^2 - 200x + 3000 = 0

And solving for x we have
Code:

x = 50 - 10sqrt(10), 50 + 10sqrt(10)
  = 18.37, 81.62  (2dp)

CrimsonScythe, you reasoning was flawless but you had forgotten to make the Area equation appropriate for a plane. :)

Incidentally, when we find ourselves having to modify the initial conditions (e.g. from 3-dimensional to 2-dimensional) we usually find ourselves dealing with rather tenuous situations. :wink:

Ciao, Brandy
_________________
Faber est suae quisque fortunae.


Last edited by Brandy on Thu Jul 31, 2003 7:32 am; edited 1 time in total
Back to top
View user's profile Send private message
shimage
n00b
n00b


Joined: 18 Jul 2003
Posts: 48

PostPosted: Thu Jul 31, 2003 6:48 am    Post subject: Reply with quote

just out of curiousity, are the cases which satisfy the constraints discrete or continuous?
Back to top
View user's profile Send private message
CrimsonScythe
Tux's lil' helper
Tux's lil' helper


Joined: 25 Sep 2002
Posts: 83
Location: Minneapolis, MN

PostPosted: Thu Jul 31, 2003 2:52 pm    Post subject: Reply with quote

:) Regarding the semantics, that is indeed a little counter-intuitive to call it a box. If we assume that we can do that, you have to remember that this "sheet" still have two sides in the 3-dimensional space ;)

If you're not satisfied by a 2-dimensional box, just set z = 0.1 and you'll still arrive at a valid answer and a volume that is smaller than for the answer from the Lagrange equations.

-- Thomas
_________________
If we weren't supposed to eat animals, then why are they made of meat?
Back to top
View user's profile Send private message
Brandy
Bodhisattva
Bodhisattva


Joined: 08 Jun 2003
Posts: 820
Location: New Zealand

PostPosted: Thu Jul 31, 2003 4:50 pm    Post subject: Reply with quote

CrimsonScythe wrote:
:) Regarding the semantics, that is indeed a little counter-intuitive to call it a box. If we assume that we can do that, you have to remember that this "sheet" still have two sides in the 3-dimensional space ;)

The problem is that, in order to set z = 0 we have eliminated a variable and our metric-space is now 2-dimensional; accordingly our constraints should be 2-dimensional; it makes no sense to give then a 3-dimensional meaning by thinking of the sheet having two sides. It would be the same as considering the area of a circle to be defined as
Code:

A = 2 Pi r^2

arguing that there are 2 sides to any plane. Furthurmore we would then have to go back and redefine the original 3-dimensional constraints since we would have to consider the surface area as covering both the inside and outside of the box. :)

CrimsonScythe wrote:

If you're not satisfied by a 2-dimensional box, just set z = 0.1 and you'll still arrive at a valid answer and a volume that is smaller than for the answer from the Lagrange equations.

Sadly, setting z to a non-zero value means that we have to go back to out initial 3-dimensional constraints and we find that
Code:

(1)     A(x,y,z) = 2xy + 0.2x + 0.2y = 1500
(2)     L(x,y,z) = 4x + 4y + 0.4 = 200

Solving (2) for x then substituting into (1) gives us
Code:

A = 2y^2 - 99.8y + 1490.02

which does not have any real solutions. :( Apart from arguably setting z = 0, there are no possible values outside the interval [5/3(10-2sqrt(10)), 5/3(10+2sqrt(10))] :wink:

So we are faced with a dilemma. We can make the constraints immutable (see my first post) and look for the constrained absolute extrema using Lagrange multipliers, or we can treat a flat box as a special case using 2-dimensional constraints (see my second post.) :)

I guess the point I'm trying to make is that for Lagrange multipliers to work we need immutable constraints, and V, A, L to have continuous partial derivatives on some open set containing the constraint curves A = 0 and L = 0. Setting z = 0 breaks these rules so all bets are off if we choose to call rectangles boxes. I'm sure you'll find the model solutions do not include z = 0 if it's based on Lagrange multipliers :)

Ciao, Brandy
_________________
Faber est suae quisque fortunae.


Last edited by Brandy on Thu Jul 31, 2003 8:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
CrimsonScythe
Tux's lil' helper
Tux's lil' helper


Joined: 25 Sep 2002
Posts: 83
Location: Minneapolis, MN

PostPosted: Thu Jul 31, 2003 6:35 pm    Post subject: Reply with quote

Well, you can get real solutions if you, like me, use Matlab and add a little typo... :oops:

Regarding the area, I can't really see that if we reduce the z value until we hit zero that we'll suddenly will have a one-sided "sheet". (We lose the side walls, but should still have the top and bottom of the "box".)

Edited for moronity and dyslexia...
_________________
If we weren't supposed to eat animals, then why are they made of meat?


Last edited by CrimsonScythe on Thu Jul 31, 2003 9:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
odegard
Guru
Guru


Joined: 08 Mar 2003
Posts: 324
Location: Trondheim, NO

PostPosted: Thu Jul 31, 2003 7:34 pm    Post subject: Reply with quote

google.com+ "find the maximum and minimum volumes of a rectangular box whose surface area is 1500" "and whose total edge length is 200"

You get 4 hits and nr. 3 is the solution. Maybe not the most intelligent solution but definately the smartest :lol:

Code:

Max: [87500+2500*sqrt(10)]/27
Min: [87500-2500*sqrt(10)]/27


And you call yourself nerds....hah!
Back to top
View user's profile Send private message
carambola5
Apprentice
Apprentice


Joined: 10 Jul 2002
Posts: 214

PostPosted: Fri Aug 01, 2003 3:49 am    Post subject: Reply with quote

Solved.

Code:
V_min = 1/137.036
V_max  = 42


That, my dear friends, is the answer.
Back to top
View user's profile Send private message
shimage
n00b
n00b


Joined: 18 Jul 2003
Posts: 48

PostPosted: Thu Nov 06, 2003 1:58 am    Post subject: Reply with quote

Brandy wrote:
[...]I guess the point I'm trying to make is that for Lagrange multipliers to work we need immutable constraints, and V, A, L to have continuous partial derivatives on some open set containing the constraint curves A = 0 and L = 0. Setting z = 0 breaks these rules so all bets are off if we choose to call rectangles boxes. I'm sure you'll find the model solutions do not include z = 0 if it's based on Lagrange multipliers :)

Ciao, Brandy


I realize that this is a little late, but I've only just been introduced to Lagrange multipliers, and it reminded me of this problem. As you've stated, the method of Lagrange multipliers requires continuous partials, which means that you don't necessarily get the right answer. It's possible to get stuck in local extrema, and it doesn't even consider certain types of solutions.

Thus, using Lagrange multipliers will give you an answer, but you have no real "guarantee" that it's the right one (c.f. Goldstein's treatment of the minimal surface problem [pg. ~41, 1980]).

I was going to say that I didn't think that the fine structure constant had anything to do with this problem, but it turns out that alpha ~ 1/137.25
Back to top
View user's profile Send private message
Aurora
l33t
l33t


Joined: 26 Sep 2003
Posts: 658
Location: Classified

PostPosted: Thu Nov 06, 2003 4:26 pm    Post subject: Reply with quote

Hummm...

Well this thread quickly became a "solution" to the math problem the original poster had.

However, to cite another good math program that runs on *nix is "Maple."
_________________
"My downfall raises me to infinite heights." -Napoleon Bonaparte
Back to top
View user's profile Send private message
stormer
Tux's lil' helper
Tux's lil' helper


Joined: 20 May 2002
Posts: 122
Location: Canada

PostPosted: Fri Nov 21, 2003 8:40 pm    Post subject: Maple Reply with quote

I totally agree, maple is a great tool, but installing maple have been a little hard, because it uses an old libc.so.6. To install I had to copy the CD and edit the /mnt/cdrom/Linux/Linux/LinuxInstaller.sh, change a line tat says LD_ASSUME_KERNEL=2.2.5 to LD_ASSUME_KERNEL=2.4.20, then I also linked to my own java environment, but that was optional.

That was for those how want to install Maple 8.
_________________
Stormer :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum