# Gives me a complex solution [closed]

A := DSolve[{D[((It - Ir) * x / L + Ir) * w''[x], {x, 2}] - p/Y,
w[x] == 0, w'[0] == 0, w''[L] == M0/(Y*Ir), w'''[L] == -P/(Y*Ir)},
w[x], x]


I want a real solution to this. Am I making a mistake in defining the boundary conditions of the problem?

I am unable to yield the required solution.

## closed as off-topic by Szabolcs, Mariusz Iwaniuk, Henrik Schumacher, corey979, ÖskåDec 26 '18 at 21:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Szabolcs, Mariusz Iwaniuk, corey979, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

• Make sure you post the actual code you used, or at least that the code you post here does what you claim it does. – Szabolcs Dec 26 '18 at 9:05
• @Szabolcs I have posted the original code that I have used to solve the differential equation. The output is a complex output while there exists a real solution to this equation which I have evaluated using the hand. I require the solution to be in real terms. – Kamran Ali Ahmed Dec 26 '18 at 9:21
• No, you have not. Copy the code back to a notebook and evaluate it. Does it do what you claim? The DSolve syntax isn't even correct. – Szabolcs Dec 26 '18 at 10:06

## 3 Answers

I don't know if that's what you wanted, but writing:

sol = DSolve[{D[Y((It - Ir)x/L + Ir)w''[x], {x, 2}] == q,
w[0] == 0,
w'[0] == 0,
w''[L] == -m/(Y It),
w'''[L] == -f/(Y It) + m/(Y It^2)(It - Ir)/L},
w[x],
x][[1, 1, 2]] /. Log[expr_] :> Log[Abs[expr]] // Simplify


or, in a much more intuitive way, by writing:

sol = DSolve[{Y((It - Ir)x/L + Ir)w''[x] == -(m - f(L - x) - q(L - x)^2/2),
w[0] == 0,
w'[0] == 0},
w[x],
x][[1, 1, 2]] /. Log[expr_] :> Log[Abs[expr]] // Simplify


I get:

(1/(12 (Ir - It)^4 Y))L ((Ir - It) x (-Ir^2 (12 m + q x (-3 L + x)) + 6 f (Ir - It) (Ir x - It (2 L + x)) + Ir It (24 m + q x (-9 L + 2 x)) + It^2 (-12 m + q (6 L^2 + 6 L x - x^2))) + 6 (2 f (Ir - It) It L + 2 Ir^2 m - 4 Ir It m + It^2 (2 m - L^2 q)) (Ir (L - x) + It x) Log[Abs[Ir L]] - 6 (2 f (Ir - It) It L + 2 Ir^2 m - 4 Ir It m + It^2 (2 m - L^2 q)) (Ir (L - x) + It x) Log[Abs[Ir L - Ir x + It x]])

which seems to me a good result.

In particular, writing:

nsol = sol /. {It -> 10,
Ir -> 5,
Y -> 2*10^11,
L -> 3,
f -> 1,
m -> 3/10,
q -> 1/2} // FullSimplify


I get:

(x (-1764 + 5 (-39 + x) x) + 1764 (3 + x) Log[1/3 Abs[3 + x]])/40000000000000

which is the same that is obtained by initially defining these parameters.

Specifically, writing:

nsol // N // Chop

Plot[nsol, {x, 0, 3},
AxesLabel -> {"x [m]", "w [m]"},
ScalingFunctions -> {Identity, "Reverse"}]


I get:

0

that experience suggests that substituted numbers are not physically significant. Check the units of measurement, surely the catch is there (I think it is the integration of the elastic line to the Euler-Bernoulli in the case in which the beam has a variable section).

It = 10;
Ir = 5;
Y = 2*10^11;
L = 3;
P = 1;
p = 0.5;
M0 = 0.3;


A = DSolve[{D[((It - Ir) x/L + Ir) w''[x], {x, 2}] == -p/Y, w[0] == 0, w'[0] == 0, w''[L] == M0/(Y *Ir), w'''[L] == -P/(Y *Ir)}, w[x], x] /. Log[expr_] :> Log[Abs[expr]] // FullSimplify 

Gives me this result:

{{w[x] ->
x^2 (5.25*10^-13 - 1.25*10^-13 x +
3.*10^-12 HypergeometricPFQRegularized[{1.,
1.}, {3.}, -0.333333 x])}}


which is not in real terms.

• If this was meant as an addition to the question, then please edit the question. Do not post it as an answer. See the Tour on how StackExchange works. – Szabolcs Dec 26 '18 at 13:48
\$Version

(* "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)" *)

Clear["Global*"]

It = 10;
Ir = 5;
Y = 2*10^11;
L = 3;
P = 1;
p = 1/2;
M0 = 3/10;

eqns = {D[((It - Ir) x/L + Ir) w''[x], {x, 2}] == -p/Y, w[0] == 0,
w'[0] == 0, w''[L] == M0/(Y*Ir), w'''[L] == -P/(Y*Ir)};

A = DSolve[eqns, w, x][[1]] // FullSimplify

(* {w -> Function[{x}, (-360 x + 21 x^2 - 5 x^3 - 1080 Log[3] -
360 x Log[3] + 1080 Log[3 + x] +
360 x Log[3 + x])/40000000000000]} *)


Verifying the solution,

And @@ (eqns /. A // Simplify)

(* True *)


To find the domain for which w[x] is real use FunctionDomain

FunctionDomain[w[x] /. A, x]

(* x > -3 *)


For that domain, the function simplifies to

w[x_] = w[x] /. A // FullSimplify[#, x > -3] &

(* (x (-360 + (21 - 5 x) x) + 360 (3 + x) Log[(3 + x)/3])/40000000000000 *)

Plot[w[x], {x, -3, 12}]
`