The way we write Piecewise expressions in real life unfortunately isn’t supported in a Note.
However the following component will visually render such expressions in a Note. Looks like this:
Features:
Table based input
Supports up to 4 branches
Graphs the resulting expressions
Optionally color codes branches for visualization support
By component here I mean something anyone can copy and paste the screen into a project and it “just works” with little manual fiddling on the part of the end user.
This is really cool! I’d love to hear more about how you thought about this construction — is it combining the rows into fractions so the curly braces grow correctly?
Something funky is happening when there’s a fraction in the first cell: e.g., I’m seeing a subscript 7 on the first domain with an initial branch 1/2, domain x>1.
As to how I thought about it, I ended up going with the \binom{} latex operator to force the curly braces to grow correctly, and then nesting those as needed. That worked better than other options I tried.
In addition to that, it’s using nested superscripts and subscripts to place rows slightly differently depending on several factors, including the levels of \binom{} nesting and whether or not the inputs use fractions or not.
I really wish Desmos would support \cases for latex. It would make this far more semantic and open up matrix rendering too. Far from perfect but this is the best option right now to at least make it looks like the real thing I think.
Thanks for finding that bug and taking an interest!
Thank you for posting this! I learned a lot by looking at your code. I didn’t know about \left{ \right} and I didn’t know about \binom{}{} before. I had been trying to make the use \frac{}{} with a white fraction bar for the same effect.