Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Karl Ratzsch Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Piecewise function in gnuplot? Date: Wed, 8 Nov 2017 18:21:19 +0100 Organization: solani.org Lines: 24 Message-ID: References: <16c3d30b-38eb-4028-9a9a-4a30b869be1a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1510161679 9395 eJwVyckNwDAMA7CVfMryOIXS7D9CUX7ZCYem0Ki+fYMjMTz2bBlf+wMh+EyalldMnEq3eIz1AffxD4s= (8 Nov 2017 17:21:19 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Wed, 8 Nov 2017 17:21:19 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Content-Language: de-DE-1901 In-Reply-To: <16c3d30b-38eb-4028-9a9a-4a30b869be1a@googlegroups.com> X-NNTP-Posting-Host: eJwFwYEBwDAEBMCVKE+ME+r3HyF3sNCY9EA4CI7glqCH61lrpks6AmLlgHCp7XvqS/T9zwMceBEQ X-User-ID: eJwFwYkBgDAIA8CV5Emi41AK+4/gHYLGVhJMLHYBA9yQ9WbVjnT4+I0zLU2MNWNu2u12xfcDF2ARLg== Cancel-Lock: sha1:f121wLkheZ9IYC//ZQBVBUlNueE= Xref: csiph.com comp.graphics.apps.gnuplot:3814 Am 08.11.2017 um 14:21 schrieb Lawrence Bottorff: > I've seen a gnuplot treatment of piecewise functions: > > http://www.gnuplotting.org/defining-piecewise-functions/comment-page-1/ > > but I need something that looks like this: > > https://www.khanacademy.org/math/algebra/absolute-value-equations-functions/piecewise-functions/v/piecewise-function-example What's the difference between what's shown on the two pages (sorry, not watching that youtube video)? You can of course let the ternary operator return the result of any kind of valid mathematical expressions, not just constants. f(x) = x**2 > 5 ? -x**2 : 2*x g(x) = x < 0 ? h(x) : i(x) That what you mean? Best, Karl