5

In this code below I'm doing a repeated greedy search. This gives a much better route than FindShortestTour which does not allow re-visited nodes. We start by randomly permuting our list of targets. We then get the first remaining target and find the shortest path from our current node to the target, recording the path as we go. Any other targets we happen ...


4

Is this what you're looking for? expr = ((-2 b m - 2 w1 - 5 w2 + 3 m w2 + 7 w3 - 3 m w3 + Sqrt[4 b^2 m^2 + (-2 w1 + w2 - 3 m w2 + w3 + 3 m w3)^2 + 4 b m (2 w1 + (5 - 3 m) w2 + (-7 + 3 m) w3)])/(6 (-1 + m) (w2 - w3))); assumptions = w2 > w3 && w1 > 2 w2 - w3 && 0 < m < 1 && w3 > b > 0; Reduce[ ...


4

With such a low number of places ($n=3$) to visit the number of orderings ($n!=6$) is low enough for an exhaustive search. (given distances that are the same in both directions, the number is actually $n!/2=3$). Of course the possible orderings of the stores can be generated by Mathematica: Permutations[{Bookstore, PostOffice, Supermarket}] $\longrightarrow$...


4

You do not need numerical guess to find the minimum. Setting both partial derivatives to zero and eliminating variable a is enough. f = Log[a, 4 (3 b - 1)/9] + 8 (Log[b/a, a])^2 - 1 // PowerExpand[#, Assumptions -> {0 < a < 1, 1/3 < b < a}] &; ee1 = (D[f, a] // Together // Numerator) // PowerExpand[#, Assumptions -> {0 < a &...


4

[out of topic] Hi, I spent quite some time writting that for you: https://www.reddit.com/r/mathematics/comments/hv9nju/how_do_i_explain_my_question_and_give_it_more/fysdmpt/ Which should cover a good deal of the math and presentation part (the presentation part got better in the meantime). Since you deleted your account there and I can't DM via Steack ...


3

Since Abs cannot be differentiated and you are dealing with real x, either change Abs[x] to Sqrt[x^2] Clear["Global`*"] f[x_] = Piecewise[{{x*Abs[x], x <= 0}, {x*Log[x], x > 0}}] /. Abs[real_] :> Sqrt[real^2]; f'[x] // FullSimplify Or, alternatively use RealAbs f2[x_] = Piecewise[{{x*RealAbs[x], x <= 0}, {x*Log[x], x > 0}}]; ...


2

We can speed things up by not recomputing distances to previous objects. This requires fixing the seed points beforehand. The following is fast enough that you can get away with a much higher seed size, depending on how many balls you're looking to find. Also note that each iteration gets faster because we remove seed points that are no longer in the region. ...


2

As indicated by Henrik Schumacher the constraints are fullfilled numerically constraint = {0 <= e <= 1, 0 <= f <= 1, e^2 + f^2 == 1, e <= g <= 1,0 <= h <= f, Sqrt[(g - e)^2 + (f - h)^2] <= 1, g^2 + h^2 <= 1}; mini = NMinimize[{((e*(1 - Sqrt[(g - e)^2 + (f - h)^2]) + (g - e)*(1 -Sqrt[f^2 + e^2])) + (h*(1 -Sqrt[(g - e)^2 + (f - h)...


2

That's is quite likely impossible (but depends on the other constraints). Linear programs have a convex polytope as feasible set because the set of feasible points is an intersection of half spaces and because intersections of convex sets are conves. The feasible set that you describe is not convex. See here for a 3-dimensional example where we want at least ...


1

This NMinimize::nosat documentation page explains the there are no solutions found if this warning message is displayed. NMinimize[{((e*(1 - Sqrt[(g - e)^2 + (f - h)^2]) + (g - e)*(1 - Sqrt[f^2 + e^2])) + (h*(1 - Sqrt[(g - e)^2 + (f - h)^2]) + (f - h)*(1 - Sqrt[g^2 + h^2])))/((g + f)* Max[1 - Sqrt[(g - e)^2 + (f - h)^2], ...


1

Here's how you can do it by adding some slack into the constraints and punishing slack in the objective: SeedRandom[1]; (* the function you're trying to minimize *) objective = ((e*(1 - Sqrt[(g - e)^2 + (f - h)^2]) + (g - e)*(1 - Sqrt[f^2 + e^2])) + (h*(1 - Sqrt[(g - e)^2 + (f - h)^2]) + (f - h)*(1 - Sqrt[g^2 + h^2])))/((g + ...


1

There are several problems if to attempt to solve this question with the ordinary methods like FindShortestTour. Mathematica traditionally annoys first time users with the travelling salesman alike problems. Many authors have therefore published in their introductory books handwritten and so specially adopted and adaptable routine to solve this for their ...


Only top voted, non community-wiki answers of a minimum length are eligible