Created
July 6, 2015 19:29
-
-
Save victor-shepardson/0c2f772fb80a114f2c89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wolfram Alpha input to get polynomial approximation to function on an interval | |
for example to approximate exp(x) with ax^2 + bx + 1 on [0,1]: | |
solve (partial derivatives wrt a,b of (integral of (exp(x)-(ax^2 +bx+1))^2 from 0 to 1)) for a,b | |
or properly: | |
Solve[ D[ Integrate[ (exp(x)-(ax^2 +bx+1))^2, {x,0,1} ], {{a,b}} ] = 0, {a,b}] | |
for some reason, only the first works in wolfram alpha? but it doesn't generalize to more variables | |
i think it's just a time thing, it appears to stop after the integral. dunno why writing it in mathematica syntax slows things down? | |
in the first one i think it makes a list of the partial derivatives, but in the second it's a vector | |
Solve[ Function[D[ Integrate[ (exp(x)-(ax^2 +bx+1))^2, {x,0,1} ], # ]/@{a,b}] = 0, {a,b}] | |
doesn't work either. in fact, Function[1+#]/@{0,1} doesn't work | |
i guess wolfram alpha just doesn't do everything mathematica does? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment