# Tag Info

1

One might use integer linear programming (one would perhaps be foolish to do so, but one might all the same). I am posting this not as a competitive choice for this problem, but to give some idea of the possibilities. And I do not by any means rule out that there might be significant improvements to be had. As it stands, this is around 20x slower than what ...

2

{{x1, y1}, {x2, y2}} = Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}][[All, All, -1]] (* {{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}} *) {x1, y2} (* {(-11181- Sqrt[2242057]) / 74498, 1 / 386 (13 + Sqrt[2242057])} *)

1

Amplifying on @belisarius' excellent answer eqn = 9^(x + 4) == 27^(1 - x); In the following, C[1] is an arbitrary integer constant sol1 = Assuming[Element[C[1], Integers], Solve[9^(x + 4) == 27^(1 - x)] // Simplify] {{x -> -1 + (2 I [Pi] C[1])/Log[3]}, {x -> ( 2 I [Pi] C[1] + Log[-(1/3) (-1)^(1/5)])/Log[3]}, {x -> ( 2 I [Pi] C[1] + Log[1/3 ...

3

If you are not too concerned about the possibility of denominators vanishing, could remove them first. The Numerator[Together[...]] below is for that purpose. It might also be better to use exact input since Together and approximate numbers do not always play nice together. But in this case it seems to work out. Your example then runs to completion in a ...

1

I would recommend using Reduce instead of Refine. Also, you might as well cancel the factors (1+g)^(-m-w) and Q which are positive. Then, since g > 0 and m and w are independent positive real numbers, we may as well replace {(1 + g)^m -> u, (1 + g)^w -> v} to simplify its human readability. The conditions translate to u > 1 and v > 1. ...

1

