Tag Info

New answers tagged

3

NumberLinePlot is different in that the plot symbols actually mean something. A closed point means the data point is included, and an open point means the point is excluded (this is used in open intervals). Hence, it doesn't make sense to use other symbols haphazardly. If you just want to plot some symbols you can add some graphics yourself. The result of ...


3

If there is always one space at a time as shown, or if the number of spaces is irrelevant: str = "1a 789 4/7 123/7 asff %$#7 478 9/4"; StringSplit[str] /. s_String /; StringMatchQ[s, DigitCharacter ..] :> s <> "/1" // StringRiffle "1a 789/1 4/7 123/7 asff %$#7 478/1 9/4" Or adjusting J.M.'s comment code to work: StringReplace[str, w1 : ...


8

As noted in the comments this behavior follows from the definition of FromDigits, though I only understood this myself within the last year or two when someone* used it to boost performance. Consider a symbolic example: sym = FromDigits[{a, b, c}] sym /. { a -> {a1, a2, a3, a4, a5}, b -> {b1, b2, b2, b4, b5}, c -> {c1, c2, c3, c4, ...


3

To be a bit more systematic, I would suggest declaring the units you want to work with in a global variable, and then defining a function unitsToUnity that sets all of those units to unity as follows: $myUnits = {Coulomb, Second}; unitsToUnity[expression_] := expression /. Thread[$myUnits -> 1] (5 Coulomb)/(6 Second) // unitsToUnity (* ==> 5/6 *) ...



Top 50 recent answers are included