jeudi 12 octobre 2017

invalid operands of types ‘double’ and ‘double’ to binary ‘operator^’ [duplicate]

This question already has an answer here:

How can I solve below error? I have defined most of the parameters as double but the error still exists. It says that: error: invalid operands of types ‘double’ and ‘double’ to binary ‘operator^’

#include <iostream>
#include <vector>
#include <random>
#include <functional>
#include <math.h> 
using namespace std;
double randnum (double a, double b)
{
static std::default_random_engine generator;
std::uniform_real_distribution<double> distribution (a,b);
return distribution(generator);
}

int main() {

double b=50.0;
double a=1.0;
const int np=(b-a)*10;
double umin =0;
double umax=1;
double u[np];

srand((unsigned)time(0)); 

int time_point=100;
int particles=10;
double r [time_point][particles]; 
double P [490];
double t [490];
double dr [490];
double alph = 2;               //parameter of dt distribution
double B = (1-alph)/(b^(1-alph)-a^(1-alph));
if(alph < 1.01 && alph > 0.99)
B=1/(log(b)*b^(1-alph)-log(a)*a^(1-alph));    

for(int i=0;i<(b-a)*10;i++)
{
  u[i]=randnum(umin,umax);
   dr[i]= (a^(1-alph)+ u[i]*(1-alph)/B)^(1/(1-alph));
}
}

Aucun commentaire:

Enregistrer un commentaire