MathGroup Archive 2005

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

Search the Archive

Re: How do I get a DSolve'd function


Skirmantas wrote:
> I hope this is the last question for now.
> 
> I can solve a differential equation and plot it by doing something
> like this:
> 
> sol=DSolve[{f'[x]==-3f[x],f[0]==10},f,x]
> Plot[f/.sol,{x,0,10}]
> 
> But how do I get the function f[x] itself? I want to be able to input
> f[x] and get its definition. Or do Plot[f[x],{x,0,10}]. Or define
> y[x_]:=f[x]^2.
> 
> f[x]/.sol or f[x_]:=f[x]/.sol or f[x_]:=sol[[n,n,n]] do not work.
> 
> What if the solution is a function with many variables, say u[x,y,z]?
> What's the correct way to "get" it?  

In[4]:=
sol=DSolve[{f'[x]\[Equal]-3f[x],f[0]\[Equal]10},f,x];sol//InputForm

Out[4]//InputForm=
{{f -> Function[{x}, 10/E^(3*x)]}}

In[2]:=
g[y_]:=f[x]/.sol[[1]]/.x -> y

In[5]:=
g[1]//InputForm

Out[5]//InputForm=
10/E^3

-- 
Curt Fischer


  • Prev by Date: Re: Re: Why does Inverse[M] hesitate?
  • Next by Date: Re: Bug in 5.1??
  • Previous by thread: Re: How do I get a DSolve'd function
  • Next by thread: Re: How do I get a DSolve'd function