New answers tagged

1

Here is a slight modification of Karsten's answer. Previously I felt it was too similar, but I suppose it cannot hurt to post it. The main difference is that I avoid MakeExpression. I also like the alternative in your question, which is to use StringToStream. read[cObj_] := DeleteCases[#, HoldComplete[Null]] &@( ToExpression[#, InputForm, ...


3

Instead of SelectionMove and NotebookSelection one can use NotebookRead[PreviousCell[]] and then cleanup the text returned by the ExportPacket. Thread @ MakeExpression[ "{" <> StringReplace[ First[FrontEndExecute[FrontEnd`ExportPacket[NotebookRead[PreviousCell[]], "InputText"]]], {"\r\n " -> "", "\r\n" -> ","}] <> "}", ...


4

expr = (-1 + (E^(w[1, 0] - 1.55432 w[1, 1]) - E^(-w[1, 0] + 1.55432 w[1, 1]))^2 / (E^(w[1, 0] - 1.55432 w[1, 1]) + E^(-w[1, 0] + 1.55432 w[1, 1]))^2) expr /. Power[E, Plus[x_, y__]] :> Inactive[Times][Power[E, x], Power[E, y]]/. {Power[E, Times[c_, w[i_, j_], ___]] :> Power[T[i, j], Sign[c]], Power[E, w[i_, j_]] ...


1

A set solution. cond = {{x}, {y}, {z}, {m}} ∈ Interval[{2, 4}] && {x, y, z, m} ∈ Integers Set x, y, z, and m to be Integers on the Interval 2 to 4. We can use cond to be certain it is defined as expected. Solve[x + y + z + m == 8 && cond, {x, y, z, m}] (* {{x -> 2, y -> 2, z -> 2, m -> 2}} *) This gives the expected result. ...


0

And @@ Thread@Table[Or @@ Thread@Table[j == i, {i, {2, 3, 4}}], {j, {x, y, z, m}}]


11

My offering: And @@ Or @@@ Outer[Equal, {x, y, z, m}, {2, 3, 4}]



Top 50 recent answers are included