Solving Toroid: Monte-Carlo Method Homework

  • Thread starter unscientific
  • Start date
  • Tags
    Method
In summary, the student attempted to solve the homework statement by finding the mass and centre of mass of a toroid, then finding the centre of mass of the sample points. They found that the centre of mass is mixx and that the number of sets of points needed to sum up the volume is related to the number of partitions the volume is split into.
  • #1
unscientific
1,734
13

Homework Statement



Hi everyone, I'm supposed to find the mass, centre of mass and moment of inertia of a toroid. The basic idea I have is:

a)Take a sample of N set of points (x,y,z)
b)Assign a value of 1 to each correct set of (x,y,z) that lie in the toroid (by seeing whether it satisfies the equation)
c)Sum up all the number of correct sets
d)Ratio R is defined as the sum/N
e)Volume of shape is R*(volume of region, which is usually a box)

Assuming p = 1 as in the question, I've managed to find the mass and centre of mass.

2im4553.png


The Attempt at a Solution



The centre of mass Ixx is defined as mixx. I basically found the mass by simply finding the volume of the shape * 1 as ρ = constant = 1. For the centre of mass, I took the Ʃ(xcorrect * 1)/(number of correct sets) which simply gives the average x..

But for mixx i have this idea:
1. The number of sets of Ʃ(y^2 + z^2) you can take before you finish summing up the entire volume depends on how many partitions the volume is split up into.
2. Thus the number of sets taken is simply the number of partitions = Volume/number of correct sets

This gives a value for mixx to be around 82, miyy 140, mizz, 210

Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()

{

	int i=1;
	double x;
	double y;
	double z;
	int s;
	double p;
	double v;
	double cmx1;
	double cmx2;
	double cmy1;
	double cmy2;
	double cmz1;
	double cmz2;
	double mixx1;
	double mixx2;
	
	srand48(time(NULL));
	
	while (i<=100000)
		
	{
		x = 1 + 3 * (drand48());
		
		y = 4 - 7 * (drand48());
		
		z = 1 - 2 * (drand48());
		
		if ( x*x + y*y + z*z - 6*sqrt(x*x + y*y) <= -8)
		{s = 1;}
		else 
		{s = 0;}
		
		
		
		p = p + s;
		
		v = (p/i)*42;
		
		cmx1 = cmx1 + x*s;
		cmy1 = cmy1 + y*s;
		cmz1 = cmz1 + z*s;
		
		cmx2 = cmx1/p;
		cmy2 = cmy1/p;
		cmz2 = cmz1/p;
		
		mixx1 = mixx1 + (pow(y,2) + pow(z,2))*s;
		mixx2 = (mixx1/p)*v;
		
		i++;
		printf("%d \t %.0f \t %f \t %f \t %f \t %f \t %f \t %f\n", s, p, v, cmx2, cmy2, cmz2, mixx1, mixx2);
		
	}
	
}
 
Last edited:
Physics news on Phys.org
  • #2
bumpp?
 
  • #3
Nevermind, problem solved!
 

1. What is the Monte-Carlo method and how is it used to solve toroid problems?

The Monte-Carlo method is a computational technique that uses random sampling to solve problems that involve complex mathematical equations or simulations. In the context of solving toroid problems, the Monte-Carlo method uses random sampling of points to estimate the volume and other properties of the toroid shape.

2. What are the advantages of using the Monte-Carlo method for solving toroid problems?

One of the main advantages of using the Monte-Carlo method for solving toroid problems is that it is a versatile and efficient method that can handle complex shapes and equations. It also provides accurate results and can be easily implemented using computer programs.

3. What are the limitations of the Monte-Carlo method in solving toroid problems?

The Monte-Carlo method relies on random sampling, which means that it may not always provide accurate results. Additionally, it can be computationally expensive and time-consuming for problems with high dimensions or a large number of variables.

4. How does the Monte-Carlo method compare to other numerical methods in solving toroid problems?

The Monte-Carlo method is often preferred over other numerical methods for solving toroid problems because it can handle complex shapes and equations more efficiently. Other numerical methods may require simplifying assumptions or may not be suitable for certain types of problems.

5. Can the Monte-Carlo method be used for solving other types of scientific problems?

Yes, the Monte-Carlo method is a widely used technique in various scientific fields, including physics, engineering, and finance. It can be applied to solve problems that involve probability, statistics, and simulation, among others.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Programming and Computer Science
Replies
1
Views
750
  • Engineering and Comp Sci Homework Help
Replies
6
Views
860
  • Programming and Computer Science
Replies
1
Views
646
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
7
Views
557
Back
Top