Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: How do I get a DSolve'd function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54395] Re: How do I get a DSolve'd function
  • From: Peter Pein <petsie at arcor.de>
  • Date: Sun, 20 Feb 2005 00:07:54 -0500 (EST)
  • References: <cv6t29$6su$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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}]
This will not work.
> 
> 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?  
> 
Try the usual way for ReplaceAll:

f=f/.sol

and now you can use f like any other function.

Oh, in the multivariate case, you should use u instaed of f:

u=u/.sol

-- 
Peter Pein
Berlin


  • Prev by Date: Re: Pattern matching in functions
  • Next by Date: Re: computing cumulative sum for list
  • Previous by thread: Re: How do I get a DSolve'd function
  • Next by thread: Re: How do I get a DSolve'd function