FlatFootFox

Euler's Method

July 15, 2010 at 10:37am
0 Comments
tagged: , and

I'm taking DiffEq right now (if you hadn't noticed from two posts ago), and we recently learned Euler's Method. It's one of those long tedious estimation methods which takes so long that they only give you 6 problems of homework for it. Rather than going insane typing a recursive, Big O O(2^n) efficient formula into my TI-98, I just wrote a C++ program to do it. Maybe someone will find it useful.

/******************
* Stuart Jones *
* 07 / 15 / 10 *
* Euler's Method *
******************/

#include <iostream>
#include <math.h>
using namespace std;

//fxy represents the f(x,y) function.
double fxy(double x, double y) {
return x*pow(y,2) - (y/x);
}

//Computes the Euler Method N times.
double euler(double x0, double y0, double h, int n) {
double x = x0;
double y = y0;

for(int i = 0; i < n; i++) {
cout << "y" << i << " = y(" << x0 << " + " << i << "(" << h << ")) = y(" << x0+(i*h) << ") = " << y << endl; // Prints out reach recursive step of the method.
y = y + (h*fxy(x,y));
x = x + h;
}

return y;
}

int main() {
double x0 = 1; // Initial value of X.
double y0 = 1; // Initial value of Y.
double h = 0.05; // The h "step" value.
int n = 11; // How many times Euler's Method should be applied.

euler(x0, y0, h, n);

return 0;
}

The output should look something along the lines of:

Sample Output to Problem #9:

h = 0.1 (n = 6)

y0 = y(1 + 0(0.1)) = y(1) = 1
y1 = y(1 + 1(0.1)) = y(1.1) = 1
y2 = y(1 + 2(0.1)) = y(1.2) = 1.01909
y3 = y(1 + 3(0.1)) = y(1.3) = 1.05879
y4 = y(1 + 4(0.1)) = y(1.4) = 1.12308
y5 = y(1 + 5(0.1)) = y(1.5) = 1.21945

h = 0.05 (n = 11)

y0 = y(1 + 0(0.05)) = y(1) = 1
y1 = y(1 + 1(0.05)) = y(1.05) = 1
y2 = y(1 + 2(0.05)) = y(1.1) = 1.00488
y3 = y(1 + 3(0.05)) = y(1.15) = 1.01474
y4 = y(1 + 4(0.05)) = y(1.2) = 1.02983
y5 = y(1 + 5(0.05)) = y(1.25) = 1.05055
y6 = y(1 + 6(0.05)) = y(1.3) = 1.07751
y7 = y(1 + 7(0.05)) = y(1.35) = 1.11154
y8 = y(1 + 8(0.05)) = y(1.4) = 1.15377
y9 = y(1 + 9(0.05)) = y(1.45) = 1.20574
y10 = y(1 + 10(0.05)) = y(1.5) = 1.26957

You can download the source code here: euler.cpp

Finally Found a Use For the iPhone's Front Facing Camera

July 15, 2010 at 9:13am
1 Comment
tagged: and

Glasses shopping! :D


Glasses.png

Differential Equations Notes

July 6, 2010 at 11:10pm
0 Comments
tagged:

I'm taking DiffEq this summer, and have started posting my notes online. They're right over there on the left side of this site.

<-------- Right over there.

So Yeah

June 24, 2010 at 9:38pm
0 Comments
tagged:

This Happened.

IMG_0009.JPG

IMG_0010.jpg

IMG_0011.JPG

But at least I got a phone out of it... seven hours later.

iOS 4 Podcast Download Limit

June 22, 2010 at 10:46pm
0 Comments
tagged:

Much to my delight, I discovered this afternoon by accident that iOS 4 no longer has a 10mb limit on how large a podcast can be downloaded over 3G.  I often find myself downloading Buzz Out Loud or Tech News Today on my way home from school, so being able to do it over 3G is a huge plus.  Of course, with the new data plans it could cost you a pretty penny, but it's nice not having arbitrary limits put on my phone.

 

Oh...  Right...  That whole Flash thing.

IMG_0007.png

A New Blog

June 19, 2010 at 11:37pm
1 Comment
tagged:

So here I am once again. It seems every few months, I notice my blog is lagging and I scrap it, only to launch it with a new blog engine, and a new theme. This time around, I had the convenient of needing my server for a school project. I got an A on it, whoop! However, now I'm faced with the task of once again launching FlatFootFox.com

This time around, I'm using the blog engine Habari. It's a relatively new engine, created from disenfranchised WordPress users. Due to it's young age, it's designed quote unquote "from the ground up" to take advantage of coding technologies and practices which the older legacy platforms aren't able to take advantage of for one reason or another.

This is a change from my pervious blogging engine, Chyrp. Chyrp was a brand new engine, designed to be a shelf hosted version of Tumblr. It was perhaps a little too new, because it is unfortunately now an orphaned project. It was fun while it lasted, but I feel it's time to move on.

Hopefully Habari will fulfill my limited needs. I know I say this every time I launch a blog... But I'm going to try and blog a little more than last time. Who knows, you might even see a few long form pieces this time around.

I might as well commit to an article or two now. Stay tuned for my thoughts on the HP TM2 Tablet, and the Arduino Microcontroller.

 1