New answers tagged

0

You may operate as follows. Let us introduce two rules: rule1 = {Dd -> Dd[i, n + 1] - Dd[i, n], Nn -> Nn[i, n + 1] - Nn[i, n]}; rule2 = {Dd -> Subscript[Dd, i, n + 1] - Subscript[Dd, i, n], Nn -> Subscript[Nn, i, n + 1] - Subscript[Nn, i, n]}; Now if T is defined as follows: Clear[T]; T = Dd - Nn; the application of the first rule gives ...


3

The U.S. National Imagery and Mapping Agency (NIMA) (formerly the Defense Mapping Agency) adopted a special grid for military use throughout the world called the Universal Transverse Mercator (UTM) grid. In this grid, the world is divided into 60 north-south zones, each covering a strip 6° wide in longitude. These zones are numbered consecutively beginning ...


2

e /. f -> Sin Cos[x] + Sin[x]


2

ip = IntegerPartitions[3] Times @@@ Map[tr, a^ip, {2}] {tr[a^3], tr[a] tr[a^2], tr[a]^3}


1

I suspect that this has to do with the HoldAll attribute of Exists (see Attributes[Exists]). However, if you force evaluation of its second argument, i.e. the expression you are trying to modify, you obtain the desired result: Exists[ {py, pyy}, Evaluate[ 123 == (vall /. {ϕ -> 0, py -> pyy, px -> 0, μ -> 0}) == 0 ] ] (* Out: Exists[{pyy}, ...


2

rules = {{x -> 0}, {x -> 0, x -> 10.}, {x -> 0, x -> 5.}, {x -> 0, x -> 3.33333}, {x -> 0, x -> 2.5}, {x -> 0, x -> 2.}, {x -> 0, x -> 1.66667}, {x -> 0, x -> 1.42857}, {x -> 0, x -> 1.25}, {x -> 0, x -> 1.11111}, {x -> 0, x -> 1.}}; You can use Values: y = Values[rules] {{0}, {0,...


4

We can make the functional transformation via substitutions, without destroying the symbolic T[t] by giving it a definition, and the calculus will be done automatically: x[t_] = Q/T[t]; Simplify[Derivative[1][x][t] /. Q -> X T[t]] % /. T -> (1/a[#1] &) One can change the X to x if desired. It seems undesirable from a programming point of view to ...


5

You are making a mistake. If T[t] = 1/a[t] , then T'[t] = D[(1/a[t]), t] = -a'[t] / a[t]^2 Further, replacement is a wholly structural operation, it can not do derivatives. To achieve what you want, you would have to set T[t]= 1/a[t] Clear[a, T] T[t_] = 1/a[t]; x T'[t]/T[t]


3

Welcome to MMA SE (and MMA in general)! Evaluate So, the Evaluate command doesn't actually do anything similar to what you think it does, I think. It's actually only used for control flow, e.g. when you want to force an expression to evaluate where it wouldn't normally—these cases are uncommon, at least relative to everyday use. Notice that Evaluate[y, x = 3]...


0

As pointed out by b3m2a1 in the comment, when you copy the output from the graphic and paste it, the pasted copy has the Style wrapper removed. I didn't see it because I was only looking at my screen where they appeared identical. The solution to go directly from the graphic to the desired output is to replace Integer with a Blank Map[ # /.Text[_, Offset[{0,...


1

constraint = Thread @* Between; constraint [Array[t, Length @ limits], limits] {500 <= t[1] && t[1] <= 5000, 1000 <= t[2] && t[2] <= 4000, 1000 <= t[3] && t[3] <= 10000, 1000 <= t[4] && t[4] <= 50000} Simplify @ % {500 <= t[1] <= 5000, 1000 <= t[2] <= 4000, 1000 <= t[3] <= ...


2

We can use Thread. limits = {{500, 5000}, {1000, 4000}, {1000, 10000}, {1000, 50000}}; variables = Array[t, Length@limits]; NMinimize[{Norm[variables], Thread[First /@ limits < variables < Last /@ limits]}, variables] {1802.78, {t[1] -> 500.001, t[2] -> 1000., t[3] -> 1000., t[4] -> 1000.}} Or limits = {{500, 5000}, {1000, 4000}, {...


-1

Let us call the function you want to minimize f[x]. For a simple example I choose f[x_]=x^2. With this: f[x_] = x^2; limits = {{500, 5000}, {1000, 4000}, {1000, 10000}, {1000, 50000}}; NMinimize[{f[x], #[[1]] < x < #[[2]]}, x] & /@ limits (* {{250000., {x -> 500.}}, {1.*10^6, {x -> 1000.}}, {1.*10^6, {x -> 1000.}}, {1.*10^6, {x -> ...


3

limits = {{500, 5000}, {1000, 4000}, {1000, 10000}, {1000, 50000}}; ClearAll[f] f[{min_, max_}, {pos_}] := min < t[pos] < max And @@ MapIndexed[f, limits] (* Out: 500 < t[1] < 5000 && 1000 < t[2] < 4000 && 1000 < t[3] < 10000 && 1000 < t[4] < 50000 *) Note that the output format is slightly different ...


2

As mentioned by @BobHanlon in the comments, the solution is to use RuleDelayed in the following way: tr[a^2]^5 /. tr[a^k_]^l_ :> t[Sequence @@ Table[k, {i, 1, l}]] (* t[2,2,2,2,2] *) This produces the desired output.


3

a->b is a shortcut for Rule[a,b]. Therefore, what you have to do is to replace Ruleby Subtract. E.g.: SeedRandom[1] list = Thread[{a, b, c, d, e} -> RandomInteger[100, 5]] (* {a -> 80, b -> 14, c -> 0, d -> 67, e -> 3} *) list /. Rule -> Subtract (* {-80 + a, -14 + b, c, -67 + d, -3 + e} *)


3

Look at the FullForm of a Rule a -> b // FullForm (* Rule[a, b] *) SeedRandom[1234]; b3 = Thread[{a, b, c, d, e} -> RandomInteger[100, 5]] (* {a -> 8, b -> 72, c -> 44, d -> 38, e -> 22} *) b3 /. Rule[a_, b_] :> StringForm["``-``", a, b] or with some space b3 /. Rule[a_, b_] :> StringForm["``\[ThinSpace]-\[...


2

Clear["Global`*"] Define T with arguments and require b to be a List T[A_, b_List] := Sum[A + b[[i]], {i, 10}]; Vals1 = {A -> 1, b -> Table[j^2, {j, 10}]}; T[A, b] /. Vals1 (* 395 *) T[1, Range[10]^2] (* 395 *)


2

Your equation is wrong. It should read (I will write en for energy because E is a reserved symbol): en^2= (p c)^2 + (m0 c^2)^2 en^2= (m0 v c)^2 +(m0 c^2)^2 en= Sqrt[ (m0 v c)^2 +(m0 c^2)^2] We expand en in a series of v around zero and simplify: Simplify[Series[en, {v, 0, 2}], {m0 > 0, c > 0}]


Top 50 recent answers are included