Piecewise Expressions in Notes | Component Based Approach

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:

piecwise2-min

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.

Hope it helps!

2 Likes

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.

Hi there,

Ah that 7 is a vestige of some testing things I was doing - I thought I fixed that before publishing but I guess i forgot. All fixed now:

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!

1 Like