Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8775411340 for ; Thu, 14 Aug 2014 16:47:54 +0000 (UTC) Received: (qmail 4136 invoked by uid 500); 14 Aug 2014 16:47:53 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 4030 invoked by uid 500); 14 Aug 2014 16:47:53 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 4016 invoked by uid 99); 14 Aug 2014 16:47:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2014 16:47:53 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.227.126.187] (HELO mout.kundenserver.de) (212.227.126.187) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2014 16:47:47 +0000 Received: from [192.168.1.121] (host156-5-static.4-79-b.business.telecomitalia.it [79.4.5.156]) by mrelayeu.kundenserver.de (node=mreue003) with ESMTP (Nemesis) id 0Ly8x7-1WLjOi0PZN-015XPT; Thu, 14 Aug 2014 18:47:25 +0200 Subject: Re: [math] Curve fitting ... References: From: Thomas Vandahl Content-Type: text/plain; charset=utf-8 X-Mailer: iPad Mail (11D257) In-Reply-To: Message-Id: <69315F3F-2346-4B44-B74D-C61E00325F1C@apache.org> Date: Thu, 14 Aug 2014 18:47:24 +0200 To: Commons Users List Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) X-Provags-ID: V02:K0:RZ7kHgyFAGmEip+b1hLwqrCZQOEdOBazMb2m4ybDcF+ JgrDESFyQwbtAfujfj1IKPl844o2xvSmMgJIRdPGqtgo9OGf3c P9p0VmiThZqimxWrsJ40P2w7VxbbUYkquE++PVvBjQUBDLUBKb 0AMnmFVC+hfioKboBWvp+RV5dKRrKcIM+hwajlkM5T/IVpZ7pc uZwbp9G8wWVviXNDY5FwgJgBoDN7vQ3HS24PBUxeWvAMjUvihn X2qKBo0bGiVD6DUHllFuIxE8TUI5jPGeJaHFR/4ZG3yKUJZPYz KQ0WugDugyGBpOmUKU9h+qNU6CYlXJb9B2TN+8CXxBuCWIOhMS 3P2xACoXW/iR0cAkQ9XAxTaL3AkwIBbtQi4SukeElZld6B3rY2 1DHwTUfnbikUg== X-UI-Out-Filterresults: notjunk:1; X-Virus-Checked: Checked by ClamAV on apache.org I take it, you ask for help for doing your homework? Bye, Thomas=20 > Am 14.08.2014 um 15:56 schrieb South Light : >=20 > Hi Ted, >=20 > Thanks a lot for your suggestion but I need to add it using java. >=20 > Thanks > =E2=80=8Bagain=E2=80=8B > .=E2=80=8B >=20 >=20 >=20 > 2014-08-14 2:22 GMT-03:00 Ted Dunning : >=20 >> Have you considered using an interactive system like R, Matlab or Octave?= >>=20 >> You might be happier. >>=20 >> Or even have you considered goal search in Excel? >>=20 >>=20 >>=20 >>=20 >> On Wed, Aug 13, 2014 at 6:08 PM, South Light >> wrote: >>=20 >>> Hi, >>>=20 >>> May be someone can help me with this problem. >>>=20 >>> Given the follow function: y =3D 10 ^ ((x + 82) / (-10 * A)) >>>=20 >>> I would like to found the A value witch curve fit better for a set of x,= y >>> values, usually the set is about 20 to 25 x,y values. >>>=20 >>> I use the CurveFitter class and the ParametricUnivariateFunction >>>=20 >>>=20 >>> ParametricUnivariateFunction function =3D new >> ParametricUnivariateFunction() >>> { >>>=20 >>> =E2=80=8B =E2=80=8B >>> @Override >>> =E2=80=8B =E2=80=8B >>> public double[] gradient(double x, double[] params) { >>> =E2=80=8B >>> (????? comment) >>> =E2=80=8B =E2=80=8B >>> } >>>=20 >>> =E2=80=8B =E2=80=8B >>> @Override >>> =E2=80=8B =E2=80=8B >>> public double value(double x, double[] params) { >>>=20 >>> =E2=80=8B =E2=80=8B >>> double a =3D params[0]; >>>=20 >>> =E2=80=8B =E2=80=8B >>> return Math.pow(10, ((x + 82) / >>> =E2=80=8B(=E2=80=8B >>> -10 * >>> =E2=80=8Ba >>> =E2=80=8B)=E2=80=8B >>> )); >>>=20 >>> =E2=80=8B =E2=80=8B >>> } >>>=20 >>> }; >>>=20 >>> LevenbergMarquardtOptimizer optimizer =3D new >> LevenbergMarquardtOptimizer(); >>>=20 >>> CurveFitter fitter =3D new >>> CurveFitter(optimizer); >>>=20 >>> double[] x =3D { >>> -82 >>> , >>> =E2=80=8B-85 >>> , >>> =E2=80=8B-89 >>> }; >>>=20 >>> double[] y =3D { >>> =E2=80=8B1 >>> , >>> =E2=80=8B1.4 >>> , >>> =E2=80=8B2 >>> }; >>>=20 >>> for (int i =3D 0; i < x.length; i++) >>> =E2=80=8B =E2=80=8B >>> fitter.addObservedPoint(x[i], y[i]); >>>=20 >>> double[] result =3D fitter.fit(function, new double[] { 1, 10 }); >>>=20 >>>=20 >>>=20 >>> =E2=80=8BA. =E2=80=8BIs this the best way to solve the problem or there'= s another better >>> way? >>>=20 >>> B. What do we need to write on the gradient area (????? comment) ?=E2=80= =8B >>>=20 >>> Any help will be more then welcome. >>>=20 >>> Many thanks !! >>=20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org