I am trying to integrate a couple of equations, but the program fails to compile. The error message that appears says: "too many arguments to function pow"
I will show the problematic part of the code and then make two specific questions.
#include <stdio.h>
#include <math.h>
struct Par{
double gamma1, gamma2;
} aa;
void ecuaciones(int n, double v[], double dv[], double t){
dv[0]=v[6] ;
dv[1]=v[7] ;
dv[2]=v[8] ;
dv[3]=v[9] ;
dv[4]=v[10] ;
dv[5]=v[11] ;
dv[6]= aa.gamma1*(v[3]-v[0])*pow( (pow(v[0]-v[3], 2)+pow( v[1]-v[4], 2)+pow( v[2]-v[5], 2)), -1,5) ;
dv[7]= aa.gamma1*(v[4]-v[1])*pow( (pow(v[0]-v[3], 2)+pow( v[1]-v[4], 2)+pow( v[2]-v[5], 2)), -1,5) ;
dv[8]= aa.gamma1*(v[5]-v[2])*pow( (pow(v[0]-v[3], 2)+pow( v[1]-v[4], 2)+pow( v[2]-v[5], 2)), -1,5) ;
dv[9]= -aa.gamma2*(v[3]-v[0])*pow( (pow(v[0]-v[3], 2)+pow( v[1]-v[4], 2)+pow( v[2]-v[5], 2)), -1,5) ;
dv[10]= -aa.gamma2*(v[4]-v[1])*pow( (pow(v[0]-v[3], 2)+pow( v[1]-v[4], 2)+pow( v[2]-v[5], 2)), -1,5) ;
dv[11]= -aa.gamma2*(v[5]-v[2])*pow( (pow(v[0]-v[3], 2)+pow( v[1]-v[4], 2)+pow( v[2]-v[5], 2)), -1,5) ;
So... the problem is in the dv´s from 6 to 11. The questions are the following:
Is it ok to use the "pow" function in this case or is it just defined for constant bases? In case the answer is yes (which im almost sure it is), then the following doubt appears: How can i compose a pow function with another one?
For the sake of clarity, this is what i want to express using a composition of "pow" functions:
Note that there´s at least one way to go around this problem: that is to write the squared terms from the base in the form A*A= A squared instead of using pow. Given the fact that the base could be raised to a non-integer power, my opinion is that the general case solution is still very important.