New answers tagged

9

Why are you taking the RegionCentroid of a Line object? If you take the RegionCentroid of the points, you get your expected result: RegionCentroid[Point[{r1,r2,r3}]] {1.,0.833333}


5

I show a solution based on the trapezoidal rule for first-order ODEs. The ODE $uu'=\nu u''$ is equivalent to $(u,v)'=f(u,v)$, where $f(u,v)=(v,\frac{1}{\nu}uv)$. If $y=(u,v)$, the trapezoidal FDM is $y_{i+1}=y_i+\frac12 h(f(y_i)+f(y_{i+1}))$. We use the mesh $x_j=-1+jh$, $h=2/n$, $j=0,\ldots,n$. The following Module returns $\{(x_j,u_j)\}_{j=0}^n$. fdmODE[...


7

NDSolve-based Solution We need to adjust the option of NDSolve a bit. For the first problem, if you're in v12, then you can use nonlinear FiniteElement: ref = Plot[-A Tanh[A (x - zex)/(2 nu)], {x, -1, 1}, PlotStyle -> Black, PlotRange -> All]; test = NDSolveValue[{u''[x] - (1/nu) u[x] u'[x] == 0, u[-1] == 1 + delta, u[1] == -1}, u, {x, -1, 1}, ...


3

We cannot depict the orbits of the Sun and Jupiter in the same figure on the same scale, since the radius of the orbit of the Sun is about 0.001 the radius of the orbit of Jupiter. But we can show in one animation their synchronous movement around the barycenter. m = {1, 0.0009546133303706552`};(*masses of sun and jupiter in solar \ masses*)G = 0....


0

Gravitation is often regarded as conservative or to pose several invariants. This system of three gravitational masses do have energy conservation. So You start from the very right thoughts. But Your physical power is not large enough to digg deep into the system. So Kuba is right. The three masses should in general move. They move each. The solution to ...


9

Two discs with an aspect ratio of 1: 2. The lower disk is grounded, the potential is on the upper disk $U=1$. On the left is the distribution of potential, in the center is the distribution of the electric field, on the right is the distribution of the electric field on the grounded plate. Needs["NDSolve`FEM`"]; par = {H -> 1./4, h -> 1./10, l1 -> ...


3

Use code ode1[x0_, y0_] := NDSolve[{x'[n] == 2 (1 + (3 \[Gamma] - 2)/2 (1 - y[n]) - (3 \[Gamma])/2 x[n]) x[n], y'[n] == 2 ((3 \[Gamma] - 2)/2 (1 - y[n]) - (3 \[Gamma])/2 x[n]) y[n], x[0] == x0, y[0] == y0} /. \[Gamma] -> 1, {x, y}, {n, -0.7, 0.54}, MaxSteps -> Infinity] sol[1] = ode1[-0.5, 1.5]; sol[2] = ode1[1, 0]; sol[3] = ...


Top 50 recent answers are included