Creating a function from DSolve output

  • Thread starter Thread starter rasouza
  • Start date Start date
  • Tags Tags
    Function Output
Click For Summary
The discussion centers on solving a differential equation using Mathematica's DSolve function. The solution provided is y = 3x + C[1] + Log[x]. The user seeks to redefine y as a function of another variable, z, and desires to evaluate this function at specific points, such as y[2]. The user initially attempts to assign the solution directly to a function but encounters issues. The correct approach involves extracting the solution from the DSolve output and assigning it to a new function, g, using the substitution method. For further guidance, a link to a detailed explanation is provided.
rasouza
Messages
1
Reaction score
0
I have discovered the solution for the differential equation. I have:

DSolve[{y'[x] == 3 + 1/x}, y, x]

and got
{{y -> Function[{x}, 3 x + C[1] + Log[x]]}}

I'd like to make y a function of z, for example. I just would like to be able to use the function another time, evaluating y[2] for example.

I tried a[x_] = DSolve[{y'[x] == 3 + 1/x}, y, x] but failed
 
Physics news on Phys.org
What you need to do is the following:

sol = DSolve[{y'[x] == 3 + 1/x}, y, x]
g = y /. sol[[1]]

Please refer to this http://www.voofie.com/content/81/how-to-use-the-output-from-mathematica-function-dsolve/" for detailed explanation.
 
Last edited by a moderator:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K