for exemple i have pde1 = -y1”[x] – (2*y1′[x])/x + (10^-19*(y1[x])^2 + y2[x])*y1[x] == 0;

pde2 = y2”[x] + (2*y2′[x])/x – (10^-25)*(y1[x])^2 == 0
sol = NDSolve[{pde1, pde2, y1[1] == 0.001,y2[1] == -0.001, y1′[0.001] == 0.001, y2′[0.001] == 0.001}, {y1, y2}, {x, 30}]
{{y1 -> InterpolatingFunction[{{0., 30}}, <>],
y2-> InterpolatingFunction[{{0., 30}}, <>]}}
I need to plot the integration of ( solution(y1)* x^2)

## Tag Archives: equations

## Coupled differential equations

## 1 Answer

## How to solve a system of equations on mathematica?

I need to solve the system of equations:

x” = a, x'(0) = v0, x(0) = x0

(where a, v0 and x0 are constants).

I’m trying to use the command Solve[{expr1,expr2,expr3},{var1,var2,var3}]

Presumably, the equation is x(t)= x0+v0t+1/2at^2, but the next part of the problem is to use the rules you obtained and replacement to construct a useable function x(t). So how can I solve the original system?

## Plot the results of a nonlinear system of equations

I have this system of four nonlinear equations:

the unknowns are a1, a2, gamma1 and gamma 2. all other parameters are known. What I want is to plot the a1 vs sigma2 as below:

I tried `findinstance`

but it takes a lot of time to find the results for any value of sigma2, Let alone plotting a1 for different values of sigma2!

Can anybody help me?

Thanks in advance

## Using FindFit to do a data fit with a system of 5 differential equations

my project right now consists of doing a data fit of this system of differential equations with 2 variables. Below is what I have so far but I keep running into problems with FindFit(keeps giving me some warnings such as NDSolve::mxst: Maximum number of 200 steps reached at the point t == 7.642417604774492`.

What I have so far:

```
deltad=0.35;deltaz = 0.35; rho = 1.5;
alpha = 1;
r = 0.385;
s = 0.626;
uv = 5*10^10; \[Alpha] = 1; a = 1; gammay = 1;
ud = 1*10^6;
n = 3500;
sigmay = 0.00001;
sigmax = 0.00001;
fg = Piecewise[{{1*10^6, 0 <= t <= 2}}];
fg1 = Piecewise[{{5*10^10, 3 <= t <= 5}}];
data = {{0.000745712`, 99.23612972`}, {2.002982849`,
205.1058697`}, {4.005219985`, 205.1058697`}, {6.007457122`,
222.7508264`}, {8.009694258`, 169.8159564`}, {10.01193139`,
134.5260431`}, {12.01416853`, 55.12373805`}, {14.06089983`,
19.83382471`}, {16.0186428`, 2.188868043`}, {17.97638578`,
2.188868043`}, {19.97862292`, 2.188868043`}, {21.98086005`,
28.65630305`}, {24.02759135`, 46.30125972`}, {25.98533433`,
134.5260431`}, {28.07655978`, 258.0407397`}};
first = r*x[t] - \[Kappa]*((x[t]*z[t])/(
x[t] + y[t] + z[t] + d[t])) - (\[Beta]*v[t]*x[t])/(
x[t] + y[t] + z[t] + d[t]);
second = s*y[t] + (\[Beta]*v[t]*x[t])/(x[t] + y[t] + z[t] + d[t]) -
alpha*y[t] - \[Kappa]*(y[t]*z[t])/(x[t] + y[t] + z[t] + d[t]);
third = n*alpha*y[t] - deltav*v[t] + fg1;
fourth = sigmay*y[t] - deltad*d[t] + fg;
fifth = rho*d[t] - deltaz*z[t];
model[\[Kappa]_?NumberQ, \[Beta]_?
NumberQ] := (model[\[Kappa], \[Beta]] =
First[y /.
NDSolve[{x'[t] == first, y'[t] == second, v'[t] == third,
d'[t] == fourth, z'[t] == fifth, x[0] == 1.5*10^8, y[0] == 0,
v[0] == 0, d[0] == 0, z[0] == 0}, {x, y, v, d, z}, {t, 0, 28},
MaxSteps -> 200]])
fittedh =
FindFit[data, {model[\[Kappa], \[Beta]][
t], \[Kappa] < \[Beta]}, {{\[Beta], 0.0001}, {\[Kappa], 0.001}},
t]
```

Unfortunately my output does not match the data. I would appreciate some help/ suggestions to make better.

Just in case, someone is interested, this is what my output was like

```
\[Kappa] = 0.001001524973637588`;
\[Beta] = 0.00010044137152890746`;
hj = NDSolve[{x'[t] == first, y'[t] == second, v'[t] == third, d'[t]
== fourth, z'[t] == fifth, x[0] == 1.5*10^8, y[0] == 0, v[0] == 0,
d[0] == 0, z[0] == 0}, {x, y, v, d, z}, {t, 0, 28.07655978`}]
ll = Show[ListPlot[data],
Plot[Evaluate[((x[t] + y[t])/10000) /. {hj}], {t, 0, 28}]]
```

## Systems of equations

As I stated in this question I am trying to find the roots of a set of equations. I followed the instructions that the answer gave me and Mathematica gave me the solutions.

1- However whenever I try to calculate it gives me this error: NMaximize::nosat: Obtained solution does not satisfy the following constraints within Tolerance -> 0.001`… Thus, I am wondering that may there be a chance this error is making the solutions wrong.

2-Moreover, what would be the input if I tried to calculate the roots for the maximum value of **absolute value** of q[2]?

*This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.*