piecewise - Maple Help

dsolve/piecewise

find solution of ordinary differential equations with piecewise coefficients

Description

 • The dsolve function solves differential equations with piecewise coefficients. It solves general first order linear, linear constant coefficient with piecewise perturbation, and Riccati equations. It can handle some cases where the differential equation is solved by integration or variation of parameters.
 • The solutions are found in terms of distribution theory and translated into a piecewise expression.
 • You can verify a solution by substituting the solution into the equation. However, if the differential equation has jump discontinuities, the verification must be done in terms of Heaviside functions because the derivative at a discontinuous point is undefined in the piecewise function.
 • The theory is based on the dissertation Martin von Mohrenschildt. "Symbolic Solutions of Discontinuous Differential Equations." Swiss Federal Institute of Technology ETHZ No. 10768

Examples

First Order:

 > $\mathrm{FO}≔\mathrm{diff}\left(y\left(x\right),x\right)+\left(\mathrm{piecewise}\left(x<0,xx,0
 ${\mathrm{FO}}{≔}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){+}\left(\left\{\begin{array}{cc}{{x}}^{{2}}& {x}{<}{0}\\ {3}{}{x}& {0}{<}{x}\end{array}\right\\right){}{y}{}\left({x}\right){=}{0}$ (1)
 > $\mathrm{dsolve}\left(\mathrm{FO}\right)$
 ${y}{}\left({x}\right){=}\left\{\begin{array}{cc}{{ⅇ}}^{{-}\frac{{{x}}^{{3}}}{{3}}}{}{\mathrm{_C1}}& {x}{<}{0}\\ {{ⅇ}}^{{-}\frac{{3}{}{{x}}^{{2}}}{{2}}}{}{\mathrm{_C1}}& {0}{\le }{x}\end{array}\right\$ (2)

Linear with discontinuous perturbation:

 > $\mathrm{ode}≔\mathrm{diff}\left(y\left(x\right),\mathrm{}\left(x,2\right)\right)+y\left(x\right)=\mathrm{piecewise}\left(x<0,-1,x<1,1,x<2,\mathrm{sin}\left(x\right)\right)$
 ${\mathrm{ode}}{≔}\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){+}{y}{}\left({x}\right){=}\left\{\begin{array}{cc}{-1}& {x}{<}{0}\\ {1}& {x}{<}{1}\\ {\mathrm{sin}}{}\left({x}\right)& {x}{<}{2}\end{array}\right\$ (3)
 > $\mathrm{sol}≔\mathrm{dsolve}\left(\mathrm{ode}\right)$
 ${\mathrm{sol}}{≔}{y}{}\left({x}\right){=}\left\{\begin{array}{cc}{\mathrm{sin}}{}\left({x}\right){}{\mathrm{_C2}}{+}{\mathrm{cos}}{}\left({x}\right){}{\mathrm{_C1}}{-}{1}& {x}{<}{0}\\ {\mathrm{sin}}{}\left({x}\right){}{\mathrm{_C2}}{+}{\mathrm{cos}}{}\left({x}\right){}{\mathrm{_C1}}{+}{1}{-}{2}{}{\mathrm{cos}}{}\left({x}\right)& {x}{<}{1}\\ {\mathrm{sin}}{}\left({x}\right){}{\mathrm{_C2}}{+}{\mathrm{cos}}{}\left({x}\right){}{\mathrm{_C1}}{-}\frac{{\mathrm{cos}}{}\left({x}\right){}{x}}{{2}}{+}{\mathrm{cos}}{}\left({-}{1}{+}{x}\right){+}\frac{{\mathrm{sin}}{}\left({-}{2}{+}{x}\right)}{{4}}{-}\frac{{3}{}{\mathrm{cos}}{}\left({x}\right)}{{2}}{+}\frac{{\mathrm{sin}}{}\left({x}\right)}{{4}}& {x}{<}{2}\\ {\mathrm{sin}}{}\left({x}\right){}{\mathrm{_C2}}{+}{\mathrm{cos}}{}\left({x}\right){}{\mathrm{_C1}}{+}{\mathrm{cos}}{}\left({-}{1}{+}{x}\right){+}\frac{{\mathrm{sin}}{}\left({-}{2}{+}{x}\right)}{{4}}{-}\frac{{5}{}{\mathrm{cos}}{}\left({x}\right)}{{2}}{-}\frac{{\mathrm{sin}}{}\left({x}{-}{4}\right)}{{4}}& {2}{\le }{x}\end{array}\right\$ (4)

Solutions can also be tested by using odetest.

 > $\mathrm{odetest}\left(\mathrm{sol},\mathrm{ode}\right)$
 $\left\{\begin{array}{cc}{\mathrm{undefined}}& {x}{=}{0}{\vee }{x}{=}{1}{\vee }{x}{=}{2}\\ {0}& {\mathrm{otherwise}}\end{array}\right\$ (5)

Non linear:

 > $\mathrm{ode}≔\mathrm{diff}\left(y\left(x\right),x\right)=\mathrm{convert}\left(-\mathrm{signum}\left(x\right)\mathrm{abs}\left(1-\mathrm{abs}\left(x\right)\right),\mathrm{piecewise}\right){y\left(x\right)}^{2}$
 ${\mathrm{ode}}{≔}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}\left(\left\{\begin{array}{cc}{-}{x}{-}{1}& {x}{\le }{-1}\\ {x}{+}{1}& {x}{<}{0}\\ {0}& {x}{=}{0}\\ {-}{1}{+}{x}& {x}{<}{1}\\ {1}{-}{x}& {1}{\le }{x}\end{array}\right\\right){}{{y}{}\left({x}\right)}^{{2}}$ (6)
 > $\mathrm{sol}≔\mathrm{dsolve}\left(\mathrm{ode}\right)$
 ${\mathrm{sol}}{≔}{y}{}\left({x}\right){=}\left\{\begin{array}{cc}{-}\frac{{2}}{{-}{{x}}^{{2}}{-}{2}{}{\mathrm{_C1}}{-}{2}{}{x}}& {x}{<}{-1}\\ {-}\frac{{2}}{{{x}}^{{2}}{-}{2}{}{\mathrm{_C1}}{+}{2}{}{x}{+}{2}}& {x}{<}{0}\\ {-}\frac{{2}}{{{x}}^{{2}}{-}{2}{}{\mathrm{_C1}}{-}{2}{}{x}{+}{2}}& {x}{<}{1}\\ {-}\frac{{2}}{{-}{{x}}^{{2}}{-}{2}{}{\mathrm{_C1}}{+}{2}{}{x}}& {1}{\le }{x}\end{array}\right\$ (7)
 > $\mathrm{odetest}\left(\mathrm{sol},\mathrm{ode}\right)$
 $\left\{\begin{array}{cc}{\mathrm{undefined}}& {x}{=}{0}\\ {0}& {\mathrm{otherwise}}\end{array}\right\$ (8)
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 16, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9292671084403992, "perplexity": 1315.110176497578}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-06/segments/1674764494986.94/warc/CC-MAIN-20230127132641-20230127162641-00548.warc.gz"}