Community RSS Feed
http://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Numerical Computation sorted by active[✓] Perform optimization with a strange constraint?
http://community.wolfram.com/groups/-/m/t/1270736
Consider the following code:
Table[NMaximize[{NIntegrate[(a*(1 - 0.25*z - (1 - 0.25)*x)*x +
a*(0.25*z - y + (1 - 0.25)*x)*y)/b, {a, 0, b}],
z = Min[1, (x - y*0.3)/(1 - 0.3)], b*(1 - y) <= 1,
0 <= y <= x <= 1}, {x, y}], {b, 1, 1.5, 0.1}]
I am trying to numerically solve an optimization problem (for x and y, for some b values). The problem has an integration in it. Interestingly, there is another variable z, which is a function of x and y, but cannot be greater than 1 (therefore I use Min function).
Integration have issues because of the Min function. Any ideas?
Cheers,
OvuncOvunc Yilmaz2018-01-22T21:35:55ZUse the numbers found in an optimization problem somewhere else?
http://community.wolfram.com/groups/-/m/t/1268030
Hello all,
Let's say we solve maximization problem and create a table for a specific range. An example:
c1 = Table[NMaximize[{(x*y - y^2 + x - x^2)*a/2, 0 <= y <= x <= 1, a*(1 - y) <= 1}, {x, y}], {a, 1, 6, 0.1}]
Now resulting table have elements in a form such:
{0.166667, {x -> 0.666667, y -> 0.333333}
In order to solve another problem, I need to use these x and y values. How can I call them in a different place?
Best, Ovunc
p.s. I took the table to Excel, created three rows. I imported the Excel file into Mathematica, but this time I cannot convert it to the matrix form I am interested in.Ovunc Yilmaz2018-01-18T19:59:48ZSingularity in NDSolve?
http://community.wolfram.com/groups/-/m/t/1267279
Hi, I am trying to plot the angles of a spherical pendulum fixed to a oscillating cart. I have derived the equations of motion, when I try to solve the equations using "NDSolve", following error occurs:
> `NDSolve::ndsz: At t == 0.1374350849846401`, step size is effectively zero; singularity or stiff system suspected.`
Have you got an idea?
(*Equations of motion for spherical pendulum fixed to oscillating cart*)
Remove[x, L, w , A]
(*Define equations of motion*)
eq1 = θ''[t] - ρ'[t]^2*Sin[θ[t]]*Cos[ρ[t]] - x''[t]/L*Cos[θ[t]]*Cos[ρ[t]] - (g*Sin[θ[t]])/L;
eq2 = L*x''[t]*Sin[θ[t]]*Sin[ρ[t]] - L^2*Sin[θ[t]]*(ρ''[t]*Sin[ρ[t]] + 2*ρ'[t]^2*Cos[ρ[t]]);
eq3 = -A*w^2*Cos[w*t] - x''[t];
(*x is the cart-position, θ and ρ the angles of the pendulum*)
(*Give numerical values for constants*)
A = 1;
g = 9.81;
L = 1;
w = 7;
(*Solve the equations using NDSOlve*)
sol = NDSolve[{eq1 == 0, eq2 == 0, eq3 == 0, θ[0] == 1, θ'[0] == 0,
ρ[0] == 1, ρ'[0] == 0, x[0] == 0, x'[0] == 0}, {θ, ρ}, {t, 0, 10}];
Plot[{Evaluate[θ[t] /. sol], Evaluate[ρ[t] /. sol]}, {t, 0, 10}]Jonas Hamp2018-01-18T09:40:25Z[✓] Handle discontinuities at the boundary in DSolve and NDSolve?
http://community.wolfram.com/groups/-/m/t/1266614
I feel like there's an easy answer to this. Laminar flow in a cylinder:
DSolveValue[mu/r D[r u'[r], r] == dp, u[r], r]
c1 log(r)+c2+(dp r^2)/4/mu
(*log[0] is -infinity, but apply boundary conditions sets c1=0:*)
DSolveValue[{mu/r D[r u'[r], r] == dp,u'[0]==0,u[1]==0}, u[r], r]
dp/4/mu (r^2-1)
In DSolve it evaluates fine but with the error "For some branches of the general solution, unable to compute the limit at the given points. Some of the solutions may be lost"
NDSolve fails with a 1/0 error. What's the best way of handling this? I have a more difficult problem I need to resolve where one of the dependent variable goes to zero at the boundary and is in the denominator (the numerator goes to zero faster).Eric Smith2018-01-16T15:40:54Z[✓] Use NDSolve to solve three dimensional (t,x,y,) pde?
http://community.wolfram.com/groups/-/m/t/1266574
Consider the following code:
Clear[x, t, xMin, xMax, TMax, yMin, yMax];
TMax = 3.73; xMin = -Sqrt[2] Pi; xMax = -xMin; yMin = -Sqrt[
2] Pi; yMax = -yMin;
eqn = D[h[t, x, y],
t] == -Div[Grad[h[t, x, y], {x, y}]/h[t, x, y], {x, y}] -
Div[Grad[Laplacian[h[t, x, y], {x, y}], {x, y}]*h[t, x, y]^3, {x,
y}];
bcs = {h[0, x, y] == 1 - 0.1 Cos[Sqrt[2]/2*Sqrt[x^2 + y^2]],
h[t, x, yMin] == h[t, x, yMax], h[t, xMin, y] == h[t, xMax, y]};
hsol = NDSolveValue[{eqn, bcs},
h[t, x, y], {t, 0, TMax}, {x, xMin, xMax}, {y, yMin, yMax}]
******************************************************
The above code can be run but show no results when I try to plot it using Plot3D,like: Plot3D[hsol[0, x, y], {x, xMin, xMax}, {y, yMin, yMax},
PlotRange -> All]. Does anyone can help me with this? Thanks a lot.Yixin Zhang2018-01-16T11:27:46Z