Given that the plot of h[-(Sqrt[2]*π)/2, t] looks something like this, and that the differential equation has a singularity at h == 0, one might expect that NDSolve ought not to continue the solution to the max time the OP sets, which is t == 6. NDSolve might do it, but that would be because of numerical error when h is close to zero (insufficient ...

0

Let's define your three terms: {eq1, eq2, eq3} = {(2 (-1 + w + G) (4 (-1 + w) w + (4 + w (4 + 3 w)) G) - w (4 - 8 G + w (-14 + 6 G + w (10 + 3 G))) Ep + (-2 + w) w (2 + 3 w) Ep^2)/(4 (-2 + w) (-1 + w) w (2 + w) (2 G - Ep)), -(((-1 + G + w (1 + G - Ep)) (2 - 2 G + w (-2 + Ep)))/(2 (-1 + ...

4

UPDATE: version 10.0.1 on a Mac produces the same behavior. An extended comment and observation. $Version "10.0 for Mac OS X x86 (64-bit) (June 29, 2014)" The double integral evaluates only with integration over c as the outer integral int1 = Integrate[1/(E^((a - c)^2 + (b - c)^2)), {c, 0, 1}, {b, -Infinity, Infinity}] Investigating the ... 3 function = c1 # + c2 #^2 + cn #^3 & ; constraints = {function[1] == 5, function'[-1] == 3, function''[1] == 1}; Solve[constraints] (* {{c1 -> 97/22, c2 -> 7/11, cn -> -(1/22)}} *) 3 Ok, here you have it, but in the future this kind of questions will most likely be closed because the main problem arises from very basic errors. You can't expect others do the debugging for you. Take a look at the functions' definitions. {UT1, RA1, MM1, Z, MU, a1, L} = Transpose[RandomReal[{0, 1}, {10, 7}]]; dt = 1; rvsum1[1] = 5320007.301; rvsum1[i_] := ... 2 I am not sure what you are trying to do exactly, but this works fine: ContourPlot[w[x, y, z] /. z -> int[x, y], {x, 0, 8}, {y, 0, 8}] 1 Working backward: You never gave w1 any arguments within ContourPlot (to fill its parameters). The output of z1[x, y] is not a replacement rule. The output of int[x, y] is not a replacement rule. If you give the exact series of replacement that you wish to implement I can help you accomplish it. 2 Manipulate[Block[{x1, y1, x2, y2}, {{x1, y1}, {x2, y2}} = p; Show[Graphics[{Circle[{x1, y1}, r1], Circle[{x2, y2}, r2]}, PlotRange -> 6, Frame -> 1], ContourPlot[ r1^2*((x - x2)^2 + (y - y2)^2) - 2*r1*r2*((x - x1)*(x - x2) + (y - y1)*(y - y2)) + r2^2*((x - x1)^2 + (y - y1)^2) - (-x*y1 + x*y2 + x1*y - x1*y2 - ... 9 Although I don't know exactly why Refine fails in this example, Reduce can often help when simpler methods fail. Here, I feed it the desired statement together with the assumptions which are specified in Assuming: statement = x + (1 - x) (1 + y)^z > 0; Assuming[0 < x < 1 && 0 < y < 1 && 0 < z < 1, ... 5 Forgive me if this is not useful but sometimes I find value in using Interval in such problems: x = y = z = Interval[{0, 1}]; x + (1 - x) (1 + y)^z Interval[{0, 3}] Interval represents a closed interval rather than the open intervals in your example so this is not equivalent, nevertheless it may help to find the bounds of an expression. 0 Did you try Solve[q == l^(a + b) ((w b)/(r a))^b // PowerExpand, l] Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >> {{l -> (a^b b^-b q r^b w^-b)^(1/(a + b))}} 1 First we construct some helpers: f[x_] := E^(-x) yval = f[2] 1/E^2 h[x_] := 1 v[t_] := 2 Vertical lines can be constructed with ParametricPlot: ParametricPlot[{v[t], t} , {t, yval, 1.} , PlotStyle -> {Darker[Red], Thick} , PlotRange -> {{-.5, 2.5}, {0, 1.5}}] Putting it all Together: Show[Plot[{f[x], h[x]} , {x, 0., 2.} , ... 2 ClearAll[myCount]; SetAttributes[myCount, Listable]; myCount[deg_, quant_] := (CountRoots[#, \[FormalX]] & /@ ((Array[\[FormalX]^# &, deg + 1, 0].#) & /@ RandomVariate[NormalDistribution[], {quant, deg + 1}])) Needs["ErrorBarPlots"]; ErrorListPlot[{Mean@#, StandardDeviation@#} & /@ myCount[Range@30, 100], PlotRange -> ... 6 There are a number of issues with your code. First, GaussianDistribution is not a built-in function; I think you want to have NormalDistribution in combination with RandomVariate. Secondly, SetDelayed (:=) returns Null (or$Failed if something went wrong), so y has the value Null after your second line. Hence the lines after that don't work. Allow me to ...

2

Show[ RegionPlot[y > E^-x && y < 1 && x < 2, {x, -1, 3}, {y, 0, 1.5}], Plot[{ Tooltip[E^-x, TraditionalForm[y == E^-x]], Tooltip[1, TraditionalForm[y == 1]]}, {x, -1, 3}], Epilog -> Tooltip[Line[{{2, 0}, {2, 1.5}}], TraditionalForm[x == 2]]] area = Integrate[1 - E^-x, {x, 0, 2}] 1 + 1/E^2

1

You might find the answers to an old question on StackOverflow useful My suggested hack in that case involved Rotate: ticks = {{None, ({#, Rotate[#, 90 Degree], {0.02, 0}} & /@ Range[0, 4])}, {({#, Rotate[#, 90 Degree], {0.02, 0}} & /@ Range[0, 1, 0.25]), None}}; Rotate[Plot[2, {x, 0, 1}, AspectRatio -> GoldenRatio, AxesOrigin ...

5

The new V10 region functionality is rather suited to implementing your description of the problem in a direct way: reg = ImplicitRegion[y < 1 && y > E^-x && x < 2, {x, y}]; Show[BoundaryDiscretizeRegion[reg, {{0, 2}, {E^-2, 1}}], Axes -> True, AxesOrigin -> {0, 0}, AspectRatio -> 1/GoldenRatio] Also for finding the ...

7

you can also try: PolarPlot[2/Cos[t], {t, 0, Pi/4}] or ContourPlot[x == 2, {x, 0, 4 Pi}, {y, 0, 4 Pi}] If you want to find the area using other method, I would suggest to use Area and ImplicitRegion in V10 as follows: r = ImplicitRegion[y >= Exp[-x] && x <= 2 && y <= 1, {x, y}]; Area[r] (*(1 + E^2)/E^2*) for shading issue ...

6

Its my understanding that you want to insist on using Plot for this problem. Then how about defining a function that has a vertical jump at x=2 and otherwise exceeds the required PlotRange so that its remaining parts won't show up? Plot[100 Sign[x - 2], {x, -3, 3}, ExclusionsStyle -> Red, PlotRange -> {-1, 1}]

0

ParametricPlot[{10, y}, {x, -10, 10}, {y, -10, 10}] works for me.

0

You want to solve once and then replace the a, b, c variables in the general solution with each triple of values. The import of a .txt file as a "Table" should end up with a table like (could be integers, reals, or a combination) SeedRandom[8]; data = RandomInteger[{-5, 5}, {10, 3}]; Convert each triple to substitution rules: substitutionRules = ...

0

Here is now the - hopefully - correct (numeric) solution of the original problem. To begin with, we define a time t0 such that y = 0 for 0<=t<=t0. Für x(t) we have x(t) = 1 for 0<=t<=t0, otherwise we have first to solve the equation sx = DSolve[x'[t] == x[t]^(3/4) - x[t] && x[0] == 1, x[t], t] We can ignore the error Messages. (* ...

2

You can create a table of the individual solutions like this: solutions = Table[ X /. Solve[(MM[[K + 2]])*X + (MM[[K + 2]]*R[[K + 2]]) == 0, X][[1]], {K, 9}] Then use Accumulate to give the final desired result Accumulate[solutions]

1

There is no need to use Piecewise because both $x(t)$ as well as $y(t)$ remain non negative. Furthermore, the equation for x is independent of y and can be solved analytically. The result $x(t)$ is then put into the equation for $y(t)$ which will be solved numerically. Finally we verify our first statement about the non-negativity. Ok, here we go. The ...

6

There is a difficulty with the statement of the problem. Generally the problem can be solved as shown below. In this case there is a stipulation that $1 < x < 5$ and $1 < y < 5$. Unfortunately the solution to the system does not satisfy these constraints (also shown below). If we agree to use only numerical techniques and pretend that Solve ...

0

Depending on the exact format of you input file, this could work. Solve[#[[1]] x^2 + #[[2]] x + #[[3]] == 0, x] & /@ Import["...\\coeff.txt", "csv"]

2

Test text file: -7.101294838,6.107184564,-7.827628057 -7.776324224,3.335127227,-8.635435055 5.653804799,9.155964227,-6.508515146 -8.873230178,2.449789254,-0.713901565 -1.616786376,5.64260341,3.23697902 -5.190324765,-8.67827251,-2.506562629 6.81920439,-3.730488378,1.677649757 -5.814306708,-4.617626918,5.667566715 1.154882842,-2.126425841,-8.933609026 ...

-2

fulldomain doesn't deliver a list of replacement rules. therefore no replacement done in special Edit If we solve it general (not numerical), i.e. eqn1 = 3/(x y z) - 2 x - 3 y - 5 z == 3 eqn2 = x + y + z == 0 eqn12 = Eliminate[{eqn1, eqn2}, z] sol = y /. Solve[eqn12, {y}] Plot[sol, {x, 1, 5}] (* select real points *) solPoints = {x, y} /. Solve[eqn12, ...

4

A simpler solution would be to use Eliminate sol = y /. First@Solve[Eliminate[{eqn1, eqn2}, z], y] -((1 + 2 x - 7 x^2 - 14 x^3)/(x (2 + 21 x^2))) Plot[sol, {x, -2, 2}, PlotRange -> {-2, 2}, Frame -> True]

3

I actually just discovered Mathematica has an Eliminate function eqn1 = 1 - 3 x y == 5 z - 2 x eqn2 = y == 7 x z - z/x eqn3 = Eliminate[{eqn1, eqn2},z] Plot[y /. Solve[eqn3, y], {x,-2,2}, PlotRange -> {-2,2}]

3

Try something like this: z = z /. Solve[eqn1][[1]]; (*1/5 (1 + 2 x - 3 x y)*) Since you know how z is expressed through x and y, you can put it to the second equation, and get the solution for y. sol = y /. Solve[eqn2, y][[1]]; Plot[sol, {x, -2, 2}]

0

This isn't a full answer to what looks like a textbook exercise, but it should help to get you started toward a solution. Your input expression contains errors. Repairing the errors is all that is needed to get a solution to your set of linear equations. Solve[{2 x + a y - z, b x - 4 y + z, -x + y} == {10, -30, 20}, {x, y, z}] Please read the ...

0

y[x_]=-1+E^(8 x)-6.336 x-32 x^2 (* y[x_]=-6.336 x-32 x^2 *) NSolve[y[x]==0,x] Plot[{y[x],y'[x],y''[x]},{x,-0.6,.4},PlotStyle->{Thick},GridLines->Automatic] Plot[{y[x],y'[x],y'''[x] },{x,-0.6,.4},PlotStyle->{Thick},GridLines->Automatic] {y[0],y'[0],y''[0],y'''[0]} You configured a function that has { a root, a small value of first derivative , and, an ...

2

If you wish to use Reduce: expr = (60 - r/2) (70 - ca - r/2) - (60 - r/2 - ca + (4/25) (70 - r/2 - ca))*(70 - r/2) == 0; caf[u_] := (ca /. (ToRules@Reduce[expr, ca])) /. r -> u So caf[r] yields: (-19600 + 280 r - r^2)/(2 (-265 + r))

5

eq = (60 - r/2) (70 - ca - r/2) - (60 - r/2 - ca + (4/25) (70 - r/2 - ca))*(70 - r/2) == 0 sol = Solve[eq,ca]; caFun[r_] := Evaluate[ca /. sol[[1]]] caFun[r] (* ((-19600 + 280 r - r^2)/(2 (-265 + r)) *)

2

I just used this as another test case for a different approach that I use a lot: it's based on my answer to Find all roots of an interpolating function. First copy the definition of findAllRoots from that answer, then just do this: findAllRoots[f[0,x,.25],{x,0,300},"ShowPlot"->True] {11.3873,41.2847,90.7297,159.864,248.719} The option ...

2

For example with n = 2.5 and phi = 0.5: sol = FindInstance[f[2.5, k, .5] == 0 && 10 < k < 300, k, Reals, 15] // Values // Flatten {45.6831, 100.726, 175.08, 269.028} p = Point[Transpose[{sol, Table[0, {Length @ sol}]}]]; Plot[f[2.5, k, .5], {k, 1, 300}, Epilog -> {Red, PointSize[0.02], p}]

3

Let's define a polynomial p of one variable x depending on two parameters A and L: p[x_, A_, L_] := 96 x^8 − 192 L x^7 + (768 π^2 A^2 + 128 L^2) x^6 + (−64 L^3 − 640 A^2 π^2 L) x^5 + (2655 π^4 A^4 − 640 L^2 π^2 A^2 + 32 L^4) x^4 + (384 A^2 L^3 π^2 − 578 A^4 L π^4) x^3 + (4476 π^6 A^6 − 2760 L^2 π^4 A^4 + 128 L^4 π^2 A^2) x^2 + (456 ...

8

I've fiddled with this on and off for a while now, hesitating to decide whether it was worth posting since another answer has already been accepted. The undocumented function, ExperimentalOptimizeExpression, can be used to break down the solutions algebraically into common subexpressions, and it seemed like an approach worth sharing. On the other hand, ...

2

Second answer -- OK, the first answer was hogwash (the curious can inspect the edit history). It pays sometimes to write out the equation and think about it first. The code for this one looks so complicated, but the equations basically have the form (here d = 80000) rc'[t] == 2.05594*10^-10/rc[t] - 8189.14 rc[t] + 80000. rm[t], rm'[t] == -80000. rc[t] + ...

1

Using only the first cbMax amount of $c_b$s, we get: getmodel[a_, cbMax_] := With[{cb = Table[FindRoot[cb Cot[cb] + a L, {cb, Pi (n + 1/2), n Pi, (n + 1) Pi}][[1, 2]], {n, 0, cbMax}]}, 1 - Sum[2 cb[[i]] Sin[cb[[i]] x/L] E^(a x), {i, cbMax + 1}]] And now notice that for the rest of the $c_b$s, the difference becomes constant (Pi) very fast: ...

9

Mathematica will not always give you answers the way you want it. Sometimes a little bit of massaging needs to be done. In this case let's define some rules: logrule = {Log[x_] + Log[y_] :> Log[x y], n_ Log[x_] :> Log[x^n]} expr = Solve[z == x^m y^n && z == \[Tau] x^(m - 1) y^(1 - n), {x, y}]; Then: expr //. logrule You can also use ...

3

With the help of Bill's edits, the code should look like this: Clear[f, omega, alpha, beta, h, M, T, v, rho]; eta = Sqrt[beta^2 (Sqrt[4 alpha^2 omega^2/beta^2 + 1] - 1)/(2 alpha^2)]; chi = Sqrt[beta^2 (Sqrt[4 alpha^2 omega^2/beta^2 + 1] + 1)/(2 alpha^2)]; alpha = Sqrt[h^2 M/(12 (1 - v^2) rho)]; beta = Sqrt[M T/((1 - v^2) rho)]; a = 1; ...

1

data = Import["txt file path name", "Table"] // Rationalize[#, 0] &; utt = data[[All, 1]]; ra = data[[All, 2]]; akuu = data[[All, 3]]; maxEigenn = data[[All, 4]]; rk = data[[All, 5]]; Muu = data[[All, 6]]; zz = data[[All, 7]]; mm = data[[All, 8]]; You did not specify an index for mm, I have assumed that it is i (adjust to taste). Part uses double ...

2

sol = NDSolve[{ x'[t] == -x[t - Pi] + y'[t - 1], y'[t] == -y[t - Pi] - x'[t - 1], x[t /; t <= 0] == Cos[t], y[t /; t <= 0] == Sin[t]}, {x, y}, {t, 0, 18}]; Plot[Evaluate[{x'[t], y'[t]} /. First[sol]], {t, 0, 18}, PlotRange -> All] ParametricPlot[Evaluate[{y'[t], x'[t]} /. First[sol]], {t, 0, 18}]

Top 50 recent answers are included