Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need large amount of help for C Programming classwork
#11
Sivrat Wrote:ok, got the chart working right, now just to do the part of the 3 options (will die, stay steady, grow without bounds). How do i do that? Thinking that fiel's psuedocode before was made to determine if last output was lower then first, or if its same or if its higher, but i can't think of how to do that.

You got to prove why your answers, or at least I would do so.

[Image: gif.latex?f(n)%20=%20\left\%7B\begin%7Bmatri...ix%7D\right.]

That's the basic. Let's expand it to see the pattern:

[Image: gif.latex?\\%20f(n)%20=%20bf(n%20-%201)%...0%7D%5E%7B2%7Ddb%5Ek]

This expands into the following:
[Image: gif.latex?f(n)%20=%20b%5E%7Bn-1%7Df(n%20-%20n%...0-%202%7Db%5Ek]

Which is equal to

[Image: gif.latex?f(n)%20=%20b%5E%7Bn-1%7Dc_1%20-%20d\...0-%202%7Db%5Ek]

Now, looking at the last part, a finite geometric series can be rewritten as the following:

[Image: gif.latex?d\sum_%7Bk=%200%7D%5E%7Bn%20-%202%7Db%5Ek%...)%7D%7Bb-%201%7D]

Thus, you can rewrite the recursive function into this function instead:

[Image: gif.latex?f(n)%20=%20c_1b%5E%7Bn-1%7D%20-%20\f...b%20-%201%7D]

Now, we can answer your question way easier:

Stay steady means that the derivative will equal to 0:

[Image: gif.latex?\\f(n)%20=%20c_1b%5E%7Bn-1%7D%20+%20...b%7D%7Bb-%201%7D]

Gotten the derivative. The derivative is 0:

[Image: gif.latex?\\%20%7Bf(n)%7D%27%20=%20c_1b%5E%7Bn-1...01%7D%20\\\\]

So as long the equation above holds, then for all n, f(n)' equals 0. Therefore, the amount of bacterias will live in a steady state for all n: The amount of bacterias will always be the same (c1).

That also means that if the amount of bacterias increase, the derivative is positive. But since we've already found out that the derivative is 0 only when the equation above holds, then the derivative will always be positive, and the amount of bacterias will increase forever.

Same yields if the population decreases: The derivative is negative. But the derivative can't be zero, and the derivative has to be continous. Therefore, the derivative will always be negative, and if the amount of bacterias decrease, the derivative is zero, and the bacterias will after a given amount of time (f(n) = 0 solves that question) die out.

Sorry to interrupt a programming-code-discussion like that, but it was an interesting question, so I analyzed it. Stunned

Edit: There's no reason for anyone to make an array for this. That would be overkill and unneeded. Just use numBact = growthRate * numBact - numBactDie; as you mentioned and make a check on the end like this:

Code:
int numBact2 = growthRate * numBact - numBactDie;
if (numBact2 < numBact)
  printf("The bacterias will eventually die out");
else if (numBact2 > numBact)
  printf("The bacterias will grow without bound.");
else
  printf("The bacterias will live in a steady state forever.");

And provide them with the upper information if you feel they're saying that you don't prove it completely.

Noah
Reply


Messages In This Thread
Need large amount of help for C Programming classwork - by Noah - 2009-09-26, 06:21 AM

Forum Jump:


Users browsing this thread: