So i've been writing this code (I'm a bit of a newbie at this so bear with me) that is supposed to calculate what's called a scattering amplitude. I want to store each calculated value into an array (something I am a bit unsure how to do but have some code that I think should do it)
The current issue however is that I have an error associated with one of my computation steps. I get the error:
"error: 4.3324...(a lot of numbers) e-49 cannot be used as a function" on line 71 of my code.
#include <iostream>
#include <ctime>
#include<cmath>
#include <new>
usingnamespace std;
#define m1 10 //wimp mass in GeV/c^2
#define m2 73 // germanium nucleus mass in GeV/c^2
#define u 91 // z boson mass in GeV/c^2 this is the mediating particle
#define g 2.00976e-22 // coupling constant in GeV*m
#define h 6.58211899e-25 // plancks constant h-bar in GeV*s
int main ()
{
//number of iterations for algorithim or "data points" in the simulated experiment
longint n_iter, i;
//p_initial is momentum of neutralino
float p_initial;
//q is momentum transfer to germanium nucleus
//E_observed is a calculated quantity for the "observed" phonon energy in a germanium detector
// which will be taken to be related to the magnitude of q by E= q^2/2m where m is the mass of germanium nucleus
//scale is the random float from 0..1 that defines the observed energy. note |q|<= |p_initial|
//f_theta is the calculated scattering amplitude
double scale,E_observed,q,f_theta,E_neutralino,diffcross,cross_section;
//Here we will declare f_array which will contain a list of scattering amplitudes (uses pointer?)
int * f_array;
//user sets number of calculations of scattering amplitude
cout<<"How many data points would you like to use to calculate the scattering amplitude? \n";
cin>>n_iter;
//user defines an incident momentum
cout << "What is the incident momentum of the neutralino? \n";
cin>> p_initial;
//resize array to match user data set input for n_iter (number of data points that the program will compute)
f_array= new (nothrow) int[n_iter];
//seed random number generator
srand(time(NULL));
if(f_array==0)
cout<<"Error no data points could be computed";
else
{
for(i=0; i<n_iter; i++)
{
//creates a random float between 0..1 for every trail
scale=float(rand())/float(RAND_MAX);
cout<<"scale is: " << scale << "\n";
//calculates energy of neutralino based on user input for momentum
E_neutralino=((p_initial*p_initial)/(2*m1));
//creates an observed phonon energy based on the energy of the neutralino, Note E_observed<=E_neutralino
E_observed=(scale*(E_neutralino));
cout<<"The observed energy: " << E_observed<< "\n";
//calculate momentum transfer to Germanium
q=sqrt((2*m2*E_observed));
cout<<"q is: " << q << "\n";
//calculate scattering amplitude formula derived on poster or in paper
f_theta=((2*m1*g)/((h*h)((u*u+q*q))));
cout << "The scattering amplitude was calculated to be:" << f_theta<<" \n";
//store f_theta into f_array so that it can be remembered by the computer and called after for loop
//should put each iteration as the next element in the array e.g. i=0 run puts f_theta in f_array[0]
f_array[i]=f_theta;
}
//calculate the differential cross section
}
}