View Single Post
Unread 03-23-2006, 11:13 PM   #15
Long Haired Git
Cooling Savant
 
Long Haired Git's Avatar
 
Join Date: Jan 2003
Location: Sydney, Oz
Posts: 336
Default Re: Units Converter & Equation Solver

Wow, Lagrange is both awesome and scary.
Bugger me dead if it calculates a line straight through every point I supply, and does it in milliseconds. I'll host a lagrange version of my equation finder soon.

Its also unusable.

See, if we look at the PQ graph of the MCR220QP (its over at swiftech, but we all know the y = a.x.x.x + b.x.x + c.x shape where it passes through 0,0) then the formulae I get with my tool is:
y = 0.011115909951571587 . x^3 + 0.006326165221453601 . x^2
which I round to
y = 0.111 . x^3 + 0.0063 . x^2

This scores a "sum of the squares" difference of 0.0562 with the largest error at a known point being 0.03 mH20.

When I plug the same values into lagrange then it spits out:

-1.9158683767169433E-6 . x^7 + 9.144334308297495E-5 . x^6 + -0.0017305525312195573 . x^5 + 0.016418986110316565 . x^4 + -0.08073720151954691 . x ^ 3 + 0.19907864466310282 . x^ 2 + -0.14167268064530752 . x

It has a sum-of-squares score of zero because it hits every one of the points on my graph dead on.

BUT

Outside the points on my graph, and between the points on my graph near zero, it all goes horribly wrong. The above formulae gets a head of -0.03 mH20 at 0.5 LPM. Worse still, after reaching a peak around 13 LPM, the graph goes nutsoid and plummets to a head of -6 mH20 at 17 LPM.

Lastly, because the forumlaue is so complex, it cannot be "tweaked" at all. The combination of +ve and -ve coefficients and super-large powers means tweaking it makes very large uncontrollable differences. So I can't simplify it to make it quicker to calculate, I can only cut and paste.

I suppose I could force my approximator to only use values between the two extremese of known points, and I could supply a lot of points in order to prevent issues like the 0.5 LPM abberation above. However, more points result in higher powers and massively long formulae and very long execution times for my approximator.

So, suprisingly, equation finder stands up to lagrange and wins.....
__________________
Long Haired Git
"Securing an environment of Windows platforms from abuse - external or internal - is akin to trying to install sprinklers in a fireworks factory where smoking on the job is permitted." (Prof. Gene Spafford)
My Rig, in all its glory, can be seen best here
AMD XP1600 @ 1530 Mhz | Soyo Dragon + | 256 Mb PC2700 DDRAM | 2 x 40 Gb 7200rpm in Raid-0 | Maze 2, eheim 1250, dual heater cores! | Full specifications (PCDB)

Long Haired Git is offline   Reply With Quote