# Question:How do I simplify a piecewise function?

## Question:How do I simplify a piecewise function?

Maple

I have the following function involving 2 piecewise constructs:

ftotal := -1.70678763408500*10^6*dpp[f]*piecewise(t < 0, 0, 0 <= t and t <= t1, 1-cos(t*Pi/t1), t1 < t, 2)-3.41357526817000*10^6*corrFac*piecewise(t < 0, 0, 0 <= t and t <= t1, 1/2-(1/2)*cos(2*t*Pi/t1), t1 < t, 0)+3.51914976100000*10^8;

(This is a result from a prior calculation in Maple; I did not create this construct orginally). The condition blocks are the same for both piecewise functions so this can be simplified to one piecewise function. Per the Help this can be achieved using convert:

convert(ftotal,piecewise,t);

but I get this error:

Error, (in PiecewiseTools:-Convert) unable to compare 0 and t1

Since I pasted everything into a new sheet I know that t has no assigned value. Same is true for t1 (and specifically I need this for general t and t1). The conversion to Heaviside works; but converting from that back to piecewise fails with the same error.

Is there any way I can achieve the desired result other than doing it by hand?

Sample sheet is attached. I originally ran into this in Maple 2016 but verified the same issue is present in Maple 2017.

Thanks,

M.D.

piecewise.mw

﻿