Tag Info

New answers tagged

1

Questions 1 and 2: Solve[x == 3 y + e && Mod[y, 2] == 0 && 0 <= e <= 1, {x, y}, Integers] {{x -> ConditionalExpression[1 + 2 (3 C[1] - 3 C[2]), (C[1] | C[2]) ∈ Integers && C[1] >= 0 && C[2] >= 0 && e == 1], y -> ConditionalExpression[2 (C[1] - C[2]), (C[1] | C[2]) ∈ Integers ...


4

As commented by Szabolcs ~infix~ syntax works only with two arguments. Karsten's clever use of Sequence does not change this fact. As a leading proponent of ~infix~ syntax around here I believe that that binary nature is one of two primary benefits this notation has, the other being reduction of stacked [[[ brackets ]]]. One can at a glance tell from ...


8

The documentation you linked to is more about how Infix is used to define output formats. You can find more information on how to use functions in infix form in the tutorials Special Ways to Input Expressions and Operator Input Forms. If you really want to use Partition in the infix form with an offset, you can use samplelist ~Partition~ Sequence[3, 2] ...


1

It's easier to follow if you try out Derivative[1][Cos[#] &]. Since it returns another function (-Sin[#1] &), it too can be applied. Derivative[n] is a function which takes a function and returns a function, hence the 3 brackets. By the way, try FullForm on the expression that is being collected on to see how you could precisely determine the ...


4

You need to define how you expect this special object to interact with functions, and which functions should handle it. Based on your example I think you want the label to be stripped from the object when an operation is performed? You can generally use UpSet or TagSet (or more frequently their Delayed counterparts) to provide handling rules as needed. ...


6

Fixed code: r[t_] := Piecewise[{{{7 t, 0, 4 (1 + Cos[t])}, 0 <= t <= π}, {{5 Cos[t - 3 π/2] + 7*π, 3 Sin[t - 3 π/2] + 3, 0}, π < t <= 2 π}, {{7*π + 3*Cos[t - 3 π/2], 2*3 - 3 + 3*Sin[t - 3 π/2], 2/(3 π) (t - 2 π)^2}, 2 π < t <= 4 π}, {{7 π - 5 (t - 4 π), 6 + 4 ((t - 4 π)/π)^3, 2 - 1/π t^2 + 10 ...


5

There is an option in StreamPlot called StreamScale that allows you to scale the vectors. In the documentation, we find that StreamScale -> {Automatic, 2, Automatic} results in scaled vectors. Alternatively, you can use VectorPlot, which automatically scales the vectors. Using StreamPlot[{-y,x}, {x,-2,2}, {y,-2,2}, StreamScale -> {Automatic, 2, ...


5

There's a lot of syntactic sugar in there. I'd like to add an answer to show you how you can make progress yourself when encountering unknown syntax. If you wrap the code in FullForm[Hold[...]] Mathematica will show you the functions all these operators stand for: FullForm[Hold[Range[10] /. {x_ /; PrimeQ[x] -> x^2}]] (* Hold[ReplaceAll[Range[10], ...


6

Range[10] - Make a list of integers from 1 to 10. /. - Replace all occurrences of {x_ - anything, to which we will refer to as x /; - so long as the test PrimeQ[x] - for primality yields True -> - with x^2} - the square of itself.



Top 50 recent answers are included