Prev: transparency in 3D plots
Next: int quadgk disagree
From: Bruno Luong on 10 Jul 2010 04:39 I must miss something, the factorial(n) term in the denominator grow faster than any other terms (see Stirling approximation formula) so it looks like to me the series converges regardless the value of t or b. It seems that the various denominator terms in Walter's hypergeometric formula is just be there due to formal calculus, but does not matter when we looks at the original series. Incidentally me and my students have to deal with some nasty series of Hypergeometric functions (not hypergeometric series) last week in our optic simulation code. We use the fortran code we download from somewhere else and it is very slow to evaluate. Finally we gives up that approach for various reasons, and prefer a more brute-force method. To Aurelie: You can program the series (or hypergeometric function, but you should double check where there is really a singular poles) inside a customized function, and call the fit function. As John's pointed out FACTORIAL part can give infinity when more terms in the series is considered, so be careful. Personally I don't believe it causes any numerical problem because it's on the denominator. See example here http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/lsqcurvefit.html I presume you fit "f" for various "t". The function should very much like this function f = myfun(x,t) b = x(1); tauD = x(2); f = 0; for n=1:100 f = f + (-b).^n ./ (factorial(n)*(1+n*(1+(2/tauD)*t))); end end The invoke lsqcurvefit: like this x = lsqcurvefit(@myfun,x0, t, ft) Where x0 is the 2x1 vector first guess of b and tauD, t is vector of abscissa, and ft are the corresponding data. Bruno
From: Roger Stafford on 10 Jul 2010 12:54 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <i19bj8$563$1(a)fred.mathworks.com>... > I must miss something, the factorial(n) term in the denominator grow faster than any other terms (see Stirling approximation formula) so it looks like to me the series converges regardless the value of t or b. > > It seems that the various denominator terms in Walter's hypergeometric formula is just be there due to formal calculus, but does not matter when we looks at the original series. > > Incidentally me and my students have to deal with some nasty series of Hypergeometric functions (not hypergeometric series) last week in our optic simulation code. We use the fortran code we download from somewhere else and it is very slow to evaluate. Finally we gives up that approach for various reasons, and prefer a more brute-force method. > > To Aurelie: You can program the series (or hypergeometric function, but you should double check where there is really a singular poles) inside a customized function, and call the fit function. As John's pointed out FACTORIAL part can give infinity when more terms in the series is considered, so be careful. Personally I don't believe it causes any numerical problem because it's on the denominator. See example here > > http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/lsqcurvefit.html > > I presume you fit "f" for various "t". The function should very much like this > > function f = myfun(x,t) > b = x(1); > tauD = x(2); > f = 0; > for n=1:100 > f = f + (-b).^n ./ (factorial(n)*(1+n*(1+(2/tauD)*t))); > end > end > > The invoke lsqcurvefit: like this > > x = lsqcurvefit(@myfun,x0, t, ft) > > Where x0 is the 2x1 vector first guess of b and tauD, t is vector of abscissa, and ft are the corresponding data. > > Bruno - - - - - - - - - - Yes, Bruno, my aging brain went sadly astray on that problem. The series will indeed converge for any b and for any t for which -tauD/(tauD+2*t) is not a positive integer. There should be poles in the t complex plane at each of these latter t values. I do feel that Aurelie should give matlab's 'hypergeom' function in the symbolic toolbox a chance to see what it can do. If Mathworks has written it properly, it could well be much superior to summing the series. After all, this is no different in principle from evaluating many other transcendental functions such as sine, exponential, logarithm, etc. except that more parameters are involved, and I think matlab-ers would be very reluctant to have to evaluate these latter by their infinite series. Roger Stafford
From: Bruno Luong on 10 Jul 2010 15:02 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i1a8jd$nbi$1(a)fred.mathworks.com>... > Yes, Bruno, my aging brain went sadly astray on that problem. The series will indeed converge for any b and for any t for which -tauD/(tauD+2*t) is not a positive integer. There should be poles in the t complex plane at each of these latter t values. In general, you are still very sharp Roger, one of the sharpest people in this newsgroup IMO. > > I do feel that Aurelie should give matlab's 'hypergeom' function in the symbolic toolbox a chance to see what it can do. If Mathworks has written it properly, it could well be much superior to summing the series. After all, this is no different in principle from evaluating many other transcendental functions such as sine, exponential, logarithm, etc. except that more parameters are involved, and I think matlab-ers would be very reluctant to have to evaluate these latter by their infinite series. > We do try the hypergeometric function from Mathematica and the later seems to to be well implemented. Unfortunately we develop out code with Matlab. I think Aurelie should give both a try. Bruno
From: Roger Stafford on 11 Jul 2010 03:32
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <i1ag3d$kuu$1(a)fred.mathworks.com>... > In general, you are still very sharp Roger, one of the sharpest people in this newsgroup IMO. > ...... > Bruno - - - - - - - - Thank you for the compliment, Bruno. I return it by saying you are one of the people on cssm I have the most trouble keeping up with. You often publish a brilliant solution to a difficult problem when I am still stumbling around with it, or worse, when I've already put out a dumb solution. You make me wish I were young again. Roger Stafford |