Tag Info

Hot answers tagged

9

The Notation package is not necessary to use an infix form of \[Star] as that is handled automatically. Also I recommend PadRight for constructing your expression (reference Generating a matrix using sublists A and B n times). SetAttributes[Star, HoldFirst] Star[a_List, n_Integer] := PadRight[a, n*Length@a, a] {1, 2}⋆5 (* ⋆ is \[Star] *) {1, 2, ...


7

Unevaluated@Sequence[1, 2]~ConstantArray~10 $\ $ {1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2} Or using Notation << Notation` Notation[ParsedBoxWrapper[ RowBox[{ RowBox[{"[", "const_", "]"}], "\[Star]", "reps_"}]] \[DoubleLongRightArrow] ParsedBoxWrapper[ RowBox[{ RowBox[{"Unevaluated", "@", RowBox[{"Sequence", "[", "const_", ...


6

Brief? How about this. Define: c = ConstantArray; Now you can get what you want using the infix notation: "a"~c~7 and 10~c~7 With lists {1, 2}~c~7 you'll need to Flatten.


5

You seem unfamiliar with Mathematica syntax. gr[x_] := Piecewise[{{x, x > 1}, {0, x <= 0}}]; Plot[gr[x], {x, -5, 5}] Note too that your function is not defined for $0 < x \leq 1$. Is that really what you want? It is also good programming style to order the elements in a Piecewise from low to high (left-to-right on the number line), i.e., ...


2

This is not really an answer, but it was too long for a comment. Regarding plotting Venn diagrams, take a look at the answers to this question: Hot to plot Venn diagrams. For the more general question about manipulating set-theoretic expressions, it seems to me that Mathematica is limited to manipulating finite sets that can be represented as lists. In ...


2

Study this and see if you can adapt the idea list=Join[Table[{(j-1)/2^k, (j-1)/2^k<=E^x<=j/2^k}, {k,1,5}], {{k,E^x>=k}}]; pw[x_] := Piecewise[list]


1

You can define a function that evaluates to the needed piecewise function while evaluating it. f[x_] := E^x fp[foo_, x_, k_Integer?Positive, j_Integer?Positive] /; j <= k 2^k := Piecewise[{ {(j - 1)/(2^k), (j - 1)/(2^k) <= foo[x] <= j/(2^k)}, {k, foo[x] >= k} }] fp creates the Piecewise function series item for a k and j. It checks ...


1

You can rewrite it in terms of Boolean operators and use Simplify: ((a && ! b) && (a && ! c)) || ((b && ! a) && (b && ! c)) || ((c && ! a) && (c && ! b)) // Simplify (* a \[Xor] b \[Xor] c \[Xor] (a && b && c) *) The Xor Boolean operator corresponds to the symmetric ...



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