/*
OLEG POLYAKOV | PRINCETON UNIVERSITY | 2008-2013
This program calculates the magentic field from a needle like probe.
It also calculates the force that it applies to a paramagnetic bead.

*/

#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;


int main()
{
	cout << "Hello World." << endl;


	double pi = 3.14159265358979;
	double tmp = 0; 
	ofstream* file = new ofstream("INT_VALUES.m");

	cout << "Hello World." << endl;


	(*file) << "INT = [";
	int N_int = 1000, N_par = 100000;
	for (int i=0;i<N_par-1;i++){
		
		for (int j=0;j<N_int;j++){
			tmp += sin(j*2*pi/N_int)/pow((1 - (i/N_par)*sin(j*2*pi/N_int)), 3/2);//^(3/2);
		}
		(*file) << tmp/N_par << ' ';tmp = 0;
		for (int j=0;j<N_int;j++){
			tmp += 1/pow((1 - (i/N_par)*sin(j*2*pi/N_int)), 3/2);//^(3/2);
		}
		(*file) << tmp/N_par << ';'<<endl;

	}
	(*file) << '];'<<endl;

	file->close();
	delete file;





	
	return 0;
}
