Piecewise functions in the Octave symbolic package?

Viewed 910

Unlike Matlab, Octave Symbolic has no piecewise function. Is there a work around? I would like to do something like this:

syms x
y = piecewise(x0, 1)

Relatedly, how does one get pieces of a piecewise function? I ran the following:

>> int (exp(-a*x), x, 0, t)

And got the following correct answer displayed and stored in a variable:

                                                                                  
      t      for a = 0

       -a*t
  1   e
  - - -----  otherwise
  a     a

But now I would like to access the "otherwise" part of the answer so I can factor it. How do I do that?

(Yes, I can factor it in my head, but I am practicing for when more complicated expressions come along. I am also only really looking for an approach using symbolic expressions -- even though in any single case numerics may work fine, I want to understand the symbolic approach.)

Thanks!

1 Answers
Related