# Questions tagged [piecewise]

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

305 questions
Filter by
Sorted by
Tagged with
1answer
313 views

### Sum of two Piecewise functions give wrong vector

I would like to calculate the normal at a certain point of a parabola. The parabola is defined only on a certain area according to a Piecewise function. Afterwards ...
2answers
945 views

0answers
104 views

### Data paste in piecewise table

How can I paste data copied from several lines into a piecewise table, without pasting it in a single cell?
3answers
2k views

### Piecewise Polynomial Interpolation

Given some data pairs $(x_i,y_i)$, with $i=0,...,m$, and a degree $r$, I wish to build a piecewise polynomial function to interpolate these data. That interpolation should be continuous, and, on every ...
3answers
2k views

### Can NDSolve handle discontinuous data?

Backslide introduced in 9.0, persisting through 11.0.1 It is possible to numerically solve a differential equation if not-smooth data are involved? For example the following instruction return the ...
2answers
469 views

### Plotting 3D piecewise function with distinct colors

I want to draw the following picture in Mathematica as shown below with distinct color for each section.
1answer
70 views

### PiecewiseExpand doesn't take all kind of assumptions

Running PiecewiseExpand[expr, assum] does not work with all kind of assumptions. For example, the following line will not split the expression with absolute values in the chambers, considering m1=m2. ...
1answer
273 views

### Piecewise conditions with a parametric PDE

I'm using ParametricNDsolve to check best fit of a model (function Eb1) with some data, and I have four free parameters I want to test. I can easily construct a Parametric solution between the two ...
2answers
4k views

1answer
117 views

### Inaccuracy of Piecewise function? [duplicate]

I have the following issue and can't find a solution so far. ...
1answer
138 views

### Define function that goes from one point to another parametrically

I have two points p1 and p2, and I want to get the parametric equation of a linear function that passes through those, but ranging from one point to another. For example, if I have 2 points {0,0} and ...
1answer
328 views

### Definite Integral, Piecewise, Error

I am trying to evaluate the following: ...
2answers
206 views

### Mathematica: Extract the piece that contains x=0 from within a piecewise function

In mathematica, I have a piecewise function similar to: Piecewise[{ {x^2 + 2*x - 4, 0 <= x <= 1/4}, {0, true} }] I don't ...
1answer
3k views

### Fitting piecewise functions

I have several large data sets which follow the following pattern: A position is measured, a force is applied until a new equilibrium is found. I'd like to find a fit for the position, at least at the ...
1answer
170 views

### How to constrain the range of a plot of a function to satisfy an inequality?

Given the function f[x_] := x^2, how can I plot f[x] over the range where f[x] >= 10 and <...
1answer
2k views

### Manipulating a piecewise function

A while ago I posted a question regarding differential equations. It was supposed to model heat transfer. We've refined our model a bit (using numerical methods now). Our code now looks like this: <...
2answers
1k views

### Trying to solve a differential equation with a piecewise initial condition

I am trying to solve $$u_t=\frac{1}{4}u_{xx}$$ $-\infty<x<\infty,\: t>0$ With the initial condition $u(x,0)=\phi(x)$ where  \phi(x)= \left\{ \begin{array}{lr} 1 & |x|&...
1answer
1k views