Click to See Complete Forum and Search --> : challenge: dynamic formulas?


nanode
02-20-2001, 01:49 PM
I don't have a formal mathematics background so bare with me if my terminology is off.

I'd like to make a small app. that determines all the possible values that a formula can take as args to produce a known result.

An over simplified example would be calculating volume of an aquarium. volume = length * width * height

Suppose I needed a given volume (say 1000cm3) and a given width (say 50cm) and wanted to find out all the combinations of height and length (of integers) that would result in my desired volume?

Other than incrementing in a loop from 0 to n for each unspecified parameter, is there a way (elegantly) to solve this?

I suck at math - thanks in advance. :)

Stuka
02-20-2001, 02:47 PM
nanode-
Unfortunately, the general solution to this is a fairly complex mathematical arrangement. In general, to find the max/min values of a function f(x,y,z) subject to some constraint g(x,y,z), you solve a system of equations formed by: gradient(f(x,y,z)) = k*gradient(g(x,y,z)), where k is an undetermined constant. This gives you 4 equations in the 4 unknowns (x,y,z, and k). Then solve those equations to get the numbers giving max/min values.

Strike
02-20-2001, 04:41 PM
yup, what Stuka is talking about is known as Lagrange multipliers. You can probably do some research on this and maybe find a simplified solution.

Stuka
02-21-2001, 01:40 AM
I can't believe it...all that spewin' and I didn't even have the decency to tell him the name! :(

nanode
02-21-2001, 10:31 AM
Thanks for the replies. Doesn't sound as simple as I'd hoped, but at least there is a name for it, so I can research a bit.