-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDerive-integrator-backup.cs
50 lines (36 loc) · 1.1 KB
/
Derive-integrator-backup.cs
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
using UnityEngine;
using System.Collections;
using System.IO;
using System.Xml;
using System.Net;
////the following code is used to to access wolfram alpha API to differentiate a user inputed function then gaph it
//1st :get userinput for a function to derive , or get it from our pre-loaded graphs
//var myXML = wolfram API output string download
public class Differentiator : MonoBehaviour {
//remove white space from user input
private static string RemoveWhiteSpace(string input ){
string result = "";
int l= input.Length;
int b=0;
for (int i=0; i<l; ++i){
if (input[i]!=' '){
result[b] = input[i];
++i;
++b;
} else {
++i;
}
}
}
string equation = "http://api.wolframalpha.com/v2/query?input=derivativeof"+input+"&appid=PG9HJR-4G89HAHLUH&output=xml";
string url = equation;
IEnumerator Start() {
WWW www = new WWW(url);
yield return www;
var myXML = www.data;
//df = parsed output from API xml
}
//Derived function used to return value for mapping on graph
public float Deriver () {
return //df, eg: 5*x*x+c }
}