1
$\begingroup$

I want to solve a differential equation $$ \frac{d}{dx}\left(k_0 \left(\frac{T(x)}{T_0}\right)^n \frac{dT(x)}{dx}\right)=0,$$ with boundary conditions: $T(l)=T_0$, $\;T'(0)=-\frac{q_0}{k_0 T(0)^n}\;$ using DSolve, but I cannot get a solution. Can anyone help me?

$\endgroup$
7
  • $\begingroup$ Your equation appears to be missing a bracket, (. Also, did you mean to write $T[x]$ instead of $T[l]$ in the boundary conditions? $\endgroup$
    – shrx
    Dec 4, 2013 at 21:13
  • $\begingroup$ T is a function of x $\endgroup$
    – user10947
    Dec 4, 2013 at 21:19
  • $\begingroup$ d/dx[k0 (T/T0)^n dT/dx]=0 Boundary Condition is: at x=L, T=T0, at x=0, dT/dx= -q0/(k0 T(0)) $\endgroup$
    – user10947
    Dec 4, 2013 at 21:21
  • $\begingroup$ Funny that k0 does not play any role in the equation. You can cancel it out. $\endgroup$
    – Peltio
    Dec 4, 2013 at 21:27
  • $\begingroup$ It showed in boundary conditions $\endgroup$
    – user10947
    Dec 4, 2013 at 23:36

3 Answers 3

6
$\begingroup$

I would just notice that

$$ \frac{d}{dx}(k_0 (\frac{T[x]}{T_0})^n \frac{dT[x]}{dx})=k_0/T_0^n \frac{1}{n+1}\frac{d}{d x^2} T[x]^{n+1}$$

and therefore I'd solve it as below :

(* Solve the differential equation and rename the integration constants *)
aux = (Tnp1 /. First@DSolve[k0/T0^n 1/(n+1) Derivative[2][Tnp1][x] == 0, Tnp1, x]) 
  /. {C[1] -> a, C[2] -> b}

(* The solution with the constants to be fixed *)
solT = Function[x, (aux[x])^(1/(n + 1)) ]

(* Solve for the constants *)
const = FullSimplify[Solve[{solT[l] == T0, solT'[0] solT[0]^n == -q0/k0} , {a, b}], 
    Assumptions -> {n > 0}]
(* {{a -> (l (1 + n) q0)/k0 + T0^(1 + n), b -> -(((1 + n) q0)/k0)}} *)

(* put everything together *)
finalT[x_] = solT[x] /. First[const]
(* ((l (1 + n) q0)/k0 + T0^(1 + n) - ((1 + n) q0 x)/k0)^(1/(1 + n)) *)

Check :

Block[{n = 6},
      {finalT[l], finalT'[0] finalT[0]^n}
]
(* {(T0^7)^(1/7), -(q0/k0)} *)
$\endgroup$
4
  • $\begingroup$ @Nasser I'm just saying $\frac{d}{dx}T^{n+1} = (n+1)\ T^n\ \frac{d}{dx} T$. $\endgroup$ Dec 5, 2013 at 9:09
  • $\begingroup$ @Artes I don't do terrible calculus on purpose. Please help us correcting our mistakes. $\endgroup$ Dec 5, 2013 at 9:13
  • $\begingroup$ Here it is again: $\frac{d}{dx}\left( T^{n}\frac{dT}{dx}\right) =\frac{dT^{n}}{dx}\frac {dT}{dx}+T^{n}\frac{d^{2}T}{dx^{2}}=nT^{n-1}\frac{dT}{dx}\frac{dT}{dx} +T^{n}\frac{d^{2}T}{dx^{2}}=nT^{n-1}\left( \frac{dT}{dx}\right) ^{2} +T^{n}\frac{d^{2}T}{dx^{2}}$ $\endgroup$
    – Nasser
    Dec 5, 2013 at 9:21
  • 1
    $\begingroup$ @Nasser What you do is correct but the simplification happens if you work backwards; you don't want to expand the derivative but rather use that $T^n \frac{d}{dx T} = \frac{1}{n+1} \frac{d}{d x}T^{n+1}$. This way the equation is simply $\frac{d}{dx^2} T^{n+1} = 0$. $\endgroup$ Dec 5, 2013 at 9:26
1
$\begingroup$

The problem is that your BC's are not linear. So Mathematica can't solve for C[1] and C[2]. May be if you use numerical values for some of the parameters, then they can be solved.

You can solve leaving the IC's out and get a solution with C[1] and C[2] later as follows

ClearAll[x, n, k0, T, q, len]
f[x_, n_] := k0  (T[x]/T0)^n T'[x]
T[x_] = T[x] /. Last@DSolve[D[f[x, n], x] == 0, T[x], x]

Mathematica graphics

Plot[T[x] /. {len -> 1, C[1] -> 2, C[2] -> 3, n -> 3}, {x, 0, 10}]

Mathematica graphics

bc1 = T[len] == T0

Mathematica graphics

c2 = C[2] /. First@Solve[bc1, C[2]]

Mathematica graphics

bc2 = (T'[x] /. x -> 0) == - q0/(k0 (T /. x -> 0)^n)

Mathematica graphics

eqForC1 = bc2 /. C[2] -> c2

Mathematica graphics

And now just need to solve for C[1] and then can find C[2] and hence the solution. But to solve for C[1], need numerical solution as it is non-linear. Hence need numerical values for the parameters in the equation for C[1].

$\endgroup$
1
  • $\begingroup$ The problem is that the solution from last DSolve is not like the what I had now. The result should be in the form T[x]=(c1*x+c2)^(n+1). $\endgroup$
    – user10947
    Dec 5, 2013 at 5:47
1
$\begingroup$

To complete my first comment (Hey, I've been scolded by the system because it was too long) I suggest to use a shooting (or balistic) method: instead of using mixed boundary conditions (at x=0 and x=l), specify the values of T and T' at the same extreme of the x interval, leaving the one that did not appear in the original problem as a parameter a to be determined. (I am not sure if To and T[0] should be the same, so you might want to adapt the code accordingly)

eq = Expand[D[ko (T[x]/To)^n  T'[x], x]] == 0

sol = DSolve[Flatten[{eq, T[0] == a, T'[0] == -q0/(ko a^n)}], T[x], x];
f[x_, a_] = T[x] /. Last[sol]

This will give you a hint of the value of a for generic integer n (I am using First here to return only one root per equation; perhaps a function capable of returning a real solution would be better):

Table[{k, a /. First[Solve[f[l, a] - To == 0/. n -> k, a]]}, {k, 0, 6}]

If you are confident you have found a closed form solution, you could try it into your f[x,a], that is T[x] with initial condition T[0]==a. For example, (EDIT, earlier I had used n instead of n+1)

t[x_] = f[x, a] /. a -> (To^(n+1) + (n+1) l q0/ko)^(1/(n+1)) // PowerExpand // Simplify

I have implicitly assumed that n is an integer and the constants are all real. It is usually at this point that I discover I have used an equation different from the one of the actual problem. :-) Still I hope this "extended comment" will point you in the right direction.

newer EDIT: this solution is remarkably similar to that found by b.gatessucks. As a matter of fact, if we bring the premultiplying constant inside the big bracket, we get the same solution. We can verify that it satisfies the differential equation

D[ko (t[x]/To)^n  t'[x], x]==0 // FullSimplify
    (* True *)

and the condition at L

t[l] == To // Simplify // PowerExpand
    (* True *)

And it also checks the condition on the derivative

t'[0] t[0]^n // Simplify // PowerExpand
    (* -q0/ko *)

(In my previous edits I was using To instead of T[0] as I should have done). Double check by specifying a value for n:

Table[t'[0] + q0/(ko t[0]^n) , {n, 0, 7}] // Simplify // PowerExpand
    (* {0,0,0,0,0,0,0} *)

Well, it appears that the shooting method works well, after all. It only needs someone less clumsy to manage it.

older EDIT: I wrote the part about using the wrong equation in mocking but it might very well be true. I am a bit confused by the role of To, since I tend to assume it is the value at 0. Results can be more complicated without the simplification given by putting ana in the condition for T'.

$\endgroup$
2
  • $\begingroup$ you have a mistake here, the boundary condition is T[l]==a instead of T[0]==a $\endgroup$
    – user10947
    Dec 5, 2013 at 5:45
  • $\begingroup$ The idea of the shooting method is to use a parametric initial condition a, to be determined by compliance with the boundary condition it is replacing. Your boundary condition at l is imposed by f[l,a]==To. But I might have messed up To with T[0]. $\endgroup$
    – Peltio
    Dec 5, 2013 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.