Tag Info

Hot answers tagged

10

SetSystemOptions[ "ReduceOptions" -> {"DiscreteSolutionBound" -> 10000000}]; f[n_] := Module[{eqn}, eqn = (n1 + n3 + n5 == n2 + n4 + n6) && (n1 >= n2) && (n1 - n2 + n3 - n4 >= 0) && (n1 <= n) && (n1 - n2 + n3 <= n) && (n1 - n2 + n3 - n4 + n5 <= n) && (2 n <= n1 + ...


9

Here is one way: Manipulate[Block[{t1, t2, v1, v2, pt, pts}, t1 = {xm, ym}; t2 = {xn, yn}; {v1, v2} = p; pt = {t1, t2} /. NSolve[{(t2 - v2).(t2 - t1) == 0, (t1 - v1).(t2 - t1) == 0, (t1 - v1).(t1 - v1) == r1^2, (t2 - v2).(t2 - v2) == r2^2}, {xm, ym, xn, yn}, Reals]; pts = Select[pt, Sign[(#[[1]] - v1).(#[[2]] - v2)] == 1 &]; ...


7

It seems me that the answers of mathe and Yves Klett do not meet expectations of the author. The latter is as much as I have got it, to have a short analytical expression for the solution. Probably the author has an intention to use the result further in some analytical calculations, or to do something comparable. Am I right? If yes, one should first of ...


6

The current answer by Chip Hurst deals well with the case of solving for the roots of a (possibly) complex-valued function of a real variable, which NSolve struggles with. However, the more general case of finding roots of a complex-valued equation of a complex variable is a good bit more complicated, and it requires a stronger approach. One thing to note ...


6

Solve[L == (3 W)/2 + 3/2 Sqrt[4 A^2 Pi^2 + W^2] - Sqrt[ 6 A^2 Pi^2 + 3 W^2 + 5 W Sqrt[4 A^2 Pi^2 + W^2]]/Sqrt[2], W, Quartics -> False] or Solve[L == (3 W)/2 + 3/2 Sqrt[4 A^2 Pi^2 + W^2] - Sqrt[ 6 A^2 Pi^2 + 3 W^2 + 5 W Sqrt[4 A^2 Pi^2 + W^2]]/Sqrt[2], W, Reals]


6

I am not getting the same results in version 10. Also I see no problem with the results already indicated, and I'll say a bit about that as we proceed. Here is what I obtain in version 10. smatrix = {{1 - 2.96392/u2, 0.0000196744/u2}, {1. - 2.96392/u2, -2.11737*10^-10 + 0.0000196746/u2}}; det = Det[smatrix]; sols = Solve[det == 0, u2] During ...


5

Oh, you just incorrectly type the equation in Mathematica, your second one should be: 1 - 2 d + 2 d b + 2 e b == 0, check the 2 d term. It's not a 2 b. Solve[{2 + 2 a d + 2 a e == 0, 1 - 2 d + 2 d b + 2 e b == 0, 1 + 2 d c + 2 e c == 0, a^2 + b^2 + c^2 - 2 == 2 b, a^2 + b^2 + c^2 - 2 == 0}, {a, b, c, d, e}] (* {{a -> -2 Sqrt[2/5], b -> 0, c ...


5

Use the method option Method -> {"IndexReduction" -> {Automatic, "ConstraintMethod" -> "Projection"}} This forces the equations to be incorporated as constraints. See tutorial/NDSolveDAE#128085219. Depending on the version, you might need to us Rationalize to make the coefficients exact to avoid 1/0 errors. (In general, I avoid machine ...


5

As @b.gatessucks said in the comments, there are two issues with your code. First, you'll need to define z as a function with SetDelayed, and also add in ComplexExpand: z[x_, y_] := ComplexExpand @ Abs[((1/3 x + I y) - 2 x)/(I y + 1/x)]; z[x,y] Sqrt[(25 x^2)/9 + y^2] / Sqrt[x^-2 + y^2] Additionally, ContourPlot holds its arguments (i.e. it doesn't ...


5

What have you tried so far? You can use Solve to solve for θ. Solve[a1 Sin[2θ] + a2 Sin[2ϕ] + a3 Cos[2θ] + a4 Cos[2ϕ] == a5, θ] /. _C -> 0 Since your equation have periods π, you can just let ϕ run between 0 and π, and add arbitrary multiples of π to the solutions. Another way You can plot it using ContourPlot. I used bounds 0 < θ < π and 0 ...


4

You may use the following: Reduce[(1 - I)/Sqrt[2] == ExpToTrig[Exp[I alpha]]*Tan[beta] && 0 < beta < Pi && 0 < alpha < 2 Pi]; {ToRules[%]} // FullSimplify {{alpha -> (7 π)/4, beta -> π/4}, {alpha -> (3 π)/4, beta -> (3 π)/4}} Although I'm not sure why it doesn't work without the ExpToTrig[] thing


4

Maybe something like this? I don't know if this is what you meant? sol=Reduce[x1 >= 0 &&-4*x1 <= 16 &&4*x1 >= 16 ||x1 <= 0 &&4*x1 <= 16 &&-4*x1 >= 16, {x1}]; sol[[1, 2]] (*-4*) sol[[2, 2]] (*4*)


4

eqn1[w_, x_, y_, z_] := 3 x y'[x] - 2 z^2 + 3 w y[x] == 5 x eqn2 = eqn1[1, x, y, 2] sol = NDSolve[{eqn2, y[1] == 2}, y, {x, 1, 2}] Then, to get x when y[x] is 3: Solve[(y[x] /. sol) == 3, x] {{x -> 1.556466}} OR as suggested by Mr.Wizard, you can use FindRoot FindRoot[(y[x] /. sol) == 3, {x, 1}] {x -> 1.556466}


4

eqns = {(300 (1920 + 8 x - 21 y) (-80 + y))/(7 (30 + x)^3) + (2025 (208 x + 5 (-3446 + y)))/(52 (90 + y)^2) + (300 (4500 + 80 x - 21 z) (-100 + z))/(7 (30 + x)^3) - (1521 (15425 - 539 x + 50 z))/(539 (39 + z)^2) == 0, -((300 (1920 + 8 x - 21 y))/(7 (30 + x)^2)) - (2025 (-85 + x) (208 x + 5 (-3446 + ...


4

You have a typo in your second equation. eqns = {2 + 2 a*d + 2 a*e == 0, 1 - 2 e + 2 d*b + 2 e*b == 0, 1 + 2 d*c + 2 e*c == 0, -2 + a^2 - 2 b + b^2 + c^2 == 0, -2 + a^2 + b^2 + c^2 == 0}; Solve[eqns, {a, b, c, d, e}] // Simplify


3

With the slightly modified input pde1 = 3*D[z[w, x, y], y] == 2 (z[w, x, y] - 1) + (1 - y^2 w) x soln1 = z[w, x, y] /. First@DSolve[pde1, z[w, x, y], {w, x, y}] soln5 = soln1 /. {x -> 0} eqn1 = soln5 == 2.7*soln1 and a replacement of the integration constant ContourPlot[ x /. Solve[eqn1 /. {C[1][w, 0] -> 1, C[1][w, x] -> 1}, x, Method -> ...


2

Setting expr equal to the OP's expression, the equations are given by Flatten@expr == 0. expr = {{(300 (1920+8 x-21 y) (-80+y))/(7 (30+x)^3)+(2025 (208 x+5 (-3446+y)))/(52 (90+y)^2)+(300 (4500+80 x-21 z) (-100+z))/(7 (30+x)^3)-(1521 (15425-539 x+50 z))/(539 (39+z)^2)},{-((300 (1920+8 x-21 y))/(7 (30+x)^2))-(2025 (-85+x) (208 x+5 (-3446+y)))/(52 ...


2

Version 9. Specifying a domain may speed things up or may greatly slow things down. Cases[N[Solve[{...}, {x,y,z}], 30], {x->_Real, y->_Real, z->_Real}] Result in 28 seconds. N[Solve[{...}, {x,y,z}, Reals], 30] Stopped it after 6 hours with no result.


2

You are getting no answers at all. Lets get you some answers quickly, by giving up going to Infinity first. In[1]:= j = 8; NMinimize[ Norm[3/2 Sum[k^(5/2) E^-((B+H/2)k) Integrate[x^2 E^(3/2 H x^2 k), {x, 0, 1}], {k, 1, j}]/ Sum[k^(5/2) E^-((B+H/2)k) Integrate[E^(3/2 H x^2 k), {x, 0, 1}], {k, 1, j}]-1/2-H]+ Norm[ Sum[k^(3/2) E^-((B + H/2) k) ...


2

I have to post a separate answer because my approach in this one is very different from my other answer's. It is based largely on the method that Frank Kampus used here to solve a sudoku, using Backtrack from the Combinatorica package in one method, and Outer/Select in the other method. Warning: it's a long answer. I managed to solve the puzzle but only ...


2

Below is my (unsuccessful) attempt at solving the problem. I think this is an interesting problem that the MMA experts on here could help solve, and in the process will hopefully reveal the capabilities of MMA. 1) I borrowed from the answer in the linked Q&A the fact that the total of all elements in the matrix will be 468. This means that the row ...


2

There is a problem with boundary conditions. Changing them and fixing a few typos you can get: eq = {-f[x]^2 + f[x]^4 + x^4 Derivative[1][f][x]^2 + (x^3) /(-1 + x) f[x] ((1 - 2 x) f'[x] - (-1 + x) x f''[x]) == 0, f[1/10] == 1, f'[1/10] == -1/10}; eq // Column // TraditionalForm s = NDSolve[eq, f, {x, 1/10, 9/10}]; Plot[Evaluate[f[x] /. ...


2

added some numeric interval limits for y Clear@"`*" eqn2[w_, x_, y_, z_] := 3*z'[y] == 2 (z[y] - 1) + (1 - y^2 w) x eqn3 = eqn2[1, 1, y, z] sol = NDSolve[{eqn3, z[0] == 1}, z[y], {y, 1, 5} (*added interval*)] Plot[Evaluate[z[y] /. sol], {y, 1, 5}, PlotRange -> All] z3 = z[y] /. sol /. y -> 3


2

I would suggest: PayOffCall Select a limit large enough for your purposes: lim = 100.; Compute the values: v1 = {#, PayOffCall[#, 50, 2]} & /@ Range[lim]; Create an interpolating function: f = Interpolation[v1, InterpolationOrder -> 1]; Plot[f[x], {x, 1, lim}] We can evaluate f for arbitrary points {f[1.4], f[61.3]} {-2., 9.3} ...


2

One shotgun approach is to sic Simplify or FullSimplify onto your solution: sol1 = Solve[ L == (3 W)/2 + (3 Sqrt[4 A^2 Pi^2 + W^2])/2 - Sqrt[6 A^2 Pi^2 + 3 W^2 + 5 W Sqrt[4 A^2 Pi^2 + W^2]]/Sqrt[2], W]; sol2 = Simplify[sol1]; LeafCount /@ {sol1, sol2} ByteCount /@ {sol1, sol2} {3849, 3077} {111720, 92840} (Note: FullSimplify is still ...


2

The reasons for the change in the behavior of ParallelTable are subtle. The main source of the problem is that in funcB, the argument k_ is not protected with ?NumericQ like this: funcB[t_?NumericQ, k_?NumericQ] := (* a solution *) funcB[t, k] = Exp[NIntegrate[funcA[et, k], {et, tini, t}]] But more on that later. The problem does not appear in the ...


2

Here's another way (in M10 only): Cases[ NumberLinePlot[x1 >= 0 && -4*x1 <= 16 && 4*x1 >= 16 || x1 <= 0 && 4*x1 <= 16 && -4*x1 >= 16, x1], Point[{x_, _}] :> x, \[Infinity] ] (* {-4, 4} *)


2

I don't want to compete with Algohi's nice answer, but - as to my experience - Reduce can be almost always replaced with Simplify or FullSimplify: res = Simplify[x1 >= 0 && -4*x1 <= 16 && 4*x1 >= 16 || x1 <= 0 && 4*x1 <= 16 && -4*x1 >= 16] Cases[res, _?NumberQ, -1] {-4, 4}


2

@Kellen Myers comment is useful. Since your coefficients are reals you have an approximate solution Whenever a number carries a decimal point as your solution output, it is an approximate real. 0.//Head (* out *) Real As mentioned in documentation center for Real you may change an approximate real number in an exact rational number by ...


1

here is an example using a prior solution as the starting value for the next step: polyn[x_?NumericQ, n_] := Normal@Series[ Sin[y], {y, 0, n}] /. y -> x sol[7] = x /. FindRoot[ polyn[x, 7], {x, 3}] Do[ sol[n] = x /. FindRoot[ polyn[x, n], {x, sol[n - 1]}], {n, 8, 20} ] DiscretePlot[sol[n] - Pi, {n, 7, 20}, PlotRange -> All]



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