最新檔案發佈

l4P5 (beta-003)2009-05-05 20:38
Loc (beta-005)2009-05-05 20:33
wrj4p5 (alpha-011)2009-05-05 20:41

最近の更新

2012-01-01
2010-03-25
2009-12-26
2009-05-06
2009-04-12
2009-03-02
2008-12-20
2008-08-08

Wikiガイド

サイドバー

ClassVfunc : Model of the Vector Function with parameters

test applet and code is here

  1. *[class] Vfunc 5/20/2008 by Classiclll
  2. *
  3. * Model of the Vector Function with parameters
  4. * f : R^n.R^m -> R
  5. *
  6. * can solve the followings with Simplex(Nelder) and Newton
  7. * for given p, find x such that f(x;p) = 0
  8. * for given p, find extreme point x* such that f(x*;p)/dx = 0
  9. * estimate parameters p* such that ssr(obs,samples,p*)/dp = 0
  10. * based the observations, {obs[i] in R, samples[i] in R^n}
  11. *
  12. Vfunc(int domX, int domP) // construct
  13. // & setup the internal inplementations of EqSys as solver
  14. int domDim() {return domX;} // dimension of the domain (n)
  15. int paramDim() {return domP;} // dimension of the params (m)
  16. abstract double valueAt(Vec x, Vec p) // this parameterized function (R^n.R^m -> R)
  17. abstract Vec gradAt(Vec x, Vec p) // this gradient arround x, given p
  18. abstract Vec gradParamAt(Vec x, Vec p) // this gradient arround p, given x
  19. double valueAt(Vec x) // conbinient method with no parameters.
  20. Vec gradAt(Vec x) // conbinient method with no parameters.
  21. Vec diffAt(Vec x, Vec d, Vec p) // gradient estimator at x+d using valueAt()
  22. Vec diffParamAt(Vec x, Vec d, Vec p)// param grad estimator at p+d using valueAt()
  23. // 1. for solving the equation of this function.
  24. private class thisEqSys extends EqSys // an implementation of Equation System
  25. Vec solveByNewton(Vec x0, Vec p) // find the solution by newton, start at x0
  26. Vec solveBySimplex(Vec x0, Vec p, int limit) // find the solution by Simplex, start at x0
  27. // 2. for finding of the extreme point of this function
  28. private class gradEqSys extends EqSys // an implementation of Equation System
  29. //find one extreme point, start at x0
  30. Vec findeExtremeByNewton(Vec x0, Vec p)
  31. Vec findeExtremeBySimplex(Vec x0, Vec p, int limit)
  32. Vec findeExtremeBySimplex(Vec x0, Vec p, int limit, int tryal)
  33. // 3. least sqare equation system based by the Square Sum of Residual
  34. private class paramEqSys extends EqSys // an implementation of Equation System
  35. // estimate the params by Least Square Sum
  36. Vec bestPrmByNewton(Vec p, Vec obs, Mat samples)
  37. Vec bestPrmBySimplex(Vec p, Vec obs, Mat samples, int limit)
  38. Vec bestPrmBySimplex(Vec p, Vec obs, Mat samples, int limit, int tryal)
  39. // the Formulation for the Least Square Sum of the Sum of Square residuals
  40. double ssrAt(Vec p, Vec obs, Mat samples) //calcurate the Square Sum of Residuals at "p".
  41. Vec residual(Vec p, Vec obs, Mat samples) // calculate the each residual at "p"
  42. Vec ssrGradAt(Vec p, Vec obs, Mat samples) // gradient of ssr based gradParamAt()
  43. Vec ssrJacobAt(Vec p, Vec obs, Mat samples) // jacobian of ssr based gradParamAt()