Hello.
I recently downloaded commons math liubrary for java and added it to processing. I can import it fine, but when I try writing code the NullPointerException error is sent.
I tried creating a simple complex function:
float g(float x){
float output = 0;
output = sin(x * (3 / PI));
return output;
}
Complex[] g_hat(float t_start, float t_stop, float t_step){
float duration = (t_stop - t_start) / t_step;
Complex output[] = new Complex[(int)duration];
for(float t = t_start; t < t_stop; t += t_step){
Complex exponent = Complex.I.multiply(-TWO_PI * (1 / 3) * t);
Complex val = exponent.exp().multiply(g(t));
output[int((t * t_step) - t_start)] = val;
}
return output;
}
this should make a “wrapped” version of g(x) around the origin of the complex plane. when I call the function everything is fine:
Complex[] data_points;
data_points = g_hat(0, 10, 1);
but after that:
print((float)data_points[9].getReal());
is… also ok. The problem is that I want the third input (in this case 1) to be a decimal, e.g 0.1. but when I do that the print line throws an exception… The window is not responding and after I manually stop the process I get in the log:
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help ? Troubleshooting.
What can I do?
Thanks in advance for any help, Arad.