posted 13 years ago

Hi All,

I'm working on an assignment that wants me to write a program that will compute the following summation series using rational class:

1/1 + 1/2 + 1/3 + ...+ 1/n

1/1 + 1/2 + 1/2e2 +...+ 1/2en

Now I'm working on the first part and I think I've got that kinda figured out, but now I need help on the second part. I've never worked with exponents before so I'm not too sure where to go from here.

My code is as follows:

Thanks in advance for the help

Stacey

I'm working on an assignment that wants me to write a program that will compute the following summation series using rational class:

1/1 + 1/2 + 1/3 + ...+ 1/n

1/1 + 1/2 + 1/2e2 +...+ 1/2en

Now I'm working on the first part and I think I've got that kinda figured out, but now I need help on the second part. I've never worked with exponents before so I'm not too sure where to go from here.

My code is as follows:

Thanks in advance for the help

Stacey

posted 13 years ago

Well, 2e2 is 2 * (10 ^ 2). So the second series you gave looks to me like this:

1/1 + 1/2 + 1/200 + 1/2000 + 1/20000 + ...

Is that your intention? The first two terms don't fit with the remainder (1/2 and 1/20 would fit better with the rest of the series). The first two terms make me think you're going to go

1/2 + 1/2 + 1/4 + 1/8 + 1/16 + ...

Either way, with the rational class you've got, it's just a case of working out what series of fractions you want, and adding them as you did in the code you posted. Post back and people will help you with this if you need it.

Cheers,

--Tim

[ April 15, 2004: Message edited by: Tim West ]

1/1 + 1/2 + 1/200 + 1/2000 + 1/20000 + ...

Is that your intention? The first two terms don't fit with the remainder (1/2 and 1/20 would fit better with the rest of the series). The first two terms make me think you're going to go

1/2 + 1/2 + 1/4 + 1/8 + 1/16 + ...

Either way, with the rational class you've got, it's just a case of working out what series of fractions you want, and adding them as you did in the code you posted. Post back and people will help you with this if you need it.

Cheers,

--Tim

[ April 15, 2004: Message edited by: Tim West ]

Stacey Johnson

Ranch Hand

Posts: 55

posted 13 years ago

In response to Tim's post, my intention for the second part is to go

1/1 + 1/2 + 1/2e2 + 1/2e3 + 1/2e4 +...+1/2en

"n" being my choice of what I want to stop it at.

What is throwing me off is that I start with 1/1 + 1/2 and then I go into the exponents of 1/2e2 etc.. This is where I don't know how to go about it.

So if anyone can help, I would appreciate it.

Thanks in advance

Stacey

1/1 + 1/2 + 1/2e2 + 1/2e3 + 1/2e4 +...+1/2en

"n" being my choice of what I want to stop it at.

What is throwing me off is that I start with 1/1 + 1/2 and then I go into the exponents of 1/2e2 etc.. This is where I don't know how to go about it.

So if anyone can help, I would appreciate it.

Thanks in advance

Stacey

posted 13 years ago

Stacey,

1/1 is the same as 1/2e0 and 1/2 is the same as 1/2e1, so you can treat them all as exponentiated numbers.

Are you sure that it is 2en (i.e. 2*10^n), and not 2 raised to the power of n (i.e. 2^n)? The former is a strange series, the later is the geometric series where the sum approaches 1 as n approaces infinity.

[ April 16, 2004: Message edited by: Tom Blough ]

1/1 is the same as 1/2e0 and 1/2 is the same as 1/2e1, so you can treat them all as exponentiated numbers.

Are you sure that it is 2en (i.e. 2*10^n), and not 2 raised to the power of n (i.e. 2^n)? The former is a strange series, the later is the geometric series where the sum approaches 1 as n approaces infinity.

[ April 16, 2004: Message edited by: Tom Blough ]

Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>

Stacey Johnson

Ranch Hand

Posts: 55

posted 13 years ago

Okay,

I'm confused with the exponent and raised to the power questions. I don't get the difference. I see the difference but I don't understand it. What am I missing? I think it would be to the raised power but I don't know. My first message is exactly what the excersise told me to do. So I'm not too sure which way to interpret it.

Stacey

I'm confused with the exponent and raised to the power questions. I don't get the difference. I see the difference but I don't understand it. What am I missing? I think it would be to the raised power but I don't know. My first message is exactly what the excersise told me to do. So I'm not too sure which way to interpret it.

Stacey