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

• To: mathgroup at smc.vnet.net
• Subject: [mg15606] Re: [mg15566] change the solution to a differential equation into a user defined function - question.nb (0/1)
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Thu, 28 Jan 1999 04:23:34 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```How about something like this:

define

dsolve[eq_,f_,x_]:=Function[x,f]/.Flatten[DSolve[eq,f,x]]

Now,

In[26]:=
dsolve[y'[x]==x,y[x],x]
Out[26]=
2
x
Function[x, -- + C[1]]
2

On Tue, Jan 26, 1999, Yong Cai <yc10 at acpub.duke.edu> wrote:

>I probably have to apologize for the awkward name for the subject.
>
>My question is
>
>In[1]:=
>sol=DSolve[y'[x]==x,y[x],x]
>Out[1]=
>?!?({{y[x] ?[Rule] x?^2?/2 + C[1]}}?)
>
>In[2]:=
>FullForm[sol]
>Out[2]//FullForm=
>List[List[Rule[y[x],Plus[Times[Rational[1,2],Power[x,2]],C[1]]]]]
>
>After I type in the command to solve the differential equation, I am
>given a replacement rule of y[x], which can be applied as a rule when
>the argument inside y is x, nothing else.
>
>In[3]:=
>y[x_]:=x^2/2+c[1]
>In[4]:=
>FullForm[y[x_]]
>Out[4]//FullForm=
>Plus[c[1],Times[Rational[1,2],Power[Pattern[x,Blank[]],2]]]
>
>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.

Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp/
http://eri2.tuins.ac.jp/

```

• Prev by Date: D vs. Derivative
• Next by Date: RE: Color problem with listdensityplot. Please HELP
• Previous by thread: Re: 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)