# Questions tagged [piecewise]

Questions about the Piecewise function, which is represented by different expressions for different ranges of values of its independent variable.

383 questions
Filter by
Sorted by
Tagged with
1k views

### Plotting a function discontinuous at one point

I am trying to plot a function which has a discontinuity at one precise point. However, when I naïvely use Plot with this function the discontinuity point does not seem to be taken into account. For ...
104 views

### Plotting an association key corresponding to the maximum value

I have an Association <|0->q^2, 1->2p q, 2->p^2|>, where q=1-p. I would like to plot the key (0, 1 or 2) ...
207 views

### Integral of a step function ,

I am trying to integrate a step function given in a book, but it doesn't work. ...
1k views

### Piecewise-constant function with infinitely many pieces

How can I define the following function in Mathematica: $$f(x)=\begin{cases} x-n,&\mbox{when 2n\le x\le 2n+1,}\\n+1,&\mbox{when 2n+1\le x\le 2n+2,}\end{cases}$$ where $n$ takes all ...
751 views

### Solving a PDE with its boundary condition expressed as a piecewise function

All I want to do is solve the PDE pde = D[y[x, t], t] + y[x, t] D[y[x, t], x] == 0 with the boundary condition expressed as a piecewise function, say, ...
158 views

### Implicit function: derivative of piecewise function that has a FindRoot in one of the pieces

I have a piecewise function that has as one piece the result of a numerical approximation, like in the example below: ...
241 views

98 views

### I get gaps when use Plot3D combined with Piecewise [closed]

I am trying to plot a function that is Piecewise in both dimensions. I write this ...
107 views

### Simplify integral with piecewise expression

How can I simplify this integral? Integrate[Piecewise[{{c[x], 0 <= x <= 1/2}, {0, True}}], {x, 0, 1}] I think it should be the same as ...
175 views

### Plotting orbit of a discontinuous map

I'm trying to plot the orbit of a two dymensional discontinuous map. Could you help me please? I tried using Piecewise, but I didn't get the result I wanted. The ...
396 views

### Force derivative of piecewise function at boundary points to be one-sided derivative

I've defined a smooth step function given as f[x_] = Piecewise[{ {y0, x<x0-dx/2}, {y0+1/2(y1-y0)(1-Cos[Pi*x/dx]), x<x0+dx/2}, {y0, True} }]; ...
583 views

118 views

### PiecewiseExpand fails with min of two piecewise functions

I have two Piecewise functions that are (in this case) just the empirical CDFs of two sets of data: ...
666 views

### Most efficient way to integrate a linear piecewise function

I am having a lot of trouble integrating a simple function. Here's the context: I generate data from two distributions, and I want to calculate the overlap coefficient of representing those datasets ...
121 views

### Piecewise and ProbabilityDistribution malfunction when used together

Yesterday I opened this question, what had a happy end after all. But when I tried to model more complex discrete random variables using Piecewise instead of ...
89 views

### Piecewise integration fail or something else?

I have a not-so-complicated piecewise cubic function, shown below as the yellow curve on the right. It's derivative is on the left; the blue lines are references. Please see the code below where I ...
99 views

### Difference in Piecewise function

I have two piecewise functions that are defined on values of [0,200]. I would like to find out the maximum difference between the two values. The usual Max[] function does not work because all values ...
269 views

### Piecewise function created from list

I have a list of values called EDFh3. This contained values which are partitioned by 3 where it is in the format ...