Tag Info

New answers tagged

1

Why not take a suitable Mathematica comand literally? Let y as a function of x be given by y = x^x (1 - x)^(1 - x); Aren't we just looking for x as a function of y? So let's simply write down what we want xx = InverseFunction[#^# (1 - #)^(1 - #) &]; This function gives the symbolic solution the OP asked for. Indeed, we can take values ...


4

One can use GroebnerBasis to eliminate variables, and it is set up in a way that tends to be more efficient than Eliminate (which may be using some dated technology). polys = {-a[1] - 2 a[2] c[1] - 3 a[3] c[2] - 4 a[4] c[3], 1 - a[1] c[1] - 2 a[2] c[2] - 3 a[3] c[3] - 4 a[4] c[4], 2 c[1] - a[1] c[2] - 2 a[2] c[3] - 3 a[3] c[4] - 4 a[4] c[5], 3 ...


2

This question is nearly a duplicate of Behavior of Reduce with variables as domain but since it is being addressed separately I shall answer here as well. In the documentation for version 7 (which I used for an extended time) it starts with: In version 8 this was changed to a domain specification, but where distinguishable the older syntax still works. ...


5

Just for variety, but as Nasser has illustrated this is dealt with well with well with Solve and NSolve specifying Reals domain (and I have upvoted his answer). You can use root approximations from Mesh points of plot of points to inform FindRoot. You can find roots of polynomial within domain $\sqrt{2}<r<\sqrt{2}$. The plots are very helpful ...


4

Just to complement the topic: Solve[ Eliminate[eqn == 0, {a1, a2}], {c3, c4}]


9

Maple's fsolve missed one real root. You can see that by using solve with AllSolutions options restart; eq:= -x^2 + 2*x + 5 + (x^2 + 2*x - 1)* sqrt(2 - x^2)=0; solve(eq,x,'AllSolutions'): evalf(%); #pick the non-complex roots select(type,[%],numeric); So this is wrong: fsolve(eq,x,real) # -1.000000000 And Mathematica is correct: ...


0

you can try FindRoot f = Interpolation[{1, 2, 3, 5, 8, 5}]; sol = FindRoot[f[x] == 2.5, {x, 3}] (*{x -> 2.5641}*) Plot[{f[x], 2.5}, {x, 1, 6}, GridLines -> {{x /. sol}, None}]


3

Method 1 You can reverse the value of {x,y} to {y,x}, and then interpolate them. Note:In this case, the value of $y$ cannot be duplicate lst= {{3.61648, 5.64818}, {7.53428, 4.52803}, {4.21088, 2.35117}, {4.48224,1.08325}, {4.63735, 5.5877}, {2.24299, 3.10376}} x = Interpolation[Reverse /@ data]; x[3.] 2.44086 Method 2 If the the values of $y$ ...


4

You can use a plot to find the roots and then follow up with FindRoot to get precise solutions. Here I'll use ContourPlot to plot where the real part vanishes and use MeshFunctions to find where the imaginary part is simultaneously zero. cp = Show[ Table[ ContourPlot[ Evaluate[Re[WhittakerW[1, (I α)/2, 10] /. α -> a + b I] == 0], {a, a1, a1 ...


4

This can actually be solved analytically (DSolve), noting it is only algebraic in t: urt[r_, t_] = Simplify[(u /. First@DSolve[{kh t D[u[r], r] - 2 Pi a u[r] + 2 Pi a == 0, u[302] == 21/100}, u, r])[r]] 1 - 79/100 E^((2 a Pi (-302 + r))/(kh t)) Plot3D[urt[r, t] /. {kh -> 10^-6, a -> 300}, {t, 10, 200}, {r, 298, ...


2

Yes, if you include the intermediate variables in the Solve list then Mathematica will try and find solutions for those as well: sys = {{c1, c2}, {c1, c3}, {c1, c4}, {c2, c3}}.{a1, a2} == {5, 2, -4, -3}; Solve[sys, {c3, c4, a1, a2}] Gives: {{c3 -> 1/5 (3 c1 + 2 c2), c4 -> 1/5 (9 c1 - 4 c2), a1 -> 5/(c1 - c2), a2 -> -(5/(c1 - c2))}}


7

It turns out Solve[] has a feature that doesn't appear in the online documentation that I could find. A third argument can be added, a list of variables to be eliminated from the solution: Solve[eqns == 0, {c3, c4}, {a1, a2}] This yield the same output as above. And I have tested it on problems where solving for a1 and a2 (in order to eliminate them ...


4

Here is the implicit equation satisfied by (y,z). ratpolys = {z - (1 - t)^2 (-2 t^2 + 4 t + 1)/(2 (2 t^2 - 2 t + 1)), y - (t - 1) *Sqrt[1 - t^2]*(t^2 - 3 t + 1)/(2 t^2 - 2 t + 1)}; gb = First[ GroebnerBasis[ratpolys, {y, z}, t, MonomialOrder -> EliminationOrder]] (* Out[93]= -135 y^4 - 1728 y^6 + 1024 y^8 - 720 y^4 z + 1536 y^6 z - ...


3

Elvira, I am going to put here what I had put together for an answer to your question. There is still something puzzling about your question though, and that is the fact that you are essentially recalculating the same integral twice, it seems to me. Here is what I mean: $$\text{firstIntegral}=\int_{x1}^{x2} \! f(x) \, \mathrm{d}x $$ Then you are looking ...


7

Yes, it is documented that the result of Reduce[expr, vars] always describes exactly the same mathematical set as expr, i.e. the result of the reduction is equivalent to the original system. Another way to state the above is In[1]:= s1 = c > 0 && ((d <= -2 - c && a > 0 && b > (-c - d)/a) || (-2 - c < d ...


4

Clear[m, n, c, d]; c = (m == 1 && n >= 0 && ((-1 + 3^n m)/(-1 + 2^n m) - (3^n)/(2^n)) > ((-1 + 3^(n + 1) m)/(-1 + 2^(n + 1) m) - (3^(n + 1))/(2^(n + 1)))); d = (n >= 0 && ((-1 + (3^n))/(-1 + (2^n)) - (3^n)/(2^ n)) > ((-1 + (3^(n + 1)))/(-1 + (2^(n + 1))) - (3^(n + ...


3

I think in the latest revision there may be missing a PatternTest (or ?): In[4]:= Clear[p30]; p30[vSysInput_?NumberQ] := Module[{eq2A, p, t, rGas, Tgas, vSys, parms, sol}, eq2A = p'[t] == rGas Tgas/vSys (-0.64*0.0012 p[t]); parms = {rGas -> 8.3144, Tgas -> 273, vSys -> vSysInput}; sol = ...


0

May be that will do: Clear[ss, n]; eq = L r^3 - 3 r + 6 M == 0; ss[L_, M_] = Solve[eq, r]; Manipulate[ Plot[{ss[L, M][[1, 1, 2]], ss[L, M][[2, 1, 2]], ss[L, M][[3, 1, 2]]}, {L, 0, 1}, PlotStyle -> {Red, Blue, Green}], {{M, 0.6}, 0, 1}] giving Have fun!


0

It works fine in Mathematica 10. Even as 3D Plot as function of parameters L and M: Plot3D[r /. NSolve[f[L, M, r] == 0, r, Reals], {L, -1, 1}, {M, 0, 10}]


1

f1, f2, and f3 are not equations themselves, but from what you show I think that you want to find roots to those expressions. In that case, FindRoot can do that VERY fast (I am using your definitions of f1, f2, f3): solutions = FindRoot[{f1 == 0, f2 == 0, f3 == 0}, {{x, 1*^60}, {y, 1*^60}, {z, 1*^60}}, MaxIterations -> 1000] (* Out: {x -> ...


4

By default FindRoot uses the "LineSearch" method of step control as described in the tutorial tutorial/UnconstrainedOptimizationLineSearchMethods. The default settings are FindRoot[Exp[1 - x] - 1, {x, 10.}, Method -> {"Newton", "StepControl" -> {"LineSearch", "CurvatureFactor" -> Automatic, "DecreaseFactor" -> 1/10000, ...


0

Only a partial solution.NDSolve can't solve with this initial conditions y(1) = 0.5 sol = NDSolve[{(1 + x)*(0.5*y[x]^(-0.5)*(x - y[x])^0.5 - 0.5*y[x]^0.5*(x - y[x])^(-0.5)) == -y[x]*(x - y[x])/y'[x], y[0.99] == 0.5}, y, {x, 0, 2}, AccuracyGoal -> 30, PrecisionGoal -> 30, WorkingPrecision -> 55] // Quiet; ODEequations[x_] := y[x] /. sol; g1 = ...


0

I believe that all you need to do is select the following method option in NDSolve Method->{"PDEDiscretization"->{"MethodOfLines",{"SpatialDiscretization"->"FiniteElement"}}}


1

Radicals are traditional bronze-age mathematics, but they aren't the nicest way to express the roots of a polynomial. Radical expressions are numerically unstable when a discriminant is near zero, and they often require complex arithmetic even for real results, as you've seen. In the space age, we have Root objects, one of the real gems of Mathematica. ...


2

In the NSolve rather than just limiting x to Reals, limit it to a finite interval of interest, say 2 < x < 6 f[x_, a_] = Power[x + a, x + a] - Power[x, x + 2 a]; data = Table[ {a, x /. NSolve[{f[x, a] == 0, 2 < x < 6}, x][[1]]}, {a, 1/10, 10, 1/10}]; ListLinePlot[data, AxesLabel -> {"a", "root"}]


4

tl;dr Don't expect NSolve to give sensible results for equations with no analytic solution. If you are interested in a "numerical math point of view", use FindRoot or a related function to solve numerically. NSolve tries to find a transformation to an equation it knows exact solutions for, then converts those solutions to machine-precision numbers when ...


0

Solve's core functionality is symbolic algebraic (polynomial) equations. Your equation is far from algebraic, and Solve can't find a transformation that would make it algebraic. Since you seem to want a numerical answer, a numerical method is probably more appropriate: FindRoot[Sum[(R[k, i, .00001]^1 + L[k, 1, i, .00001]^2)* Binomial[40, ...


1

Not an answer but too long for comment: If I modify slightly your input and choose 'n=2` n = 2; Solve[Table[{Subscript[β, 1] (1 - Subscript[a, i] - Subscript[b, i] - Subscript[c, i]) Sum[ Subscript[A, i, j] (Subscript[a, j] + Subscript[c, j]), {j, 1, n}] - Subscript[δ, 1] Subscript[a, i] + Subscript[δ, 2] ...


0

Ah, they finally implemented it in version 10, then! Here's a procedure I've been using since version 5, it might provide similar features in versions prior to the introduction of Value. (I'm not sure, but maybe I posted it on the MathGroup... so forgive me if this is not news) I had called it "ToValues". I gave it two options: Options[ToValues] = { ...


2

I'd use Root. First, put your polynomial in pure functional form: fpoly = Function[Evaluate[poly /. x -> #]] Now, note that Root rigorously orders roots, putting real roots before complex ones. This is a 36th order polynomial, so look at the 36th root: Im[Root[fpoly, 36]] == 0 (* False *)


11

There is a specific function called CountRoots, which does exactly what you want: CountRoots[poly, x] (* 12 *) You can then compare this number to the number of roots given by the length of the coefficient list: Length@CoefficientList[poly, x] - 1 (* 36 *)


3

You can also use FindInstance, specifying the domain over all reals pol = 331776*x^36 - 11943936*x^34 + 195747840*x^32 - 1932263424*x^30 + 12809871360*x^28 - 60216016896*x^26 + 206610186240*x^24 - 524928024576*x^22 + 991718940672*x^20 - 1386996203520*x^18 + 1415900528640*x^16 - 1026732589056*x^14 + 505483296768*x^12 - 158084628480*x^10 + ...


4

There is probably a better way to do this, but one can find the degree of a polynomial via the length of the CoefficientList, and one can get the number of real roots by adding up the multiplicities given by RootIntervals: poly = 331776*x^36 - 11943936*x^34 + 195747840*x^32 - 1932263424*x^30 + 12809871360*x^28 - 60216016896*x^26 + 206610186240*x^24 ...


3

I think that you can use RootIntervals to do what you want: poly = 331776*x^36 - 11943936*x^34 + 195747840*x^32 - 1932263424*x^30 + 12809871360*x^28 - 60216016896*x^26 + 206610186240*x^24 - 524928024576*x^22 + 991718940672*x^20 - 1386996203520*x^18 + 1415900528640*x^16 - 1026732589056*x^14 + 505483296768*x^12 - 158084628480*x^10 + ...


5

The coincidences of the hour and minute hand occur when the number of hours since midnight $h$ satisfies $\frac{1}{12}h = h - n$ for some integer $n$. (The left-hand side corresponds to the number of revolutions the hour hand has made; the right-hand side corresponds to the number of of revolutions the minute hand has made.) This can be rearranged to $h = ...


1

Perhaps, you mean Series[f[x], {x, x0, 4}] t1 = f[x0 + δ] == (Series[f[x], {x, x0, 4}] // Normal ) /. (x - x0) -> δ t2 = f[x0 + 2 δ] == (Series[f[x], {x, x0, 4}] // Normal) /. (x - x0) -> 2 δ (f'[x0] /. Solve[{t1, t2}, {f'[x0], f''[x0]}]) // First // Collect[#, δ, Simplify] & which eliminates the warning message. I enclosed what were ...


4

I have not spent sufficient time but perhaps. In the following, starting clock at 12:00 with red second hand, blue minute hand and green hour hand. "SM" animates first coincidence second and minute hand, "MH", minute and hour hands, "SH" second and hour hands. First number after after graphic is time to first coincidence in seconds and second is clock time. ...


8

Let's first define F1 to take only numeric arguments because otherwise FindRoot or other functions you might use on it will try to supply some symbolic arguments to it and result in uninteresting messages: Clear[F1] F1[x_?NumericQ] := NIntegrate[E^Sin[y x], {y, 0, 1}] Now plot the functions to see an expected starting point for solution search: ...


7

This can be solved via a numerical method called fixed point iteration reasonably quickly... FixedPoint[F1[#] - F2[#] + # &, 2, 100] (* result 4.609527035642726` takes about 0.327602 seconds on my machine *)


4

Such an equation cannot be solved symbolically by Solve, but a solution might be approximately determined with FindRoot. Looking at the left-hand side: Plot[(1 - ((-1 + x)^E x^(1 - x) Log[x]^-E)^(1/(-1 + E)))/(-1 + x), {x, 0, 10}] which has a (real) domain of x > 0, we see that the only integers for which the equation is likely to have a solution ...


8

Graphics`Mesh`MeshInit[]; eps = 1/1000000; pp = ParametricPlot[{Sin[10 t], Sin[9 t]}, {t, eps, 2 π}]; intersections = Graphics`Mesh`FindIntersections[pp]; Show[pp, Epilog -> {Red, PointSize[Large], Point@intersections}] Graphics`Mesh`FindIntersections[ParametricPlot[{Sin[100 t], Sin[99 t]}, {t, eps, 2 π}]] // Length // Timing ...


1

I find a workaround which can find all that exact self-intersections: sol = Solve[(100 (t1 - t2) == 2 k1 \[Or] 100 (t1 + t2) == (2 k1 + 1)) && (99 (t1 - t2) == 2 k2 \[Or] 99 (t1 + t2) == (2 k2 + 1)), {t1, t2}]; Flatten[({t1, t2} /. # /. Solve[(0 <= t1 < t2 < 2) /. #, {k1, k2}, Integers]) & /@ sol, 1]


29

Manipulate[ ParametricPlot[({Sin[n t1], Sin[(n - 1) t1]}), {t1, 0, 2 Pi}, Epilog -> {Red, PointSize[Large], Table[If[OddQ[i + j], Point[{Cos[Pi i/(2 (n - 1))], Cos[Pi j/(2 (n))]}]], {i, 2 n - 3}, {j, 2 n - 1}]}], {{n, 5}, 2, 20, 1}] General Case I We can generalize to the Lissajous curve specified by the two non-negative ...


17

One way (whew, there are a lot of intersections! -- here's a shorter version): sol = NSolve[{Sin[10 t], Sin[9 t]} == ({Sin[10 t], Sin[9 t]} /. t -> s) && 0 <= t < s < 2 Pi, {t, s}]; ParametricPlot[{Sin[10 t], Sin[9 t]}, {t, 0, 2 π}, Epilog -> {Red, PointSize[Large], Point[{Sin[10 t], Sin[9 t]} /. sol]}] ({Sin[100 t], ...


3

Just for fun: Using sampledata from other answers, you could approximate width from interpolation extracting mesh points (would not be robust for more complex continuous curves): ip[x_] := Interpolation[sampledata][x]; mx = Quiet@FindMaximum[ip[x], x]; pl = Plot[ip[x], {x, 0, 15}, MeshFunctions -> (#2 &), Mesh -> {{0.1 mx[[1]]}}]; ...


1

Sometimes it is better not to use too many constraints even if they appear to be "natural". Adopting the strategy to use the fewest number of constraints we obtain the solutions $Version (* Out[12]= "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" *) 1) Solving for a Reduce[{a^b c^b == c}, a, Reals] (* Out[1]= (b > 0 && c == 0 ...


2

As @belisarius noted, the problem here is that x and y were defined at an earlier point in the Mathematica session. This kind of error can be prevented like so: Block[{x, y}, Solve[{x + y == 6, x^2 == y}, {x, y}]] which localizes x and y, correctly giving: {{x -> -3, y -> 9}, {x -> 2, y -> 4}} This problem is discussed in more detail in ...


2

It appears to be correct: ins = n /. FindInstance[Floor[(3/2)^n] == Floor[(-1 + 3^n)/(-1 + 2^n)] , n, Integers, 20 ] {4811, 1040, 4155, 469, 4050, 733, 4039, 1415, 2799, 2403, 2571, 4168, 252, 207, 4804, 2239, 4660, 535, 1603, 4756} (Mod[((3^# - 1)/(2^# - 1)), 1] - Mod[(3/2)^#, 1] == (3^# - 1)/(2^# - 1) - (3/2)^#) & /@ ...


2

Micheal Seifert has already addressed the numerical approach. I wanted to add a different general approach that relies on the assumption that your peaks have a known shape, e.g. a Gaussian as you suggested. You could then estimate the positions at a given fraction $n$ of the height as follows: FullSimplify[ PDF[NormalDistribution[mu, sigma], x] == ...


4

It sounds like your problem would be resolved by defining the Interpolation itself as a function of x (or whatever variable you like.) This allows you to feed it into functions like FindMaximum and FindRoot much more easily. For example: sampledata = Table[{x, PDF[NormalDistribution[5, 1.5]][x]}, {x, 0, 15, 0.5}] interpfn[x_] = ...



Top 50 recent answers are included