Re: creating functions from the result of Solve[]
- To: mathgroup at smc.vnet.net
- Subject: [mg41862] Re: [mg41826] creating functions from the result of Solve[]
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Sat, 7 Jun 2003 00:08:53 -0400 (EDT)
- References: <200306061350.JAA13089@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
If you want to solve a difference equation - or recurrence relation - you may use the AddOn package DiscreteMath`RSolve`. In[1]:= Clear[y] In[2]:= << "DiscreteMath`RSolve`" In[3]:= RSolve[3*y[n - 2] + 6*y[n - 1] - 2*y[n] == 0, y[n], n] Out[3]= {{y[n] -> -2*If[n >= -2, (1/Sqrt[15])*(2^(-4 - n)* (2*((3 - Sqrt[15])^(2 + n) - (3 + Sqrt[15])^ (2 + n))*(C[1] - 3*C[2]) + ((3 - Sqrt[15])^(3 + n) - (3 + Sqrt[15])^ (3 + n))*C[2])), 0]}} You must supply initial values in order to determine the two constants c[1] and c[2]. From there on, you shouldn't have any difficulty to proceed. Tomas Garza Mexico City ----- Original Message ----- From: "Okke" <kroosu at tref.nl> To: mathgroup at smc.vnet.net Subject: [mg41862] [mg41826] creating functions from the result of Solve[] > hello, > > i have an equation and i want to make a function from the result of > Solve[]. > > for example: > > IN: Solve[3y[n - 2] + 6y[n - 1] - 2y[n] == 0, y[n]] > > OUT: {{y[n] -> (3*y[-2 + n] + 6*y[-1 + n])/2}} > > and now i'd like to have the function > y[n_/;n>=0] := (3*y[-2 + n] + 6*y[-1 + n])/2 > > y[n]/.Flatten[Solve[eqn==0,y[n]]] is possible, but > y[n_]:=y[n]/.Flatten[Solve[eqn==0,y[n]]] isn't > > > is there anybody who could help me get this to work? > > -- > Okke > Experience is that marvelous thing that enables you to recognize a > mistake when you make it again. > -- F. P. Jones > >
- References:
- creating functions from the result of Solve[]
- From: kroosu@tref.nl (Okke)
- creating functions from the result of Solve[]