MathGroup Archive 1999

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

Search the Archive

Re: change the solution to a differential equation into a user defined function - question.nb (0/1)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15603] Re: change the solution to a differential equation into a user defined function - question.nb (0/1)
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 28 Jan 1999 04:23:31 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <786u4u$29b@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Young

lets stat with Your example:

sol=DSolve[y'[x]==x,y[x],x]

To make a pattern for the solution we have to do  replace y[x] by y[x_]
and -> by := so  we can write down

holdsol=(Hold /@ 
        Flatten[sol/. 
            HoldPattern[Rule[z_,b_]] :> 
              Rule@@ {z /. x-> Pattern[x,Blank[]],b}]) /. Rule
->SetDelayed

The result is a list of function definitions enclosed by Hold and you
have to
decide which solution you want. If there is only one solution you can 
make type

ReleaseHold[
  holdsol[[1]]
 ]

and see that you have the defintion for the pattern y[x_]

Hope that helps
  Jens



Yong Cai wrote:
> 
> I probably have to apologize for the awkward name for the subject.
> 
> My question is

> When I define the same function for y[x] by myself, it is evidently  a
> pattern where x can be taken in any value.
> 
> Then comes the question: how can we use the solution given in a
> differential equation which itself is a function as a function for
> later use?
> 
> It seems to be straightforward, but I have looked through the
> Mathematica Book and found no clue. Your help will be greatly
> appreciated.


  • Prev by Date: error messages in mathematica
  • Next by Date: Re: change the solution to a differential equation into a user defined function - question.nb (0/1)
  • Previous by thread: change the solution to a differential equation into a user defined function - question.nb (0/1)
  • Next by thread: Re: change the solution to a differential equation into a user defined function - question.nb (0/1)