Community RSS Feed
http://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Numerical Computation sorted by activeInfinite expression encountered problem
http://community.wolfram.com/groups/-/m/t/1151487
Hi All,
I would like to solve two ODEs coupled together using NDSolve, please see below for my code. Basically, I have two variables, y'[x] and g'[x] (not g''[x]). The reason why I formulate my ODE using g''[x] is that I have integral boundary condition on g'[x], so I use the trick from [here][1] to reformulate my equation. I will be happy to provide an original form of the equation if there is a question that is related to this part.
My problem is Mathematica complaints about "Infinite expression encountered" for my second equation(g''[x]) part. My guess is that in the denominator of this equation, It has y[x] term which equals to 0 at left boundary. Even though I tried to avoid this by calculating y[-1+eps]=eps, It appears to still have this issue.
ClearAll["Global`*"];
w = 0.7;
q = 0.5*w*(1 - x^2);
kappa = 1.469;
sol = With[{eps = 10^-5}, NDSolve[{
y'[x] == (560*y[x]^0.5*q - 64*y[x]^4 + 6*w^(7/8)*(72*kappa - 77)*x*q*(-w*y[x]))/(3*w^(7/8)*(96*kappa - 77)*q^2),
g''[x] == (2695*y[x]^0.5*q - (864*kappa - 385)*y[x]^4 - 693*w^(7/8)*kappa*y[x]*q*(-w*x))/(9*(96*kappa - 77)*y[x]^3),
y[-1 + eps] == eps,
g[1 - eps] - g[-1 + eps] == 0,
g'[0] == 0}, {y[x], g'[x]},
{x, -1 + 0.001, 1 - 0.001}]];
Methods that I have tried is to give initial condition to Mathematica like below. (As suggested by [here][2]). However, I encountered error " Initial conditions should be specified at a single point."
ClearAll["Global`*"];
w = 0.7;
q = 0.5*w*(1 - x^2);
kappa = 1.469;
sol = With[{eps = 10^-5}, NDSolve[{
y'[x] == (560*y[x]^0.5*q - 64*y[x]^4 + 6*w^(7/8)*(72*kappa - 77)*x*q*(-w*y[x]))/(3*w^(7/8)*(96*kappa - 77)*q^2),
g''[x] == (2695*y[x]^0.5*q - (864*kappa - 385)*y[x]^4 - 693*w^(7/8)*kappa*y[x]*q*(-w*x))/(9*(96*kappa - 77)*y[x]^3),
y[-1 + eps] == eps, g[1 - eps] - g[-1 + eps] == 0,
g'[0] == 0}, {y[x], g'[x]},
{x, -1 + 0.001, 1 - 0.001},
Method -> {"Shooting",
"StartingInitialConditions" -> {y[-1 + eps] == eps,
g'[eps] == 0}}]];
Any help will be greatly appreciated! Also, I have a related question: Right now, I have 2 ODEs, but I am planning to add transient terms d/dt for each variable I am solving at here. Let's assume Mathematica could solve these ODEs. Is it possible to solve the transient PDEs? It will be a transient 1D problem, and from the NDSolve documentation, it seems that Mathematica should have capabilities to solve it.
------------------------Update for the original equation-----------------
My x range is from -1 to 1. Here are equations that I would like to solve
![My equation][3]
I also noticed [here][4] that this problem can be formulated as an optimization problem. However, I am having difficulty in this line of code on that link:
sol2[bc2_, {xmin_, xmax_}] :=
NDSolveValue[{y''[x] - y[x] == (x^2), y'[0] == bc2, y[0] == 1}, y, {x, xmin, xmax}];
int[bc2_?NumericQ] := NIntegrate[sol2[bc2, {0, 2}][x], {x, 0, 2}];
**y2 = sol2[NMinimize[(int[bc2V] - 5)^2, bc2V][[-1, -1, -1]], {-3, 3}]**
Plot[{y1[x], y2[x]}, {x, -3, 3}]
I don't know what does **[-1,-1,-1]** has to do with the original problem or formulation.
[1]: https://mathematica.stackexchange.com/questions/86403/solve-differential-equation-using-a-integral-form-boundary-condition
[2]: https://mathematica.stackexchange.com/questions/24312/infinite-expression-error-from-ndsolve
[3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=CodeCogsEqn.png&userId=1150579
[4]: https://mathematica.stackexchange.com/questions/86403/solve-differential-equation-using-a-integral-form-boundary-conditionKai D2017-07-23T17:32:53ZHow to use (MinimalPolynomial[ x^(1/x)-1,b]==(1 + b)^x for most x) for MRB.
http://community.wolfram.com/groups/-/m/t/1152134
The MRB constant is defined at [http://mathworld.wolfram.com/MRBConstant.htm][1]l.
In looking for a faster method of calculating digits of the MRB constant, Sum[(1-)^x (x^(1/x)-1))],
by the seemingly difficult method of solving minimal polynomials, I came across the following
where it seems Table[Expand[(1 + b)^x], {x, 1, 145}] = Table[MinimalPolynomial[x^(1/x)-1, b], {x, 1, 145}] for all x
except for "numbers of the form (kp)^p for prime p and k=1,2,3,...," OEIS [A097764][2] :
(real = Table[MinimalPolynomial[-1 + x^(1/x), b], {x, 1, 145}]);
(guess = Table[Expand[(1 + b)^x], {x, 1, 145}]);
real - guess // TableForm (*shows the equality for all but OEIS [A097764][3] *)
This equality could become very useful because as x gets large the minimal polynomial of x^(1/x)-1 becomes exceedingly difficult to compute!
The first several x's from the integer sequence give results found by the following.
nMax = 145; lst = {}; n = 1; While[p = Prime[n];
p^p <= nMax, k = 1;
While[(k*p)^p <= nMax, AppendTo[lst, (k*p)^p]; k++]; n++]; l =
Union[lst]
(*{4,16,27,36,64,100,144}*)
(real = Table[MinimalPolynomial[-1 + x^(1/x), b], {x, lst}]);
(guess = Table[Expand[(1 + b)^x], {x, lst}]);
(real = Table[MinimalPolynomial[-1 + x^(1/x), b], {x, lst}]);
FullSimplify[real - guess] // TableForm
They start with - 2 - b*(1 + b)^2*(2 + b)
and end with
- 3 - b*(1 + b)^9*(2 + b)*(1 + b + b^2)*(3 + b*(3 + b))*(1+b*(1 + b)^3*(3 + b*(3 + b)))*(3 + b*(3 + b*(3 + b))*(3 + b*(3 + b*(3 + b)))).
How can I use this fact to save effort in calculating digits of the MRB constant?
[1]: http://mathworld.wolfram.com/MRBConstant.html
[2]: https://oeis.org/A097764
[3]: https://oeis.org/A097764Marvin Ray Burns2017-07-24T15:11:14ZHow to resolve singularity in ODE under DSolve
http://community.wolfram.com/groups/-/m/t/1150923
Hi all,
I am fairly new to Mathematica, and try to solve some of my ODEs using DSolve. I know that when x = -1, and 1, I have an undefined derivative. So I am just planning to solve between -1+eps and 1-eps, where eps = 0.0001. However, the following code enters some calculation loop and never finished the calculation. I have solved the same equation in MATLAB, and pretty sure it is solvable, but would like to use DSolve for some other purposes. Here is my code. Any help would be appreciated!
ClearAll["Global`*"];
w = 0.7
q = 0.5*w*(1 - x^2)
kappa = 1.469
sol = DSolve[{y'[x] == (560*x^0.5*q - 64*x^4 +
6*w^(7/8)*(72*kappa - 77)*x*q*(-w*x))/(3*
w^(7/8)*(96*kappa - 77)*q^2), y[-0.99999] == 0.00001},
y[x], {x, -0.99999, 0.99999}]Kai D2017-07-21T16:52:43Z