0
$\begingroup$

I want to solve second order differential equation connected with a first-order differential equation

**D[theta[x], {x, 2}] + (2*Z + P)*D[theta[x], x] -Exp[-2*Z*x]*(A*theta[x] + B^2 + C)theta[x]  == 0**,

with boundary conditions theta[0]==1 and theta'[1]==0 and parameters **Z=0.2; A=10;B=0.5; C=0.5; P=0.2;** and the second equation is

**M1==A*theta*Log[1 + T1*theta[x]] - 1/(theta[x] + T1) (2*Z + P)*D[theta[x], x] -Exp[-2*Z*x]*(A*theta[x] + B^2 + C)theta[x])**

I want to solve this equation in such a way to get the value of theta from the 1st equation and use this value in the second equation. and plot M1 against T1. i am new in Mathematica please help me.

$\endgroup$
2
  • 1
    $\begingroup$ What about parameter x in your second equation? Perhaps you want to plot M1[x,T1]? $\endgroup$ Dec 30, 2020 at 18:32
  • $\begingroup$ @Ulrich Neumann yes exactly $\endgroup$
    – ZDN
    Dec 30, 2020 at 18:36

1 Answer 1

1
$\begingroup$

parameters (I changed C to CC because C is protected)

Z = 0.2; A = 10; B = 0.5; CC = 0.5; P = 0.2;

solution of the ode

\[Theta] =NDSolveValue[{D[theta[x], {x, 2}] + (2*Z + P)*D[theta[x], x] -Exp[-2*Z*x]*(A*theta[x] + B^2 + CC ) theta[x] == 0,theta[0] == 1 , theta'[1] == 0}, theta, {x, 0, 1}]
(* \[Theta][x] might be used like a build in function of Mathemtica*) 

evaluate the second equation

M1 = A*\[Theta][x]*Log[1 + T1*\[Theta][x]] - 1/(\[Theta][x] + T1) (2*Z + P)*D[\[Theta][x], x] -Exp[-2*Z*x]*(A*\[Theta][x] + B^2 + CC) \[Theta][x] ; 
(*M1 depends on x and T1*)

plotit

Plot3D[ M1 , {x, 0, 1}, {T1, 0, 5}, AxesLabel -> {"x", "T1", "M1"}]

That's it, hope it helps!

enter image description here

$\endgroup$
4
  • $\begingroup$ ! thanks for your cooperation and giving time from your precious time. are any 2D plot is possible $\endgroup$
    – ZDN
    Dec 30, 2020 at 18:51
  • $\begingroup$ What kind of 2D-plots? Something like M1[T1; parameter x] or M1[x; parameter T1] ? $\endgroup$ Dec 30, 2020 at 18:55
  • $\begingroup$ M1[T1; parameter x] $\endgroup$
    – ZDN
    Dec 30, 2020 at 18:58
  • $\begingroup$ Try Plot[Table[M1, {x, 0, 1, .2}] // Evaluate, {T1, 0, 5}, PlotLegends -> LineLegend[Range[0, 1, .2], LegendLabel -> "x" ]] $\endgroup$ Dec 30, 2020 at 19:08

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.