6 votes
Accepted

Declare a function with symmetric arguments

One can use f[x_,y_,z_]/;(Order[x,y]<0) := f[y,x,z];
  • 6,838
6 votes

Declare a function with symmetric arguments

Try this: f[OrderlessPatternSequence[x_, y_], z_] := {x, y, z} f[x, y, z] + f[y, x, z] {2 x, 2 y, 2 z} ...
  • 18.9k
5 votes
Accepted

Display subscripts and superscripts using conditions on Format

...
  • 126k
5 votes
Accepted

Syntax for nested If statements

Here's how I would have done it: Piecewise[ {#2, sol < #} & @@@ Partition[#, 2], Last@# ] &@Take[Symbol /@ Alphabet[], 9] If you insist on ...
  • 26.9k
4 votes
Accepted

How to plot a function with different conditions (if or which or piecewise)

-1 + Sqrt[2] x - Sqrt[ r^2 - (Abs[x] - 1) should be -1 + Sqrt[2] r - Sqrt[r^2 - (Abs[x] - 1)^2] The otherwise condition ...
  • 41.3k
4 votes
Accepted

Verbose `Dynamic` variable lists

Thanks to @Domen's comment: chessfen@"2r3k1/pb4p1/4p3/1p3p1q/5Pn1/P1NQb2P/1P4P1/R1B2R1K w - - 4 24" with ...
  • 8,005
3 votes

Display subscripts and superscripts using conditions on Format

If a is a symbol then one could use Format[eps[a_Symbol]]:=Superscript[ϵ,a]; Format[eps[-a_Symbol]]:=Subscript[ϵ,a]; Previous ...
  • 6,838
3 votes

Mathematica function defining problem

Here is your code with correct syntax: ...
  • 29.4k
2 votes

Display subscripts and superscripts using conditions on Format

...
  • 18.9k
2 votes

Display subscripts and superscripts using conditions on Format

E.g.: ...
  • 29.4k
1 vote
Accepted

Simulate a binomial distribution experiment

RandomVariate can generate a list of n values. There is no need for a Table. ...
  • 18.9k
1 vote
Accepted

How to create this function?

I hope the following helps. Please let me know if it doesn't. ...
  • 18.9k

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