Mathematica Asked by Matías López on June 17, 2021
this is the situation, I’m trying to solve a system (s1) with two differential equations, called "x[Ne]" and "y[Ne]". They have and initial condition that first need to satisfy another NDSolve for "phi[NN]". Since I put this as initial condition, problemas like NDSolve::nbnum1:, NDSolve::ecboo:, appears, and I honestly don’t understand why. Before I put this initial condition starting from "phi[NN]", the system for "x[Ne]" and "y[Ne]" has initial condition "x[0]==x0, y[0]==y0", where "x0" and "y0" was free parameters and no solutions coming from the differential equation for "phi[NN]", and I didn’t get any trouble. Any kind of idea with these situations? I read about "reap" and "sow" but i didn’t understand how to stick with my code:
"condition for x0";
Sol[Phi]f[[Delta]_, [Xi]_, n_] :=
FindRoot[([Phi]f^(-2 - n/
2) (-1 + Sqrt[
1 + 4 [Delta] [Phi]f^(-1 +
n) (-4 + n + 8/(2 + [Xi] [Phi]f^2))]))/(2 [Delta]) ==
1, {[Phi]f, 1}, WorkingPrecision -> MachinePrecision]
[Phi]f[[Delta]_, [Xi]_, n_] := [Phi]f /.
Sol[Phi]f[[Delta], [Xi], n]
sr[[Delta]_, [Xi]_, n_] :=
NDSolve[{Derivative[1][[Phi]][
NN] == ([Phi][
NN]^-n (2 + [Xi] *[Phi][NN]^2) (-1 + Sqrt[
1 + 4 [Delta]*[Phi][NN]^(-1 +
n) *(-4 + n + 8/(2 + [Xi] *[Phi][NN]^2))]))/(
4 [Delta]), [Phi][0] == [Phi]f[[Delta], [Xi],
n]}, [Phi], {NN, 0, 70}, WorkingPrecision -> MachinePrecision]
xCMBsr[[Delta]_, [Xi]_, NN_] := [Phi][NN] /. sr[[Delta], [Xi], 2]
Vo[[Delta]_, [Xi]_, NN_,
n_, [Lambda]_] := ([Pi]^2 [Lambda] xCMBsr[[Delta], [Xi],
NN]^(-3 n) (2 + [Xi] xCMBsr[[Delta], [Xi], NN]^2)^3 (-1 +
Sqrt[1 +
4 [Delta] xCMBsr[[Delta], [Xi], NN]^(-1 +
n) (-4 + n + 8/(
2 + [Xi] xCMBsr[[Delta], [Xi], NN]^2))])^2 (1 +
2 Sqrt[1 +
4 [Delta] xCMBsr[[Delta], [Xi], NN]^(-1 +
n) (-4 + n + 8/(
2 + [Xi] xCMBsr[[Delta], [Xi], NN]^2))])^(3/2))/(8 Sqrt[
3] [Delta]^2 (1 +
4 [Delta] xCMBsr[[Delta], [Xi], NN]^(-1 +
n) (-4 + n + 8/(2 + [Xi] xCMBsr[[Delta], [Xi], NN]^2)))^(
1/4))
"condition for y0";
y0[[Delta]_, [Xi]_, NN_, n_, [Lambda]_] :=
PowerExpand[
1/(2 Sqrt[6] [Delta]) xCMBsr[[Delta], [Xi], NN]^(-n/2) Sqrt[
2 + [Xi] xCMBsr[[Delta], [Xi], NN]^2]*Sqrt[
Vo[[Delta], [Xi], NN,
n, [Lambda]]] (1 -
1 Sqrt[1 +
4 [Delta] xCMBsr[[Delta], [Xi], NN]^(-1 +
n) (-4 + n + 8/(
2 + [Xi] xCMBsr[[Delta], [Xi], NN]^2))])] //
FullSimplify;
[Alpha][[Delta]_, [Xi]_, NN_, n_, [Lambda]_] := ([Delta]^(1/3))/
Vo[[Delta], [Xi], NN, n, [Lambda]]^(1/3);
"system i want to solve";
s1[[Delta]_, [Xi]_, NN_, n_, [Lambda]_] :=
NDSolve[{Derivative[1][x][
Ne] == -((3 (2 + [Xi] x[Ne]^2) y[Ne])/(3 [Xi] x[Ne] y[Ne] +
3 [Alpha][[Delta], [Xi], NN, n, [Lambda]] y[Ne]^3 -
Sqrt[3] [Sqrt]((2 + [Xi] x[Ne]^2) (2 Vo[[Delta], [Xi],
NN, n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^2 x[Ne]^2 + y[Ne]^2) +
3 ([Xi] x[Ne] y[Ne] + [Alpha][[Delta], [Xi], NN,
n, [Lambda]] y[Ne]^3)^2))),
Derivative[1][y][
Ne] == -((3 (2 Vo[[Delta], [Xi], NN,
n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^2 x[Ne] (2 + [Xi] x[Ne]^2)^2 +
3 y[Ne] ([Xi] x[Ne] + [Alpha][[Delta], [Xi], NN,
n, [Lambda]] y[Ne]^2)^2 (-3 [Xi] x[Ne] y[Ne] -
3 [Alpha][[Delta], [Xi], NN, n, [Lambda]] y[Ne]^3 +
Sqrt[3] [Sqrt]((2 + [Xi] x[
Ne]^2) (2 Vo[[Delta], [Xi], NN,
n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^2 x[Ne]^2 + y[Ne]^2) +
3 ([Xi] x[Ne] y[Ne] + [Alpha][[Delta], [Xi], NN,
n, [Lambda]] y[Ne]^3)^2)) +
2 (1 + 1/
2 [Xi] x[Ne]^2) (-4 Vo[[Delta], [Xi], NN,
n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^2 [Xi] x[Ne]^3 +
x[Ne] ([Xi] (-2 + 3 [Xi]) -
6 Vo[[Delta], [Xi], NN,
n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^3 x[Ne]) y[Ne]^2 +
3 [Alpha][[Delta], [Xi], NN,
n, [Lambda]] (-1 + [Xi]) y[Ne]^4 +
Sqrt[3] y[
Ne] [Sqrt]((2 + [Xi] x[Ne]^2) (2 Vo[[Delta], [Xi],
NN, n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^2 x[Ne]^2 + y[Ne]^2) +
3 ([Xi] x[Ne] y[Ne] + [Alpha][[Delta], [Xi], NN,
n, [Lambda]] y[Ne]^3)^2))))/((-3 [Xi] x[Ne] y[
Ne] - 3 [Alpha][[Delta], [Xi], NN, n, [Lambda]] y[
Ne]^3 +
Sqrt[3] [Sqrt]((2 + [Xi] x[Ne]^2) (2 Vo[[Delta], [Xi],
NN, n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^2 x[Ne]^2 + y[Ne]^2) +
3 ([Xi] x[Ne] y[Ne] + [Alpha][[Delta], [Xi], NN,
n, [Lambda]] y[Ne]^3)^2)) (2 + [Xi] x[Ne]^2 +
3 ([Xi] x[Ne] + [Alpha][[Delta], [Xi], NN,
n, [Lambda]] y[Ne]^2) ([Xi] x[Ne] +
3 [Alpha][[Delta], [Xi], NN, n, [Lambda]] y[
Ne]^2) -
2 Sqrt[3] [Alpha][[Delta], [Xi], NN, n, [Lambda]] y[
Ne] [Sqrt]((2 + [Xi] x[Ne]^2) (2 Vo[[Delta], [Xi],
NN, n, [Lambda]] [Alpha][[Delta], [Xi], NN,
n, [Lambda]]^2 x[Ne]^2 + y[Ne]^2) +
3 ([Xi] x[Ne] y[Ne] + [Alpha][[Delta], [Xi], NN,
n, [Lambda]] y[Ne]^3)^2)))),
x[0] == xCMBsr[[Delta], [Xi], NN],
y[0] == y0[[Delta], [Xi], NN, n, [Lambda]]}, {x, y}, {Ne, 0,
70}, WorkingPrecision -> MachinePrecision]
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP