Hot answers tagged

5

Maybe this will fit your needs: myPrint[args__, {style__}] := Print[Row[{args}, BaseStyle -> {style}]] myPrint["Mass of the atmosphere is: ", m, {FontSize -> 18, FontWeight -> Bold, Background -> LightRed}] myPrint["Mass of the atmosphere is: ", m, {"Section"}]


5

So, extending comments. Quick fix is to use Return[$Failed, Module] here but it's not the right approach. This SplineDegree should not reach MakeBoxes at all. Here's what should be done. Imo, the user should not use CAGDBSplineFunction manually to create it, like in case of InterpolatingFunction it is created by something else, here Interpolation. So in ...


4

Thanks a lot for Kuba's hints and his answer, I written down my understanding. Using two defintions: CAGDBSplineFunction[pts_, opts : OptionsPattern[]]:=, the user should use this definition. CAGDBSplineFunction[pts_, {deg_, knots_}]:=, which returns the object. CAGDBSplineFunction /: MakeBoxes[ obj : CAGDBSplineFunction[pts_, {deg_, knots_}], ...


4

You can type \:2025 to get the unicode character. If you prefer to use a keyboard alias, evaluate SetOptions[ SelectedNotebook[], InputAliases -> Join[Options[SelectedNotebook[], InputAliases][[1, 2]], {"hr" -> "\:2025"}]] in your note book, then EschrEsc will insert the unicode character ‥ into the cell where you currently typing. ...


3

Are you aware that you can define a Rule to specify a change of Rules ? For example here is a replacement of the value indexed by {1,1} : {{1, 1} -> 2, {1, 2} -> 3} /. ({1, 1} -> _) -> ({1, 1} -> XXX) {{1, 1} -> XXX, {1, 2} -> 3}


2

I know a very awkward way to make an Input cell which behaves the way you are looking for. It has different editing properties. I came across such cells when importing notebooks from very long ago. They were from the mid 1990's either Mathematica 3 or Mathematica 4 and they had editing properties, which I still miss very much today. Here I show you a ...


2

(* make a dummy example array *) test = RandomInteger[10, {5, 5}]; (* get rules *) atest = ArrayRules[test]; (* Prefix with our replacements - the default behavior *) (* for sparse array is to ignore subsequent duplicate positions *) patest = SparseArray[Join[{{1, 1} -> -1, {2, 2} -> -2}, atest]]; (* show result *) test patest // Normal ...


2

define your styles beforehand, style1 = Style[#, 12] &; style2 = Style[#, 24, Blue, Background -> Pink] &; and then just use them quickly and easily, Print["Variable a = ", style1@a]; Print["Variable b = ", style1@b]; Print["The result: a + b = ", style2@c];


1

Code: DY = {{Cos[ay], 0, Sin[ay]}, {0, 1, 0}, {-Sin[ay], 0, Cos[ay]}}; Output: A potential error: {{Cos[ay], 0, Sin[ay]}, {0, 1, 0}, {-Sin[ay], 0, Cos[ay], 0}}; Look at the sub-list no. 3, you've got additional 0 in there making the lists of un-equal lengths;



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