Member Avatar

Hi, I recently placed about 3 GB worth of my university files on a USB drive. After a few days, I tried to access the files on the USB. So, I opened the 'My computer' folder, which is when I noticed that the removable drive showed '164 MB of 3.93 GB free' but there was a red bar (instead of blue) that signified the amount of space covered. I found that a little puzzling. Anyway, I opened the USB drive to find that all my folders had become files. There was no symbol (i.e. it was empty) beside the names …

Member Avatar
0
3
Member Avatar

I don't quite understand the motivations behind the different forms of examination systems. For instance, in the UK, the GCSE and A level exams are held nationally by a set of examination boards. However, things are different here in the US. Exams till 12th grade are done locally. What is this the case?

Member Avatar
0
6
Member Avatar

I'm wondering why lecturers at university select the problems they select in the problem sets? I don't understand why those problems have to be selected and not any others.

Member Avatar
0
2
Member Avatar

I am an undergraduate student and. I have been facing a difficulty with my studies for quite some time. I hope you wouldn't mind sparing a few minutes to advise me on this matter. The problem is that whenever I read my lecture notes or a textbook or a labscript, I tend to question every single sentence in every paragraph. Also, I spend a lot of time trying to restructure the notes (by rewriting them again) so that the arguments flow smoothly and so that all the assumptions have been taken into account. This becomes a laborious task. As an …

Member Avatar
0
13
Member Avatar

Let's say you have made a class called threevector which takes stores three doubles. Then you define another class, a fourvector, which stores four doubles. I have seen this syntax used for the constructor of the fourvector: [CODE]fourvector(double fourth, threevector one_two_three): threevector (one_two_three) { fourth = 0.0; }[/CODE] I understand that the fourvector object takes in a double and a threevector as its arguments. But I haven't defined any constructor called threevector (one_two_three) in the threevector class. So what does the compiler do?

Member Avatar
0
5
Member Avatar

Hi, I don't understand the need for the while statement. Any help would be greatly appreciated. [CODE]double michel() { double x, y; do // The loop computes points on the graph of y against x. { x = 53.0*rand()/RAND_MAX; // x is the momentum. x is randomly generated. Min x is 0 MeV/c. Max x is 53 MeV/c. y = x/53.0; // y is the probability distribution function. Min y is 0. Max y is 1. } // y is a triangular distribution. Hence, y = (1/53)*x. while (1.0*rand()/RAND_MAX > y); // Because we want to start with the WHYYYYYYYYYYY???????????? …

Member Avatar
0
3
Member Avatar

Hi, if I run the following code and press L on the screen, I should be getting a leapfrog.txt textfile. But I only see my previous euler.txt. What is wrong with the code. Thanks in advance for any help. [CODE]#include <iostream> #include <fstream> #include <cmath> #include "H:\Visual Studio 2008\Projects\section2\threevector.h" using namespace std; void errors(double, threevector, ofstream&); // Function that calculates the errors // and outputs the results int main() { char determinant; cout << "Press E to use Euler's method or L to use leapfrog method." << endl; cin >> determinant; if (determinant = 'E') // Euler method { ofstream …

Member Avatar
0
7
Member Avatar

Hi, I am getting an error message when using base classes. The error message is x: undeclared identifier y: undeclared identifier z: undeclared identifier The particle class derives from the fourvector class which derives from the threevector class, as follows. [CODE]#ifndef THREEVECTOR_H // Prevents the class being re-defined #define THREEVECTOR_H #include <iostream> // Include input/output stream //#include <fstream> #include <cmath> class threevector { private: double xcoord, ycoord, zcoord; // Private data members double scalar; public: // Default constructor threevector() { xcoord = 0.0; ycoord = 0.0; zcoord = 0.0; } // Cartesian constructor threevector(double x, double y, double z) { …

Member Avatar
0
7
Member Avatar

Any method (within a C++ class) that prints to a file or to a screen has a return type of void. What role does the keyword [I]void[/I] perform?

Member Avatar
0
20
Member Avatar

Compiling the following the class in the main program returns error C2784. What could be causing the problem? [CODE]#include <iostream> // Include input/output stream #include <cmath> class threevector { public: double xcoord, ycoord, zcoord; // Default constructor threevector() { xcoord = 0.0; ycoord = 0.0; zcoord = 0.0; } // Cartesian constructor threevector(double x, double y, double z) { xcoord = x; ycoord = y; zcoord = z; } // Method to print out contents to screen void print() { std::cout << xcoord << '\t' << ycoord << '\t' << zcoord << std::endl; } //Method to print out contents to …

Member Avatar
0
6
Member Avatar

I have seen the following in a abook: "The argument(s) of a method can be any type of object (as long as its class has been made available to the program), as well as the predeļ¬ned default types of variable. For example, methods in our three-vector class are not limited to just accepting arguments of type threevector, int, double, etc." I understand that the first statement is telling us that objects of all classes made available to the program can be used as arguments of a method. What I do not understand, however, is how the second statement follows logically …

Member Avatar
0
2
Member Avatar

Hi, I have to calculate the exponetial of a large (on the order of 10^5) negative number. I tried using exp(), the exponential function from the cmath library, but I get an answer of 0. So, I tried to use the power series for the exponential function. For numbers from -1 to -14, I get answers which are accurate (within the percentage error set in the while statement). But for any number above -14, the answer diverges from the true value. For a number as small as 10^-5, the answer is a large positive number (which is nonsenical). Please help …

Member Avatar
0
13
Member Avatar

Hi, I am doing an undergraduate physics project by writing a C++ code to implement the Metropolis algorithm to a simple 2d one component plasma. In short, I have to determine the equilibrium configuration at each temperature by means of the Metropolis algorithm and then compute ensemble averages (such as heat capacity) over the microstates. I have written the code, but when it comes to interpreting values of the heat capacity, I have no clue what mistakes in the code have lead to the supposedly erroneous values. Does anyone have any clue at all? Please reply. [CODE] // 2d Monte …

Member Avatar
0
3

The End.