Mathematica Asked by Joe Li on July 14, 2021
Consider the following ODE:
a = 0.8; b = 8;
v = DSolveValue[{
u[x] == a*(b* u'[x] + u''[x]),
u[4.925] == 4,
u'[4.925] == 0.625
}, u[x], x]
which gives the error message
DSolveValue: For some branches of the general solution, the given boundary
conditions lead to an empty solution
However the following totally work:
a = 0.8; b = 8;
v = DSolveValue[{
u[x] == c*(d* u'[x] + u''[x]),
u[4.925] == 4,
u'[4.925] == 0.625
}, u[x], x] /. {c -> a, d -> b}
But this is ugly.
I could use Block
, but all these are inside Module
, and using Block
inside Module
gives warnings like this:
a occurs twice in a nested scoping construct in a way that is likely to be an error
What is the best way to solve this?
I like your "ugly way," but another way is use exact constants when using an exact symbolic solver:
a = 8/10; b = 8;
v = DSolveValue[{u[x] == a*(b*u'[x] + u''[x]), u[4925/1000] == 4,
u'[4925/1000] == 625/1000}, u[x], x] // N
(*
-0.000851416 (0.780974 2.71828^(40.9101 - 8.15331 x) -
2208.78 2.71828^(0.153312 x))
*)
One may omit the // N
of course. The problem is exponential expressions with approximate real powers.
Answered by Michael E2 on July 14, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP