Jump to content

Wikipedia:Reference desk/Archives/Mathematics/2011 August 17

From Wikipedia, the free encyclopedia
Mathematics desk
< August 16 << Jul | August | Sep >> Current desk >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


August 17[edit]

Air Resistance Terminal Velocity[edit]

I have an assignment which involves dropping an object of a certain mass and recording the time that it takes to hit the ground, then using this to determine the coefficient of air resistance and terminal velocity of the mass.

I am told to assume that the resistance is given by where is the velocity in meters per second. I am told to calculate the air resistance and the terminal velocity.

I don't really understand the question. For instance it doesn't mention where I should take mass into account. The wiki articles on air resistance have complicated formulae and this is a high school math question that is not supposed to require any physics knowledge.

If the mass falls according to an acceleration constant of , and that means that it has a velocity of at time , does that mean that its actual velocity then becomes when incorporating the effect of air resistance?

And if the terminal velocity is the velocity when the acceleration is equal to zero should I calculate this finding when ? — Preceding unsigned comment added by 118.208.93.112 (talk) 05:57, 17 August 2011 (UTC)[reply]

In order for this to be a high school math problem, you should have been given a formula to use. Working this out from the information given requires solving a differential equation, and high school students generally aren't expected to be able to do that, even if they have taken calculus. (The result ends up being that the velocity decays exponentially to the terminal velocity.) Looie496 (talk) 06:30, 17 August 2011 (UTC)[reply]
is the force. To find the acceleration caused by it you need to divide by the mass (alternatively, you equate this force with the force of gravity ).
The terminal velocity satisfies .
The problem can be solved with high-school math if you assume the time to reach the terminal velocity is negligible. Then you have where h is the height from which the object is dropped, and from this you can solve for k.
For reference, the kv formula is only correct for low enough speeds. For higher speeds, resistance is proportional to the square of the velocity. -- Meni Rosenfeld (talk) 09:13, 17 August 2011 (UTC)[reply]
Drop the object from a range of different heights and measure the time it takes to reach the ground as accurately as possible. Make the range of heights as wide as possible, and do several runs at each height, averaging the times to reduce experimental error. Plot your times t (vertical axis) against your heights h (horizontal axis). For small heights the graph of t against h will be a curve, but for large enough heights, once the object reaches its terminal velocity, the graph will become a straight line. The reciprocal of the slope of this line is the object's terminal velocity (you have to take the reciprocal because you want units of m/s, not s/m). As Meni says, once you have the terminal velocity you can calculate k from
k is specific to this one object, so you can regard the object's mass m as fixed. If you wanted to shoot for extra credit, you could repeat the experiment for different objects with different shapes and densities and see what value k takes for each object.Gandalf61 (talk) 10:26, 17 August 2011 (UTC)[reply]

In addition to gravity and drag the terminal velocity depend on buoyancy. A pebble moves differently from a balloon. (See also added mass and lift.) Bo Jacoby (talk) 09:56, 18 August 2011 (UTC).[reply]

DeeperQA's nearly the last theorem[edit]

Whereas: (3^3) + (4^3) + (5^3) - (6^3) = 0

"I have discovered a truly marvelous proof of this theorem, which this moment is too short to contain."

Okay, all joking aside does anyone have graphical proof that Laplace's Fermat's Last Theorem and this theorem are valid and correct? --DeeperQA (talk) 08:06, 17 August 2011 (UTC)[reply]

(Do you mean Fermat's last theorem?) According to the article Euler's sum of powers conjecture, 26824404 + 153656394 + 187967604 = 206156734, so I'm afraid your "theorem" isn't true. AndrewWTaylor (talk) 08:42, 17 August 2011 (UTC)[reply]
Google calculator verifies so it must not be true. --DeeperQA (talk) 15:49, 17 August 2011 (UTC)[reply]
Are W, X, Y, and Z always to be consecutive integers ? Even so, I can't imagine how you could show that graphically, for all possible values of W, X, Y, Z, and N. You could make a 2D graph showing one value of N, with the horizontal axis being small values of W, X, Y, and Z, and the vertical axis being the values of WN, XN, YN, WN+XN+YN, and ZN. I suppose you could extend that into a 3D graph, with the third dimension being different values of N. However, you could still only show a small portion of all the possible values, which doesn't constitute a "general proof". StuRat (talk) 08:50, 17 August 2011 (UTC)[reply]

Real Number[edit]

Can we define the real numbers by defining them as a complex number with imaginary part equal to zero and then defining the complex numbers as the smallest set of numbers ( or smallest field) that we must work in to ensure that every nth order polynomial has precisely n roots? Or does this leave us open to ambiguities, such as the cardinality of sets? Thanks. asyndeton talk 11:49, 17 August 2011 (UTC)[reply]

You'll have to be specific about which polynomials you are considering. If you only at first consider polynomials with rational coefficients, then the "smallest field" obtained will be the algebraic closure of Q, which is not C. It doesn't even contain all of R. For instance, you can never get a real transcendental as a root of a rational polynomial. The way to get all of C by this method is to start with polynomials with real (or complex) coefficients, which would defeat the purpose of your construction. Staecker (talk) 12:00, 17 August 2011 (UTC)[reply]
I should have realised that. Thanks for your very helpful answer. asyndeton talk 12:04, 17 August 2011 (UTC)[reply]
There's a few problems with saying reals are the same as complex numbers with the imaginary part zero. Simple arithmetic is okay but then you get to comparisons which give real trouble with complex numbers. And after comparisons you get to things like ez always has a single well defined value but (e+0i)z does not where I've added a zero imaginary to show we're now talking about a power of a complex number. Dmcq (talk) 12:52, 17 August 2011 (UTC)[reply]
I respectfully disagree with Dmcq. The positive numbers are all real numbers, and the function az is tricky unless a is positive, but that is no reason why reals should not be identified with complex numbers having zero imaginary part. You are really in trouble if you insist that ee+0i. Bo Jacoby (talk) 15:23, 17 August 2011 (UTC).[reply]
Why are you "in trouble"? You seem to feel very strongly about this kind of point, and I think you are very incorrect. The reals may be considered a subset of the complex numbers, or not, according to convenience. In their usual set-theoretic coding, they are definitely not literally a subset of the complex numbers. Ordinarily that's a fact of little importance, but occasionally a context where it's important does come up. --Trovatore (talk) 07:02, 18 August 2011 (UTC)[reply]
Whilst I appreciate this is now a moot point, would the cardinality of sets also have been an issue? asyndeton talk 19:02, 17 August 2011 (UTC)[reply]
As said above you would have problems with the cardinalities. If you haven't defined the reals and only have rationals then the only numbers you can define your way are the algebraic numbers. There's only of those. You can enumerate all the polynomials with rational coefficients, in fact even the ones with algebraic coefficients only give rise to algebraic numbers so they are factors of polynomials with rational coefficients.
As to e the real being different from e+0i there is no difficulty in normal working as when you compare a real and a complex number you automtically convert the real to a complex number. It is the same when comparing integers with reals. 0 the integer is however a different entity from 0 the real or 0 the complex number or 0 the quaternion or 0 (mod 7) in modular arithmetic. Whe exponentiating one should not promote e the real to a complex number or all sorts of things go wrong, see exponentiation#Failure of power and logarithm identities, the last example - the paradox by Clausen - shows what can happen. Dmcq (talk) 22:51, 17 August 2011 (UTC)[reply]
Programmers distinguish between integers and reals, because the names refer to different data types. Zero is represented differently as integer and as real, but still the two representations refer to the same mathematical object, zero, and expressions like 0==0.0 evaluate to true. Mathematically the set of integer numbers is considered a subset of the set of real numbers , and the set of real numbers is considered a subset of the set of complex numbers . . You are not 'promoting e the real to a complex number', because any real number is also a complex number. Functions that are defined for real numbers may not generally be defined for complex numbers, but of course they are defined for some complex numbers, namely the real numbers. Bo Jacoby (talk) 06:23, 18 August 2011 (UTC).[reply]
Integers are completely different conceptually from reals. As a ring, they are isomorphic to a subring of the reals, so without harm you can consider them to be a subset of the reals if you like, at least as long as you limit yourself to what can be expressed in the language of rings (addition and multiplication). But there is no reason to expect such a strong identity between integers and reals as to exclude differences in any language whatsoever. They're a completely different breed of cat. --Trovatore (talk) 07:12, 18 August 2011 (UTC)[reply]
Consider the first degree equation 2x=x. Mathematicians think that this equation has the unique solution x=0, but according to Trovatore and Dmcq it has the integer solution x=0, the real solution x=0.0, the complex solution x=0+i0, a quaternion solution, a vector solution for each vector space, and many many more solutions. This is very far from main stream mathematics. Bo Jacoby (talk) 14:21, 18 August 2011 (UTC).[reply]
I'm with Trovatore and Dmcq on this one. Once we have established that there is a subset of that behaves like and a subset of that behaves like then it is common and convenient to blur the difference, but strictly speaking , and are three distinct mathematical objects. Gandalf61 (talk) 14:39, 18 August 2011 (UTC)[reply]
It's completely mainstream mathematics. Normally people don't make a big deal about it, because it usually doesn't matter, and of course no one wants to bother with distinctions that don't make a difference. But absolutely no mainstream mathematician is going to identify the zero of SO(3) with the zero of ℓ2; that makes no sense at all.
When mathematicians say that 2x=x has a unique solution, it's understood that that's after specifying a structure in which the equation is to be interpreted. Usually the structure is obvious from context.
Bo, are you trying to eliminate context as a factor in how mathematics is interpreted? You can't do that, sorry. It is important and it's always going to be. --Trovatore (talk) 16:44, 18 August 2011 (UTC)[reply]
Gandalf, what is the difference between 'a subset of that behaves like ' and itself? Trovatore, what is the zero of SO(3)? Bo Jacoby (talk) 21:35, 18 August 2011 (UTC).[reply]
Actually, I was too glib in talking about SO(3). Of course SO(3) doesn't have a zero. I just noticed that now. Replace it with the zero of the ring whose elements are linear transformations from R^3 to R^3 (multiplication being composition). The zero of that ring is the linear transformation that sends every vector to the zero vector. --Trovatore (talk) 21:47, 18 August 2011 (UTC)[reply]
Bo - equivalence is not identity. For example, the set of matrices
behaves like (i.e. is isomorphic to) , but it is not itself because consist of numbers, not matrices. Gandalf61 (talk) 13:52, 19 August 2011 (UTC)[reply]
Gandalf, you may like to study the article When is one thing equal to some other thing?. The point is that is only defined modulo isomorphism. The representation by pairs of numbers is not better than the representation by matrices. Both representations define 'itself'. Bo Jacoby (talk) 22:41, 19 August 2011 (UTC).[reply]
Trovatore, This ring also contains as a subring. Answering your question: algebra is abstract and independent on context or interpretation. Zero apples = zero bananas = zero. Bo Jacoby (talk) 22:22, 18 August 2011 (UTC).[reply]
Interpretation of mathematics is very much context-dependent, and always will be. You're certainly free to try to get rid of the dependency. You are guaranteed to fail. --Trovatore (talk) 22:29, 18 August 2011 (UTC)[reply]
The fathers of abstract algebra did not fail in getting rid of context dependency. Bo Jacoby (talk) 10:31, 19 August 2011 (UTC).[reply]

This argument seems to boil down to what it means for objects to be isomorphic. I have to agree with gandalf and Trovatore that isomorphism has to be distinct from considering two objects to be "the same object". The main example above is the ring of integers as a subset of the ring of reals. It so happens that there's only one injective homomorphism from the integers to the reals, which might make it easy to falsely believe that there are no problems saying that 3 in Z is the same thing as 3 in R. The relationship is un-ambiguous. Even your example equation 2x = x, seems conveniently chosen to avoid problems of context because it just so happens that the unique solution in every Z-module is the zero element. As soon as you move away from these special cases, this interpretation of isomorphism is going to have problems. What if I'm talking about the ring of complex numbers C and the quaternions H? Clearly C is isomorphic to a subring of H and one such homomorphism send the imaginary unit to i in H. Would you claim that i in H is the same object as the imaginary unit in C? What if I wanted to map the imaginary unit to j instead? Is the imaginary unit the same as more than element of H? Similarly, what's the solution to 2x = 0 without context? Rckrone (talk) 03:25, 20 August 2011 (UTC)[reply]

Trovatore asked: why are you in trouble if you insist that e≠e+0i? Because it follows from the rules of arithmetic that 0=0 → 0=0i → e+0=e+0i → e=e+0i. I am amazed that you guys seriously accept contradictions like e≠e+0i. Rckrone's quaternion example can be simplified to complex conjugation: "Is i is the same object as −i? Is the imaginary unit more than one element of ?" The answers are that i≠−i but they are indistinguishable mirror images, and that there are two imaginary units in . But only occurs once as a subring of , and only occurs once as a subring of , so there is no ambiguity in , and there is no doubt that −0.0+0.0i is an integer, even if it is written in the form of a noninteger, just like is an integer even if it written in terms of transcendental and imaginary numbers. Bo Jacoby (talk) 09:59, 20 August 2011 (UTC).[reply]
They are objects in different structures. The rules of arithmetic do indeed imply that, if you add zero times a complex number to another complex number, the result is the second complex number. That tells you nothing whatsoever about whether the real number e is the same object as the complex number e. --Trovatore (talk) 07:21, 21 August 2011 (UTC)[reply]
3x=x (mod 4) has the solution 2 as well as 0 in modulo 4 arithmetic. Exponentiation is defined differently for a real to a complex power from a complex number to a complex power, it is not a ring operation. The complex logarithm is used when the base is complex and its value is not unique or you have to use branch cuts. Comparison does not carry over either. Is 0 greater than or less than 1-i? Saying 0i is 0 is a convenience and done according to the circumstances, it is normally pretty obvious when it is sensible and when it is not. Using the complex number definition of exponentiation . So the value can be any old value like this depending on the particular integer n chosen here by using any particular branch cut for the complex logarithm. Dmcq (talk) 11:30, 20 August 2011 (UTC)[reply]
Bo - it seems clear to me that cannot be the same object as because there are operations you can do to that you cannot do to . An example is taking the imaginary part; the imaginary part of is 0, whereas the imaginary part of is undefined. Of course you can forget the additional structure of and say that is equivalent to for any operations that are defined on both and - but they are still distinct and separate mathematical objects. Gandalf61 (talk) 12:10, 20 August 2011 (UTC)[reply]
Dmcq - The power ab is defined for nonzero a and integer b, and for zero a and positive b, and for complex a and zero b, and for positive a and complex b. Here 'complex' includes the reals, and 'positive' means positive and real. The definitions match where several cases apply simultaneously (such as 32 where 3 is positive and 2 is integer). Comparison: a>b when ab is positive, and a<b when b>a. This makes sense for real a and b, and also for some nonreal a and b, but general complex numbers are not comparable. The number 1−i is neither >0 nor <0 nor =0. Logarithms of nonpositive numbers are ill defined and their use leads to contradictions, as you show. All this has nothing to do with the case. It is no reason for letting e≠e+0i.
Gandalf - The imaginary part of a real number is zero. "distinct mathematical objects"? e and e+0i are not mathematically different. The number e=e+0i is both real and complex. Bo Jacoby (talk) 13:31, 20 August 2011 (UTC).[reply]
I see. And presumably, if e is both real and complex, then it is also a quaternion because e=e+0i=e+0i+0j+0k ? But why stop there - is it an octonion and a sedonion too ? And, since it shares some properties with the matrix
is e also a 2x2 matrix, and a 3x3 matrix etc. etc. ? Is it also a vector ... and a tensor ... and a constant polynomial ? Are you saying that one and the same mathematical object is simultaneously a member of all of these structures ? Or is there a line somewhere where the object stops being the same e as the real number e ? Gandalf61 (talk) 16:13, 20 August 2011 (UTC)[reply]
Yes. If the structure contains a unique subset satisfying the axioms of , then this subset is , and the element e is the real number e. Bo Jacoby (talk) 22:52, 20 August 2011 (UTC).[reply]
That's called isomorphism and embedding is where one has something isomorphic to a bit of something larger. Dmcq (talk) 23:13, 20 August 2011 (UTC)[reply]
Bo - I am still confused. Are you saying that
because there is an isomorphism of into the set of 2x2 real matrices which maps e to this matrix, or are you saying that
because this isomorphism is not unique ? Gandalf61 (talk) 08:12, 21 August 2011 (UTC)[reply]
The first! The isomorphism is unique. Bo Jacoby (talk) 15:49, 21 August 2011 (UTC).[reply]
What about
or
Why don't those isomorphisms count ? I can see they aren't very "natural" mappings but they are still isomorphisms of addition and multiplication. Gandalf61 (talk) 17:09, 21 August 2011 (UTC)[reply]
Sorry, I was not precise. The unit element of the matrix ring is , not or . So , not or . Bo Jacoby (talk) 05:01, 22 August 2011 (UTC).[reply]
So, are you going to give us a list of all your requirements for a subset of a structure to be identical to R? They seem to be changing a bit.
It's true that Gandalf's isomorphic embedding is an isomorphic embedding in the language that has plus and times, but not in the language that also has a constant symbol for the multiplicative identity. But what if the target structure is not a ring, or perhaps just not a ring with unity, so it doesn't have a multiplicative identity? Does that render it immune to having substructures of it identical to R? --Trovatore (talk) 06:53, 22 August 2011 (UTC)[reply]
So lets see then. If I have a theory with <x,0> where <x,0>+<y,0>=<x+y,0> and <x,0>×<y,0>=<x×y,0> then <e,0> is the real number e? However if I then extend the theory to include something other than 0 for the second element then <e,e> would be the real number e and the <e,0> would no longer be e? I really think the idea of isomorphism works better. Dmcq (talk) 07:05, 22 August 2011 (UTC)[reply]

I merely want to object against distiguishing between integer zero, and real zero, and complex zero. I am not an expert on abstract ring theory, and I should not have derailed the discussion by trying to answer Gandalf's question regarding generalizations beyond complex numbers. The formula refers to the subring inclusion, and a subring of a ring contains the multiplicative identity of that ring. Bo Jacoby (talk) 13:36, 22 August 2011 (UTC).[reply]

Yes, we know you want to object. But you've never given any good reason to want to object, not in the years you've been talking about it.
I understand you don't like it. That's OK. Everyone is entitled to his own sense of mathematical aesthetics. But you keep saying things like "you're in real trouble" and "this is far from mainstream", and those things are just not true. --Trovatore (talk) 18:41, 22 August 2011 (UTC)[reply]

Trovatore is urged to document that e≠e+0i is mainstream mathematics, and to explain how to avoid trouble. The expression e+0i consists of two terms. The first term is e which (according to Trovatore) is real and not complex, while the other term, 0i, is complex and not real. The two terms are (according to Trovatore) completely different breeds of cat. Now they are going to be added together! How can different breeds be added together? By magic! Just before the addition takes place the term e is (according to Trovatore) transformed from one breed into another. Suddenly e has become complex and not real! Adding 0i really changes nothing. Even if 0i is not equal to 0 it behaves like 0. e+0i is complex and not real, while e was real and not complex until it was about to be added to 0i, when it turned into beeing complex and not real. So e≠e+0i Q.E.D. !!!! Please Trovatore, try and convince us that this is not being in trouble. Bo Jacoby (talk) 07:57, 23 August 2011 (UTC).[reply]

Arguing about the thing is a red herring. It is just used as a shorthand notation for the fact that the real e is different from the complex e, where it is assumed that it is inferred from context that the LHS refers to the real e and the RHS refers to the complex e. If you don't agree this is implicit from the notation then there's no point arguing about this ambiguous equation. Better would be to write , where e and 0 denote real numbers, complex numbers are defined as ordered pairs of real numbers, and we've used one common construction of ordered pairs. Now there's nothing to argue about, because this inequality follows from the axioms of set theory.
You seem to be saying that since there's an isomorphism between and , the corresponding elements are equal. But if isomorphism implies equality, then 1=2. Proof: the additive group is isomorphic to . The isomorphism maps 1 to 2, hence 1=2. -- Meni Rosenfeld (talk) 08:33, 23 August 2011 (UTC)[reply]

Am am glad that e≠e+0i should not be understood litterally, because elementary algebra says that e+0i=e+0=e, so e≠e+0i is simply not true. I don't understand how e≠e+0i can mean . Perhaps you ment to write  ? Complex numbers are defined as an axiomatic system, and one model satisfying the axioms is: 'pairs (x,y) of real numbers x and y with special definition of addition and multiplication. When (1,0) is called 1 and (0,1) is called i, these pairs are written 1x+iy=x+iy'. Another model satisfying the same axioms is: 'matrices of the form where x and y are real numbers. When is called 1 and is called i, these matrices are written 1x+iy=x+iy'. Different models satisfying the axioms are equally valid. The identification of the multiplicative unity of the different rings is essential for the notation x+iy. So in order to use the standard notation x+iy you must identify 1, the real number, with 1, the complex number. The number 1 has different names in different languages: (bir, yksi, ataaseq, uno, eins, en, one, &c) but that does not make 1≠1 either. The group isomorphism between and is merely a renaming of the numbers, just like the strange way of counting points in tennis doesn't make 1=15 either. But the ring homomorphism from to , which maps the multiplicative unity of to the multiplicative unity of , is unique. Bo Jacoby (talk) 13:04, 23 August 2011 (UTC).[reply]

Self study mathematics[edit]

Hello all. I am looking to self study mathematics. However, I am still in high school and have yet to go through calculus. I was wondering if I could get any recommendations on branches of mathematics to study that don't require large amounts of difficult calculus (I understand how to differentiate pretty well and I can integrate, but not much else.) I've already taken Algebra and Euclidean geometry and I understand set theory. I'm more interested in pure math, but I'm open to anything. I'm apprehensive to self-study calculus and then test out of it, because a friend said that especially with calculus, classroom experience is a good thing, but if you think it's possible, I'm open to suggestions. Thanks Aacehm (talk) 16:07, 17 August 2011 (UTC)[reply]

If you are interested in pure maths a good place to start would be Linear Algebra. MIT has some great video lectures on the internet. You could view those.-Shahab (talk) 16:17, 17 August 2011 (UTC)[reply]

If you enjoy doing proofs, I think self-study of calculus could be a good thing. Most high school calculus classes focus on teaching formulas and tend to gloss over the mathematical foundations -- the concept of a limit is pretty challenging to many students, and usually doesn't get taught that well. Linear algebra is also good, and the other thing I might recommend would be probability theory, which is extraordinarily useful. Looie496 (talk) 16:25, 17 August 2011 (UTC)[reply]

I started reading Spivak's Calculus A month ago but the rigor proved to be a little too much. I might try to go through it again. — Preceding unsigned comment added by Aacehm (talkcontribs) 16:45, 17 August 2011 (UTC)[reply]
Dont worry about mathematics being "too rigorous". I was like you when I was in high school, not understanding a thing they're saying, and I just kept bashing through until my mind matured enough to accept the level of rigor. Now I think too rigorously! Many proofs I used to accept now I reject as too handwavy and non-rigorous. Just keep trying, you'll get there. Money is tight (talk) 13:22, 18 August 2011 (UTC)[reply]

Quadratic equation with a mod operator[edit]

Usually, when I get a mod tossed into an equation, attempting to solve it is a waste of time. So, I thought I'd ask about this one before attempting to reduce it. All letters except X are constants:

If it wasn't for the mod, I could easily reduce this to the form and solve it. I figure that if the mod operator didn't include the x term, I could do the same. But, with the x term in the mod operator, I assume this cannot be reduced. -- kainaw 16:37, 17 August 2011 (UTC)[reply]

How about rewriting it as
?
Looie496 (talk) 17:08, 17 August 2011 (UTC)[reply]
Yep. Doing that will give me a bunch of values for x instead of two. So, it introduces a whole new problem of limiting k, which turns the whole thing into a waste of time. I'll approach the original problem with a matrix solution instead of attempting a quadratic one. Thanks. -- kainaw 17:20, 17 August 2011 (UTC)[reply]
Could you please give us more details? As it stands, your "equation" is (bx + ax2); which isn't actually an equation, because there is no equals sign. Besides that, you use ordinary parentheses; while the modulus is usually denoted with vertical lines, e.g. | y |. Also, you seem to introduce the constant c later on without any explanation. Are you trying to solve | ax2 + bx + c | = 0, or | ax2 + bx | = | c |, or what? Fly by Night (talk) 22:55, 17 August 2011 (UTC)[reply]
"Mod" here stands for modular arithmetic, not the modulus function. x%y is computer science notation for "the residue of x mod y".--Antendren (talk) 23:51, 17 August 2011 (UTC)[reply]

Hi. In the classical knapsack problem, the aim is to optimize the value in the knapsack. I want to list *all* ways of achieving the optimum (and I know that there are many ways of doing it in the cases I'm interested in). Is there a simple way to to this using classical knapsack algorithms, or if not, what is the best way to cast my problem?

Example: knapsack of weight 6. I have 4 objects with (weight,value) pairs (1,1), (2,2), (3,3) and (4,4). knapsack algorithms give (4,2) [ie object 4 and object 2] but I need ((4,2),(3,2,1)). Cheers, Robinh (talk) 22:10, 17 August 2011 (UTC)[reply]

Somehow your edit broke the page, so I undid it and re-posted you question. Rckrone (talk) 22:35, 17 August 2011 (UTC)[reply]
(OP) yes, some weird error at this end too. Thanks for the fix Robinh (talk) 01:25, 18 August 2011 (UTC)[reply]
If you have a hefty supply of memory and time, there is a very simple method of listing all optimal solutions to the knapsack problem. Your function takes the weight capacity of a sack and a collection of items. What the function does is very simple. I'm writing this in a bit of pseudo code since this isn't the computer desk:
function max_capacity(volume_left, items)
Max capacity = 0
For each item in items
If item weight <= volume_left
New items = items with item removed
New volume = volume_left - item weight
This capacity = max_capacity(New volume, New items)
If this capacity > max capacity, set max capacity=this capacity
Return the max capacity
Now, you know what the maximum capacity is. Repeat this function again, but change it so it prints each combination that meets the maximum capacity. Because of the way it is written, we want to print the combination when the volume_left reaches the minimum level. So, min_volume = sack capacity - max capacity.
function print_combos(volume_left, items, min_volume, items used)
If volume_left = min_volume, print the items used
Otherwise...
For each item in items
If item weight <= volume_left
New items = items with item removed
New used = items used with item added
New volume = volume_left - item weight
Call print_combos(New volume, new items, min_volume, new used)
That will print every permutation of the solutions. If you want to avoid redundant permutations, you can have it sort the output when it prints the items used and then remove repeated lines. -- kainaw 12:34, 18 August 2011 (UTC)[reply]
(OP) Thanks Kainaw, but I fear that removing repeated lines will kill me in terms of computer time (I have maybe 40 elements). I guess this shows that I can't somehow alter the classical knapsack problem to do what I want. I've also realized that my problem is actually a subset sum problem but this isn't helpful because again, I need *all* solutions. Maybe optimization problems are the wrong paradigm for this and I should look instead at Diophantine equations. Best wishes, Robinh (talk) 22:23, 18 August 2011 (UTC)[reply]
I did this recently by treating my problem as a multi-dimensional knapsack and - after every successful solution was returned - adding a new constraint outlawing that solution, before re-calling and repeating. I was using CPLEX which is very fast and this was fine for my highly dominated 500 item dataset, but apparently CPLEX actually has specific features to return multiple items efficiently ("solution pooling" apparently, not that I can work out how to use it). --Iae (talk) 12:48, 19 August 2011 (UTC)[reply]
How I would do it, if I was allowed infinite time and resources to run the program... First, place all your items in an array. I'd also sort the array to make my output have a nice pattern. Then, when you do the "try every item" thing, change it to "try every item that has an array index higher than what is already in the sack". So, your items are 0:A, 1:B, 2:C, 3:D such that the number is the index and the letter is the item. Once you place item 0 in the sack, you can try item 1. But, once you place item 1 in the sack, it is impossible to put item 0 in the sack. So, if AB comes up as one combination, BA won't come up later. Note that I use array indexes, not item sizes. If you have two items of the same size, you will get them showing up twice. This does have the issue of absolute uniqueness for the same reason. If you have 0:A, 1:B, 2:B, 3:C, you can get ABBC with item 1 followed by item 2. But, technically, you can have ABBC with item 2 before item 1, which is unique from the first ABBC. -- kainaw 13:28, 19 August 2011 (UTC)[reply]
(OP) Thanks guys. Two perfectly reasonable solution methods here, but I am most interested in the fact that my problem does not seem to be a special case of a standard problem (for if so, someone would have spotted it). I am very intrigued by Iae's suggestion of finding a solution, then calling the routine again with that solution forbidden. Is there a name for this technique? It is certainly clever, but is it substantially faster than Kainaw's approach, which seems to traverse through all elements of the power set of my items? Robinh (talk) 09:48, 20 August 2011 (UTC)[reply]
It looks like the various quantities are integers and one would with 500 of them expect a lot of overlap. So I'd probably do a divide an conquer of splitting the items in two and enumerating the best value for each weight and then joining those solutions when going the next level up. Then you can find the best solution at the top and work back down the tree again. This would depend on not having too large a maximum weight and it being an integer, turning this into a general solution would be a bit gruesome. Dmcq (talk) 14:48, 20 August 2011 (UTC)[reply]