Mathematica Output of DSolve as a function

1,766
69
Hi PF!

The following is a simple ODE I'm solving via DSolve. However, the solution, which I call uEven, does not work as a typical function. Note the last two lines are different. Does anyone know how to fix this, so that I can differentiate and integrate the output of this ODE without copy-pasting?

Ideally I'd like the solution to adapt to different input constants shown at the top. Any help much appreciated!

Code:
L = 0.005;  (* HALF CHANNEL LENGTH  (m)       *)
\[Sigma] = 0.07;    (* \
SURFACE TENSION      (N / m)   *)
\[Rho] = 1000; (* LIQUID \
DENSITY       (kg / m^3) *)
g = 9.8;     (* GRAVITY ACCELERATION (m / \
s^2)  *)
\[Alpha] = 
 70 \[Pi]/180; (* STATIC CONTACT ANGLE (rad)     *)
l = \
Sqrt[\[Sigma]/(\[Rho] g)]; (* CAPILLARY LENGTH SCALE (m) *)
b = (\
\[Rho] g l^2)/\[Sigma]; (* BOND NUMBER *)
\[CapitalGamma][x_, 
  l_, \[Alpha]_, L_] := 
 l Cot[\[Alpha]] Exp[L ( x - 1)/l](* EQUILIBRIUM HEIGHT (m) *)

uEven[x, b, l, \[Alpha], L] = 
  y[x] /. First@
    DSolve[{-y''[
          x] + (b Cos[\[Alpha]] - \[CapitalGamma][x, l, \[Alpha], 
            L]^2) y[x] == 0, y'[0] == 0}, y, x];
uEven[x, b, l, \[Alpha], L]
uEven[y, b, l, \[Alpha], L]
 
28,293
4,646
You are not defining uEven as a function, you are just defining it as a single symbol. You want to use the following syntax instead:

uEven[x_, b_, l_, \[Alpha]_, L_] := ...
 
1,766
69
You are not defining uEven as a function, you are just defining it as a single symbol. You want to use the following syntax instead:

uEven[x_, b_, l_, \[Alpha]_, L_] := ...
Must've been real late, can't believe I missed this. Thanks!
 

Want to reply to this thread?

"Output of DSolve as a function" You must log in or register to reply here.

Related Threads for: Output of DSolve as a function

Replies
1
Views
3K
Replies
1
Views
514
  • Posted
Replies
5
Views
2K
Replies
3
Views
3K
Replies
2
Views
6K
  • Posted
Replies
1
Views
4K
Replies
1
Views
3K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top