Tag Info

New answers tagged

0

RSolve[a[n] - a[n - 10] == 101, a[n], n] // AbsoluteTiming also given a DifferenceRoot object, consider a[n-1]-a[n-11]==101, so a[n]-a[n-10]==a[n-1]-a[n-11] RSolve[a[n] - a[n - 10] == a[n - 1] - a[n - 11], a[n], n] worked fast. So we can using method of undetermined coefficients Clear["`*"]; expr = Collect[RSolve[a[n] - a[n - 10] == a[n - 1] - a[n - ...


1

For a start I think you may need to use SetDelayed (:=) instead of Set (=). Then be careful with the spaces, a b c (the product of three different variables) is not the same as abc (a single variable). Then porbably you want something like this: ClearAll[a, b, c, d, e, f, g, h, i, j, k] Panel[Grid[{{Style["Inputs", Bold], SpanFromLeft}, {"a:", ...


1

sol=Assuming[ -10 < k < 10, Simplify@Solve[ And @@ { k*x - (x - y)*y^2 == 0, y + (x - y)*y^2 - (1 - x - y) == 0 }, {x, y}] ]; that is the analytical solution (there are three). You can evaluate that numerically dat=Transpose@Table[Chop@N[{x, y} /. sol], {k, -10, 10, 0.1}]; ListLinePlot[dat] empty regions are complex


1

Since nobody has posted a "messy" solution yet, let me: if the matrices are in one list alist = {a1,a2,...,an} and the rhs' are in another, blist = {b1,b2,...,bn} then Clear[x]; vars = x[#] & /@ Range[n]; vars /. Solve[Dot[#1, vars] == #2 & @@@ Transpose[{alist, blist}], vars]


7

Just for fun: f[a_, t_] := a {t - Sin[t], 1 - Cos[t]} Manipulate[ ParametricPlot[{f[1, 4 t], f[2, 2 t], f[4, t]}, {t, 0, 4 Pi}, PlotStyle -> {Red, Green, Blue}, Epilog -> {{Orange, Circle[{4 p, 1}, 1], Black, PointSize[0.015], Point[f[1, 4 p]]}, {Orange, Circle[{4 p, 2}, 2], Black, PointSize[0.015], Point[f[2, 2 p]]}, {Orange, ...


3

I think the problem is that your integrand is just too large numerically to be handled correctly. Are you sure the expressions you are using are based on sound model or mathematics? The number they generate are so large. I can't imagine real physical problem will produce such values. Trying just integrating over x by fixing y to see the problem. I went only ...


1

Here is what I believe you are seeking: ParametricPlot[{{1 (Theta - Sin[Theta]), 1 (1 - Cos[Theta])}, {2 (Theta - Sin[Theta]), 2 (1 - Cos[Theta])}, {4 (Theta - Sin[Theta]), 4 (1 - Cos[Theta])}}, {Theta, -10 Pi, 10 Pi}, AspectRatio -> .5, PlotRange -> {{-8 Pi, 8 Pi}, Automatic}] The resulting Plot:


0

One method of obtaining a solution accurate to first order in δ, based on the comment by @Daniel Lichtblau is as follows: First, apply the function Normal[Series[# /. {gw -> gw0 + δ gw1, gy -> gy0 + δ gy1}, {δ, 0, 1}]] & to each equation to obtain them accurate to first order in δ. Second, set δ to zero in the resulting step #1 equations and Solve ...


2

x BesselJ[1,x] very soon dominates the behavior and you can use BesselJZero[n,k] to constrain FindRoot[]: > f[x_]=x BesselJ[1,x] - 2 BesselJ[0,x] > zero[n_]:=BesselJZero[1,n-1]//N > FindRoot[f[x]==0, {x, zero[1005]-1, zero[1005]+1}] Of course you need to be a little careful about the interval you search for the root in. A more thorough approach ...


6

Since version 9 you do not need to do anything extra. tab1 = {{a1, a1 + a2}, {b1, b2*b2}} tab2 = {{2, 5}, {5, 2}} Solve[tab1 == tab2] {{a2 -> 3, b1 -> 5, a1 -> 2, b2 -> -Sqrt[2]}, {a2 -> 3, b1 -> 5, a1 -> 2, b2 -> Sqrt[2]}}


3

You can use MapThread for this purpose: eqs = MapThread[Equal, {tab1, tab2}, 2] (*{{a1 == 2, a1 + a2 == 5}, {b1 == 5, b2^2 == 2}}*) Solve[Flatten[eqs]] (*{{a2 -> 3, b1 -> 5, a1 -> 2, b2 -> -Sqrt[2]}, {a2 -> 3, b1 -> 5, a1 -> 2, b2 -> Sqrt[2]}}*)


1

Not sure why this resurfaced but it can be done symbolically by separating real and imaginary parts. This of course is no guarantee that for some regions on parameter space the solution values will actually be real valued. zz = Array[x, 6] + I Array[y, 6]; polys = Expand[ ComplexExpand[{zz[[1 ;; 3]].Conjugate[zz[[1 ;; 3]]] - a, zz[[1 ;; 3 ;; ...


0

A bit shorter and more expressive: LinearSolve[T - PadRight[IdentityMatrix[n - 2], {n, n}], PadLeft[{1}, n]]


2

How do I plot the derivatives of the solution You can simply tell NDSolve to also solve for the derivative: sol = First@NDSolve[{x''[t] + x'[t] + 10 Sin[x[t]] == 3, x[0] == 0, x'[0] == 1}, {x[t], x'[t]}, {t, 0, 20}]; Plot[{x[t] /. sol, x'[t] /. sol}, {t, 0, 20}, PlotStyle -> {Red, Blue}, PlotRange -> All, Frame -> True, PlotLegends ...


1

Here's a way that mimics the by-hand method. The idea is to replace common subexpressions by symbols until it gets to the point where Solve will work. In some places I'm assuming that quantities are real and positive. eqn = -i - q + p s^(-1 + a) (1 + s^a)^(-1 + 1/a) - t == 0 /. s -> u^(1/a) // PowerExpand eqn = eqn /. a -> 1/(1 - r) // Simplify (* ...


1

This is but a mild variant. I'll create an example using n=4. SeedRandom[1111]; n = 4; tmat = RandomInteger[{-10, 10}, {n - 2, n}] (* Out[190]= {{-8, 5, -3, -8}, {-4, 2, 4, 2}} *) LinearSolve[IdentityMatrix[n] - Join[tmat, {ConstantArray[0, n], ConstantArray[0, n]}], UnitVector[n, n]] (* Out[196]= {18/11, 50/11, 0, 1} *) An alternative might be to ...


1

Probably I do not quite understand the problem, but if you want solutions which would be valid for all t, then I would first eliminate it from the equations above. Unfortunately SolveAlways[] don't work in this case. Still You can calculate GroebnerBasis and eliminate t like this gb = GroebnerBasis[{x == 1/18 (-6 b - t + 12 y + Sqrt[t] Sqrt[12 b + t + ...


0

Your Piecewise functions should be written as follows Ids[Vgs_, Vds_, Vtn_, kn_] := Piecewise[{ {0, Vgs < Vtn}, {kn*((Vgs - Vtn)*Vds - 1/2*Vds^2), Vgs >= Vtn && Vds < Vgs - Vtn}, {kn/2*(Vgs - Vtn)^2, Vgs >= Vtn && Vds >= Vgs - Vtn}}]; ModeOfOperation[Vgs_, Vds_, Vtn_, kn_] := Piecewise[{ {"Cutoff", Vgs ...


0

An equation is of the form lhs == rhs. When you write eq1 = (5 - 2 - V0)/Rd you just set the "value" of eq1.


0

expr = -(1/R) Csc[ a - 2 b] (R Cos[a - 2 b] - R (Cos[a - 2 b] - Cot[2 a - 2 b] Sin[a - 2 b]))*(-R + R Sin[a - 2 b] - (R^2 Cos[a - 2 b] Sin[a - 2 b])/(R Cos[a - 2 b] - R (Cos[a - 2 b] - Cot[2 a - 2 b] Sin[a - 2 b]))) // Simplify R Csc[2 (a - b)] (Cos[2 (a - b)] + Sin[a]) rules = Solve[Sin[a] == n*Sin[b], b] {{b -> ...


3

It requires a transformation that is not generically valid. Also it is a bit hard to make it happen using Simplify due to the default complexity measure. Solve[ Simplify[((v k)^-n (k v^n - v k^n))/(n - 1) == b, Assumptions -> k > 0, ComplexityFunction -> (LeafCount[#] + 5*Count[#, Power[aa_, Except[_Integer]], Infinity] &)], v] ...


0

The solution, given by Solve, ist 303.865. This is quite near to a zero of the derivative of the original function (which can easily be calculated). So when finding the root numerically, using Newton´s method, this will clearly slow down the calculation or even make it impossible to find such a solution


0

That's quite usual for NSolve. From my experience I see this as follows: NSolve is a very special function which uses numerical methods for finding approximate roots of ONLY linear, 'usual' polynomial, simple trigonometric, etc. equations. If the equation's simple enough then NSolve will give you all roots without any guesses from your side - that is the ...


6

It is probably because it is solving a degree 131397 equation: (1 - 2.25577*^-5*h)^5.25588 == 0.9644952131579817 // Rationalize[#, 0] & (* (1 - (225577 h)/10000000000)^(131397/25000) == 79369373/82291101 *) Simpler comparison, to show equivalence with a rationalized equation: s1 = NSolve[(1 - 2.25577*^-5*h)^5.30 == 0.9644952131579817 // ...


0

You can also do: sol = NSolve[{10 Sin[4 n] == Exp[1], 0 <= n <= 5}, {n}]; Plot[Last @@@ sol, {z, 0, 1}, Evaluated -> True]


1

Use Map over ReplaceAll to translate all your solutions into a list of constants. Example using randomly selected functions that seem to work: sols = NSolve[{10 Sin[4 n] == Exp[1], 0 <= n <= 5}, {n}, Reals]; Plot[Map[n /. # &, sols], {z, 0, 1}]


1

You want to find the value of n for which a[n] == 17160 Clear[a]; a[n_] = a[n] /. RSolve[{a[n + 1] == (n + 1)*a[n], a[10] == 10}, a[n], n][[1]] Pochhammer[1, n]/362880 LogPlot[{a[n], 10, 17160}, {n, 1, 14}] FindRoot[a[n] == 17160, {n, 12}] {n -> 13.} a[13] 17160


1

It would be good if you provide relevant background on type calculations you want to do, the maximum dimensions of the matrix, whether it is sparse or not and whether it requires symbolic evaluations. In principle Mathematica is efficient enough for handling most Matrix manipulations. The memory constraint will largely be outside of Mathematica as ...


6

The general problem is too difficult. Are there any constraints that you can use? For example, if 0 < p < 1 and all values and functions are real Reduce[ {1 - (1 - p^y)^(u (1 - p)) == a, 0 < p < 1}, y, Reals] // Simplify[#, 0 < p < 1] &


5

I can't exactly understand what you're asking for, but is this roughly what you are looking for? A = {{0, 1}, {-k, -c}}; eigA = Eigenvalues[A]; RegionPlot[Min[eigA] < 0, {c, -4, 4}, {k, -2, 2}, FrameLabel -> {"c", "k"}] // Quiet As another amusing example of a two-parameter matrix stability diagram (where blue indicates stability, and red ...


2

Your approach is correct, and you just need to be aware of the fact that the inverse of Exp is a multi-branched complex function. Presumably you want a real solution, and so you must choose C[1] so that the resulting solution is real-valued. In more detail, you compute the solution with the left boundary condition, and then solve for the value of a which ...


2

I finally got a chance to look into the tolerancing. It seems that there is a fairly narrow window for which NSolve, with a nondefault tolerance setting, will handle this. mat = {{a1, b3, b2}, {b3, a2, b1}, {b2, b1, a3}}; eqns = { b1 - (b2 b3)/a1 == 0.1867, a2 - (b3 b3)/a1 == 1.9867, a3 - (b2 b2)/a1 == 0.9867, a1 - (b2 b2)/a3 ...


0

Manipulate[ Plot[Evaluate[x /. Quiet@Solve[a*x^2 + b*x + c == 0, x]], {b, 1, 10}], {a, 1, 10}, {c, 1, 10}]


3

Introduction There are a few ways to make such a table: (1) a symbolic way that seems conceptually clear and whose slowness is not prohibitive for a table of at most a few thousand entries; (2) using the table created by NDSolve in solving the equation by integrating its derivative either (a) directly or (b) correcting the errors in it; and (3) making a ...


2

As you're trying to represent things that aren't functions, I suggest to change your representation to vectors (affine): (* a few functions *) line[{v_List, d_List}, a_] := a v + d circle[{c_List, r_}, t_] := c + r {Cos@t, Sin@t} intersection[{v_List, d_List}, {c_List, r_}] := Solve[line[{v, d}, a] == circle[{c, r}, t], {t, ...


0

I found a couple typos in your code, the most glaring being the lower-case if. This seems to work, intersectionPoint[eqLine_, eqCircle_] := Module[{eq1 = eqLine, eq2 = eqCircle, pts, x1, x2, a}, pts = NSolve[eq1 && eq2, {x, y}]; x1 = x /. pts[[1]]; x2 = x /. pts[[2]]; If[x1 < 0, a = pts[[1]], a = pts[[2]]]; ...


2

I'll try to address this one step at a time. Since a is assigned a value of 0.022 I shall assume we will be working numerically. Let's plot our function. a = 0.022; expr = (1/2) x Sqrt[1 + 4 a^2 x^2] + ArcSinh[2 a x]/(4 a) Plot[expr, {x, -1*^5, 1*^5}] 1/2 x Sqrt[1 + 0.001936 x^2] + 11.3636 ArcSinh[0.044 x] There appear to be no complications so ...


2

Here is a case where you should take a close look at the magniture of your quantities and do some manipulation to normalize things before throwing the system at the computer: Zl = 2.05*10^-15 \[Alpha] = 1.6381 \[Rho] = 0.326*10^-10 k = 8.9875517873681764*10^9 e = 1.602176565*10^\[Minus]19 divide both of your expressions by ( \[Rho] e ) : ...


0

f1[x_] = ((Zl \[Rho]) Exp[-x]); f2[x_] = (\[Alpha] k e^2/x^2); Zl = 2.05*10^-15 // Rationalize[#, 0] &; \[Alpha] = 1.6381 // Rationalize[#, 0] &; \[Rho] = 0.326*10^-10 // Rationalize[#, 0] &; k = 8.9875517873681764*10^9 // Rationalize[#, 0] &; e = 1.602176565*10^\[Minus]19 // Rationalize[#, 0] &; sol = NSolve[f1[x] == f2[x], x, ...


2

The code NSolve[Rationalize[f1[x] == f2[x], 0], x, Reals], 100] yields three solutions (with or without N), which is the minimum number of solutions if Zl ρ is positive. The following, which sets the precision of the input to match the working precision, NSolve[SetPrecision[f1[x] == f2[x], 100], x, Reals, WorkingPrecision -> 100] also yields three ...


1

One can use NDSolve to construct interpolating functions that parametrize implicit curves. Below I'll show how to get x as a function of y and y as function of x (over appropriate domains, of course). Unless the denominators of an equation are important, it can help to simplify the equation to eliminate them. In particular, the identity Sinc[u] == u / ...


4

First put all your equations into a list (I'm not copying the full code here for brevity) eq = { eq1 == xx, eq2 == yy ...} And then: {val, sol} = NMaximize[{q@2, And @@ eq}, Array[q, 13], Method -> {"SimulatedAnnealing", "PerturbationScale" -> 10}]; sol // TableForm


1

Just another way. Noting from the puzzle the integer digits must consist of integer and multiples that do not exceed 10 (and obviously 0 cannot be one of the digits) thus only 1 and 2,3 and their multiples less than 10 can form the digits of the desired number, i.e.{1,2,3,4,6,8,9}.. You could pare down further but: set = {1, 2, 3, 4, 6, 8, 9}; sub = ...


3

Select[IntegerDigits@Prime[Range[1, PrimePi[10^4]]], Length@Union@# == 4 && (* 4 different digits *) Equal @@ Times @@@ Partition[#, 2] && (* the product condition *) #[[1]] > 3 & (* #[[1]] >3 *) ] (* {6,3,2,9} *)


1

Fast Select[ Most@NestWhileList[NextPrime, 4000, # < 10000 &] , Function[Block[{a, b, c, d}, {a, b, c, d} = IntegerDigits[#]; And @@ { a b == c d, a != b != c != d } ]]] (AbsoluteTiming -> 0.015600) Slow Select[ FromDigits[{a, b, c, d}] /. Solve[a != b != c != d && 3 < a <= 9 && 0 < b <= 9 ...


3

Sorry, but this afternoon I'm too lazy to think too much. Therefore here is the simple literal translation of the four conditions letting Boole[] do the main job and giving the unique result Select[ Flatten[Table[(10^3 a + 10^2 b + 10 c + d)* Boole[a != b && a != c && a != d && b != c && b != d && c != d ...


3

there is no solution for the system. sol = Solve[res[[;; 3]] == p[[;; 3]]] (*{{x1 -> -3.16146, x2 -> 20.0611, x3 -> -13.5576}}*) res /. sol (*{{{0.}, {0.}, {0.}, {-3.92175}}}*)



Top 50 recent answers are included