Wednesday, 28 September 2011

UPDATE: why I'm annoyed by D1.

Okay, so I'm sitting a Decision module, which is, y'know, fine. And there are some questions I'm doing, Misc. Ex. 1, question 8 especially, seems to involve almost exclusively labourious number crunching. So I did this, in C++...


#include <iostream>
#include <math.h>

using namespace std;

int main() {
double C = 0.5*sqrt(3);
double S = 3;
double T = 2*sqrt(3);
double D = 2*sqrt(3) - 3;

while (D > 0.01) {

C = sqrt((1+C)/2);
S = S/C;
T = S/C;
D = T-S;

cout << D << "\n";
}

if (D<0.01) {
cout << D;
cin.get();
return (0);
}
}


... which gives me the answers to some needless level of accuracy (8 d.p.) so that's that done.

Except now I'm not revising. And, as far as I'm aware, I'm not allowed a compiler in the exam. Which is obviously stupid. I should be.

Anyway, it's annoyed me, and is therefore worth blogging about.

No comments:

Post a Comment