Re: Another basic (?) question about RecurrenceTable and replacement
- To: mathgroup at smc.vnet.net
- Subject: [mg122415] Re: Another basic (?) question about RecurrenceTable and replacement
- From: Dana DeLouis <dana01 at me.com>
- Date: Fri, 28 Oct 2011 05:33:00 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
... using RecurrenceTable and computing sol[n/10,x[n],y[n]] only once ? Hi. I don't have a solution, but perhaps a few ideas. My guess is that using RecurrenceTable and FindRoot might not work well together. My thinking is that a Recurrence table uses more exact values, whereas FindRoot returns values at machine precision. > I kind of got confused with my notations : I want to solve > x_0 = -2, y_0 = 0 As a suggestion, perhaps refer to the RSolve function. That function uses a specific way to refer to previous values. As a simple example, here are begging x & y values, and recurrence functions: equ={ x[0]==0, x[1]==1, x[n]==x[n-2]+x[n-1], y[0]==1, y[n]==n*y[n-1] }; Rsolve suggest a function for both x & y as a function of n. RSolve[equ, {x[n],y[n]}, n] //FullSimplify { x[n]->Fibonacci[n], y[n]->Pochhammer[1,n] } Perhaps one of a few suggestions for your example might be to use your FindRoot function and generate a list of x & y pairs. Round to something more exact if your can. For example, suppose FindRoot gave the following x & y pairs : z={{1, 2.00001},{2, 4.9999999},{3, 10.00000001},{4, 19},{5, 36},{6, 69},{7, 134}}; If it is acceptable, try to round the values to something like this: z={{1,2},{2,5},{3,10},{4,19},{5,36},{6,69},{7,134}}; I don't see a pattern, but FindSequenceFunction did. FindSequenceFunction[z,n] -1+2^n+n I hope I understood your question correctly. = = = = = = = = = = = = = = = = = = = = = = HTH Dana DeLouis $Version 8.0 for Mac OS X x86 (64-bit) (February 23, 2011) On Oct 25, 6:19 am, victorphy <vba... at gmail.com> wrote: > Hello, > > here is another question I could'nt find the asnwer on the web, > altough I guess it's very elementary. > > Here is my problem. Assume I want to solve an implicit equation on two > variables : > > x_0 = _2, y_0 = 0 > > (x_{n+1},y_{n+1}) = sol(n/10,x_n,y_n) > for n = 1..10 > > where f cannot be defined explicitely but is given by something like > (I give a silly exemple): > > f[x_, a_] := -(x - a)^3 + (x - a) > sol[a_?NumericQ, b_?NumericQ,c_?NumericQ] := FindRoot[{f[x, a], x + > y}, {x, b}, {y, c}] > > What is the way to write this using RecurrenceTable and computing > sol[n/10,x[n],y[n]] only once ? (as in the real life the rootsearching > is longer than above) ? > > Any help would be very welcome. > > Thank you very much in advance. > > Best regards, > > Victor