function error "cannot use as a function"

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.

the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <iostream>
#include <ctime>
#include<cmath>
#include <new>

using namespace 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
	long int 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
		
	}
}

1
2
3
4
5
6
7
8
f_theta=((2*m1*g)/((h*h)((u*u+q*q))));

//what you want to do with this?
((h*h)((u*u+q*q))

//it seems like
(a)(b)
the piece I'm dividing by is planck's constant squared times quantity mass of z squared plus transferred momentum squared.

What do you mean by (a)(b)? are (a)=(h*h) and (b)=((u*u)+(q*q))?
in line 71 you forgot the operation symbol. ((2*m1*g)/((h*h)[place the symbol here]((u*u+q*q))));

plus the might be too much braces

You can't write ((h*h)(u*u+q*q)) like you can in math. Multiplication won't be automatically implied like this in C++.
Topic archived. No new replies allowed.