MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: creating functions from the result of Solve[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41848] Re: [mg41826] creating functions from the result of Solve[]
  • From: Bobby Treat <drmajorbob-MathGroup3528 at mailblocks.com>
  • Date: Sat, 7 Jun 2003 00:08:38 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Use Set rather than SetDelayed.

ClearAll[n, y]
y[n_ /; n ? 0] =
 y[n] /. First@Solve[3y[n - 2] + 6y[n - 1] - 2y[n] == 0, y[n]]
?y

It requires knowing that the First solution is the one you want (in 
case there are several).  If you have already seen the solution, that's 
no problem.

Bobby

-----Original Message-----
From: Okke <kroosu at tref.nl>
To: mathgroup at smc.vnet.net
Subject: [mg41848] [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] -&gt; (3*y[-2 + n] + 6*y[-1 + n])/2}} and now i'd 
like to have the function y[n_/;n&gt;=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 


  • Prev by Date: Learning to work with non-commutative oscillators
  • Next by Date: Re: creating functions from the result of Solve[]
  • Previous by thread: Re: creating functions from the result of Solve[]
  • Next by thread: Re: creating functions from the result of Solve[]