Hello,
Recently I've been trying to make some programs that use a bit of calculus to make graphs of functions. I don't really know how to use APIs that much, and Processing doesn't seem to have too many resources to figure out how. I scrapped together this to test it out (Replace #### with an app id if you want to test it) :
// github.com/PhiLhoSoft/Processing/blob/master/_QuickExperiments/_Net/GoogleRequest/GoogleRequest.pde
import java.net.*;
String Query = "http://" + "api.wolframalpha.com/v2/query?input=derivative+of+x%5E4&appid=#########";
String[] results;
void setup() {
try {
URL url = new URL(Query);
URLConnection connection = url.openConnection();
results = loadStrings(connection.getInputStream());
}
catch (Exception e) {
e.printStackTrace();
}
printArray(results);
}
The problem is that it takes quite a bit of time to output a request (probably because of the 160 lines of data it gives back), so I'm thinking I'm seriously not using it right since other language's implementation of wolfram's API is so much cleaner and effective, like with Python's. I wonder if there's a better way about getting requests, since I have no idea really what I'm doing.
Thanks!