Forum

> > Off Topic > Do you have what it takes to be a Programmer?
ForenübersichtOff Topic-ÜbersichtEinloggen, um zu antworten

Englisch Do you have what it takes to be a Programmer?

40 Antworten
Seite
Zum Anfang Vorherige 1 2 3 Nächste Zum Anfang

alt Do you have what it takes to be a Programmer?

Lee
Moderator Off Offline

Zitieren
Do you have what it takes to be a programmer?

Note: This has nothing to do with programming, but it does contain several concepts that are crucial to the development of a style of rationalization that is essential to anyone interested in computer science.

This is a numerical mathematics challenge. You can use any tool available to you to solve the problems. The problems will come in sets that are related. After one person solves the current problem, I will post the next problem.

Problem 2.7.10

When viruses enter the somatic cells of a organism, they begin to rapidly replicate. In one particular instance, the number of viruses within an organism will double every four hours. Assuming that this is true for all cases, if 10,000 viral particles infect an organism, how long will it take for the number of viral particles to reach 1,000,000,000,000 (10^12)?

alt Re: Do you have what it takes to be a Programmer?

Flacko
User Off Offline

Zitieren
Yeah, I think the hours it will take will be about 104.
Edit: According to a program I just wrote it takes between 104 and 108 hours
Spoiler >
2× editiert, zuletzt 08.02.10 17:08:59

alt Re: Do you have what it takes to be a Programmer?

DoP3
User Off Offline

Zitieren
It will take it about 112 hours.>that's an estimation, i think it's a teeny bit less.
let me get the precise calculation in a few minutes.

I used Ms calculator ;P
3× editiert, zuletzt 08.02.10 17:21:03

alt Re: Do you have what it takes to be a Programmer?

Lee
Moderator Off Offline

Zitieren
It's technically a little bit less than 108. The correct solution is

4*8ln(10)/ln(2) =~= 106 Hours

Problem 2.8.10

After the immune system kicks in, the virus grows by 160% every four hours. At the same time, 50,000 viral particles are eliminated per hour.

Once the number of viral particles within the organism's body exceed 10^12 individuals, the organism dies. Calculate how long it will take for an organism infected with 10,000 viral particles to die. (Use the methodology from the previous problem to solve for the time it takes to reach 1 million particles)

alt Re: Do you have what it takes to be a Programmer?

SQ
Moderator Off Offline

Zitieren
Oh man, I'm too late

leegao hat geschrieben
4*8ln(10)/ln(2) =~= 106 Hours

Why does this prints 108 then? I thought that's right
Edit: Got the problem, it gets more than 10^12 in my script.
Code:
Spoiler >


-- Second Question
I don't understand second one very well, because of these:
Starting with 10000 viral particles, right?

Zitat
the virus grows by 160% every four hours.
But
Zitat
50,000 viral particles are eliminated per hour.

50000 viral particles are eliminated, that's confusing me.
1× editiert, zuletzt 08.02.10 20:00:23

alt Re: Do you have what it takes to be a Programmer?

PlayerNoob
User Off Offline

Zitieren
leegao hat geschrieben
4*8ln(10)/ln(2) =~= 106 Hours


Hmmm, tough question.
Time to make it simple!

4*8(10)/2 = 160 hours

Maybe this is why I'm not a programmer.


Spoiler >

alt Re: Do you have what it takes to be a Programmer?

SQ
Moderator Off Offline

Zitieren
The problem I mentioned before was:
10000 - 50000 = - 40000
The answer would be: there is no answer, but that's wrong I guess.

Haven't you noticed it in your script? Your script doesn't look like idea of solution thought.
Probably I just can't understand Problem very well.

alt Re: Do you have what it takes to be a Programmer?

Flacko
User Off Offline

Zitieren
I understood the same thing as blazzingxx did.
10,000 viral particles grow 40% per hour, but at the same time 50,000 of them die because of the inmune system.
10,000 + 4,000 - 50,000 = -36,000
They'd last about 15 minutes in the organism before they all die...
1× editiert, zuletzt 09.02.10 18:30:10

alt Re: Do you have what it takes to be a Programmer?

sonnenschein
User Off Offline

Zitieren
Flacko hat geschrieben
I understood the same thing as blazzingxx did.
10,000 viral particles grow 40% per hour, but at the same time 50,000 of them die because of the inmune system.
10,000 + 4,000 - 50,000 = -36,000
They'd last about 15 minutes in the organism before they all die...

Awww, didn't read it again, my fault...

alt Re: Do you have what it takes to be a Programmer?

Lee
Moderator Off Offline

Zitieren
Remember that the problem revolves around recursive growth.

I'll simplify it a bit:

There are currently 1,000,000 viruses within your body. The viruses grow 160% every 4 hours. At the same time, 50,000 viruses are eliminated. How long will it take for number of viruses to reach 10^12.

Hint: Try using a spreadsheet first.

alt Re: Do you have what it takes to be a Programmer?

YellowBanana
BANNED Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
val = 100
set = false
years = 0
while(set == false) do
	years = years+1
	val = val * 1.6 - 5
	if(val > 1e+8) then
		print(years*4)
		set = true
	end
end

divide all numbers by 1e4.
recursion.

now gimme something challenging pls.

alt Re: Do you have what it takes to be a Programmer?

Psytechnic
User Off Offline

Zitieren
leegao hat geschrieben
Remember that the problem revolves around recursive growth.

I'll simplify it a bit:

There are currently 1,000,000 viruses within your body. The viruses grow 160% every 4 hours. At the same time, 50,000 viruses are eliminated. How long will it take for number of viruses to reach 10^12.

Hint: Try using a spreadsheet first.


Hmmm, one question, during the 4th hour change, does the 50,000 virii get removed before the Extra 60% is added on or after. The reason I ask is that it will give 2 different results if the order is changed.

Edit: Here's my script. I checked putting the removal of 50,000 before and after the addition of 60% and got the same result both times.

C# Program Code
Spoiler >

Hours = 120
I used Calc on scientific setting to work out 10^12... I'm lazy like that.

Also, in your 2.7.10 problem, there is a simple mathematical constant which suggests to users that the answer must be a factor of 4.

Zitat
Problem 2.7.10

When viruses enter the somatic cells of a organism, they begin to rapidly replicate. In one particular instance, the number of viruses within an organism will double every four hours. Assuming that this is true for all cases, if 10,000 viral particles infect an organism, how long will it take for the number of viral particles to reach 1,000,000,000,000 (10^12)?

This means, the virus count only doubles every 4th hour, meaning the check for (!(virusCount < 10^12)) will only return true on a 4th hour, which means the answer has to be either 108 hours if you don't include the initial "0 hour" or 104 if you do. The logarithmic answer that you gave calculates the exact hour at which virusCount goes > 10^12, provided the growth is logarithmic and not uniform. The same result cannot be achieved by setting virus growthto increase by 25% every hour. If you were to do that, the answer would appear to be Hours = 83...

My Code for that problem:
Spoiler >
3× editiert, zuletzt 10.02.10 03:22:05
Zum Anfang Vorherige 1 2 3 Nächste Zum Anfang
Einloggen, um zu antwortenOff Topic-ÜbersichtForenübersicht