Can someone here explain to me the theorem on problem set 2 problem 2? Im not sure whether I understand the question or not. Thanks in advance.
"Implement the compute_deriv function. This function computes the derivative of a polynomial function. It takes in a tuple of numbers poly and returns the derivative, which is also a polynomial represented by a tuple." Up above that they explain that for \(f(x)=ax^b\) then \(f'(x)=abx^{b-1}\) So they are saying take in \(f(x)=ax^b\) and compute \(f'(x)=abx^{b-1}\) For any poly that is simple addition (which includes addition of a negative aka: subtraction) you can brake the poly into parts and do the same operation on each part. From the example: >>> poly = (-13.39, 0.0, 17.5, 3.0, 1.0) # x4 + 3.0x3 + 17.5x2 - 13.39 >>> print compute_deriv(poly) # 4.0x3 + 9.0x2 + 35.0x (0.0, 35.0, 9.0, 4.0) You can see that the poly: \(x^4 + 3.0x^3 + 17.5x^2 - 13.39[x^0]\) is input in reverse order: poly = (-13.39, 0.0, 17.5, 3.0, 1.0) <-- See how the -13.39 moves from being last to being first.
Thanks e.mccormick I'm sure you're reply must be very helpful although I'm not sure we're talking about the same question. The problem I mentioned goes like this: "Theorem: If it is possible to buy x, x+1,…, x+5 sets of McNuggets, for some x, then it is possible to buy any number of McNuggets >= x, given that McNuggets come in 6, 9 and 20 packs. Problem 2: Explain, in English, why this theorem is true." Never mind anyway, I figured it out already, and it happened to be much easier than I thought initially, as most problems. Thank you once again, and I'm sorry for not making myself clear about the question I was having trouble with. You're answer will certainly help me solving the question you mentioned.
I probably opened up the wrong year or class.
Join our real-time social learning platform and learn together with your friends!