For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > October 2004 > Method of the least squares









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Method of the least squares
Roman

2004-10-22, 3:55 am

Hi,

I am looking the code for the method of the least squares but non linear.
Does anyone know where can I find it?

Roman


Duane Bozarth

2004-10-22, 3:55 pm

Roman wrote:
>
> Hi,
>
> I am looking the code for the method of the least squares but non linear.
> Does anyone know where can I find it?


Does it have to be Basic? I have no idea for that although I'm sure
somebody will have implemented--oh, wait a minute, I <have> an
implementation of Marquardt's algorithm...it'll take some time to dig it
up but I could possibly post it...

There's a printed implementation in Fortran that wouldn't be too hard to
translate in Data Reduction and Error Analysis for the Physical Sciences
by Philip R Bevington, McGraw-Hill where I first learned it (and many
other useful things many years ago..)

Other than that, www.netlib.org is where I would go...
Duane Bozarth

2004-10-22, 3:55 pm

Duane Bozarth wrote:
>

I looked at that routine...w/ the supporting matrix inversion routine,
etc., it's probably too large to post plus the version I have is so
specific to the particular implementation (it was an online coal
analyzer) I'd have to mung on it a fair amount to make it usable outside
that environment...post back if you do want it w/ a way to forward it to
you and I'll try to make enough changes to at least get it independent.

It, btw, uses a modification of the published algorithm that allows for
a combination of linear least squares estimation for any parameters of
the model that can be separated from the nonlinear ones although it is
still usable w/ no linear terms. Overall, it's a useful modification
for some problems (we were fitting a gaussian photopeak and a polynomial
background)...
Duane Bozarth

2004-10-22, 3:55 pm

Roman wrote:
>
> Hi,
>
> I am looking the code for the method of the least squares but non linear.
> Does anyone know where can I find it?
>
> Roman


http://netlib3.cs.utk.edu/cgi-bin/s...ery=gams/K1b%2A

Fortran source, of course, not VB, but <possible> to translate although
I'd recommend making whatever you use into a dll (unless, of course, you
do find something actually written in VB or another library/dll).

One advantage, btw, of Fortran w/VB is that array storage is
column-major in both so processing is in linear order more easily than
w/C which can speed algorithms significantly.
David Youngblood

2004-10-22, 3:55 pm

"Roman" <proman@go2.pl> wrote
> I am looking the code for the method of the least squares but non linear.
> Does anyone know where can I find it?


You might try Visual Basic Graphics Programming, Rod Stephens, ISBN
0-471-35599-2.

It has some procedures for Linear, Quadratic and Higher-Order Least Squares as
well as some parametric curve fitting routines, Hermite, Bezier and B-Splines.

David


mscir

2004-10-31, 3:55 pm

Roman wrote:

> Hi,
>
> I am looking the code for the method of the least squares but non linear.
> Does anyone know where can I find it?
>
> Roman


Did you try Planet Source Code, there are several hits but I don't know
if they'll do the non-linear solving you want (my math doesn't go that far).

http://www.planetsourcecode.com/vb/...rt=Alphabetical
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com