p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 (http://p2p.wrox.com/forumdisplay.php?f=400)
-   -   Chapter 4 Exercise 4 (http://p2p.wrox.com/showthread.php?t=76118)

Will September 9th, 2009 04:33 PM

Chapter 4 Exercise 4
 
I thought I was understanding this book pretty well (have been going through the exercises over the past few days without too much trouble) however I have come to this exericse and I am a bit stumped so I looked at the answer.

And i'm confused as I do not think I would have got that answer and I am not sure where this part:

realStep = (realMax - realMin) / 79;
imagStep = (imagMax - imagMin) / 48;

is figured out from?

Could anybody give me a page reference or a link explaining this in more depth to me?

RonGul September 18th, 2009 10:46 AM

Hey Will :)
Nice to see i'm not the only one struggling with this exercise.

I enjoy this book very much so far. I'm pretty noob when it comes to programming c#, but i want to learn from basic to more advanced.

I have to say that this 'try it out', using for loops, on page 85 in the book almost took my breath away.
Its just a bit confusing to understand whats going on there.

My question is if its ok to skip this Mandelbrot example for now, and carry on with the rest of the book?

I understand basics of the for loop, but this was just so confusing.

Will September 18th, 2009 11:08 AM

I figured the answer out but didn't post here as this section of the forum seemed pretty dead.

The part of the solution I was having trouble figuring out comes from:

Code:

for (imagCoord = 1.2; imagCoord >= -1.2; imagCoord -= 0.05)
            {
                for (realCoord = -0.6; realCoord <= 1.77; realCoord += 0.03)

you divide by 79 and 48 as this gives you 0.05 and 0.03.

In the end I coded out the answer and worked through it but I never would of come up with that myself. I just moved on to chapter 5 and refer back to chapter 4 when I need to.

It would be helpful if the answers came with explanations to make things easier to grasp firstime around as although I can understand what it does and how it achieves it, there is no explanation as to why that method was chosen as my solution was completley different and ended up doing the same thing. Most likely not as well but it still worked.


All times are GMT -4. The time now is 01:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.