1
$\begingroup$

enter image description here

How to make the input using the { as it is shown in the top of the question? I mean, how can make the array?

By default in the "special character section" appears an option 2x2 (Typographic composition section) there are shortcuts for expanding the rows and columns but they do not work correctly. And I am working on Mac so shortcuts do not work either.

I know that it is possible to solve this by typing in this way:

f[x_] = Piecewise[{{-1, x <= -1}, {x, -1 < x < 0}, {x^2, x >= 0}}]

But, I am asking for input as it is shown on top by using the option in the red circle and adding the 3dr row.

enter image description here

$\endgroup$
6
  • 1
    $\begingroup$ Related (but specifically not a duplicate): mathematica.stackexchange.com/questions/198665/… $\endgroup$
    – Carl Lange
    Commented May 19, 2019 at 22:07
  • $\begingroup$ You want to type the escape key, then pw, and then the escape key again, or [\Piecewise] - check the Details and the Basic Examples for the Piecewise function: reference.wolfram.com/language/ref/Piecewise.html $\endgroup$
    – Carl Lange
    Commented May 19, 2019 at 22:09
  • $\begingroup$ Thank you. Non exactly. I want to use the "Typographic Composition" Palette. but when I use that option, only appears a 2x2 array. I do not know how to expand the array. $\endgroup$ Commented May 19, 2019 at 22:13
  • 1
    $\begingroup$ Then, you'll need to type control-return for each case, as the documentation I linked to explains. Unfortunately it doesn't seem to be easily done using that palette. $\endgroup$
    – Carl Lange
    Commented May 19, 2019 at 22:14
  • $\begingroup$ I don't understand what you mean in your question when you say "I am working on Mac so shortcuts do not work either". Shortcuts work for me, and I am working on a Mac. $\endgroup$
    – Carl Lange
    Commented May 19, 2019 at 22:29

1 Answer 1

1
$\begingroup$

I bootstrap the process by typing in something simple like

Piecewise[{{-1, x <= 0}, {x, x >= 0}}]

If you run that line in Mathematica (note: not a function definition) it puts it into the format you want

$ \begin{cases} -1 & x\leq 0 \\ x & x\geq 0 \end{cases}$

Then you can copy and paste it into your function definition and throw away your initial bootstrapping Piecewise. You can edit the rows in place, and add more rows by placing the cursor in the row above where you want a new one and use CTRL-Enter, or use the menu "Insert->Table/Matrix->Add Row"

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.