# Questions tagged [piecewise]

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

414 questions
Filter by
Sorted by
Tagged with
43 views

108 views

### Did Mathematica make a mistake or was it me?

I'm having a little trouble with Mathematica. There are two expressions that should be equal over a given region. Each of which consists of three terms that should be equal individually: term1 of ...
181 views

### How solve this nonlinear equations system by 12 unknowns?

We consider the following integral equation of mixed type: $x[t]=\frac{t^4}{6} -\frac{t^3}{3} +t+\Sigma_{\mu=1}^2\int_{0}^t k_\mu[t,s]G_\mu[s,x[s]]ds ,0\leq t\leq 1$ ; (1) where $k_1 [t, s] = s^3$...
73 views

### Maximization of piecewise function

I'm trying to maximize piecewise functions with parameters but haven't been able to do so. Here is a minimum example: ...
55 views

### How to plot a piece-wise function like this: f[x]=1 when -1<=x<=1, and f[x]=0 when x>1 or x<-1

I want to plot a piece-wise function like this: f[x]=1 when -1<=x<=1, and f[x]=0 when <...
33 views

### Issue with Piecewise Parametric Plotting

I am trying to make a parametric plot of a piecewise function that is defined locally. For some odd reason, Mathematica will only plot the first two pieces of the piecewise function. If I plug in ...
46 views

### Different results from polar and cartesian forms of a function?

I am trying to write up and study the given function: by the following Mathematica input (with N=5 and not infinity) ...
46 views

### NDSolve with embedded piecewise function for state-variable

Given ODE: $\dot{x}=-2 e^{-x^2} x + U$ where: $U=-u_{as}$ $u_{as} = \begin{cases} \frac{e}{\psi_+-e}, & \mbox{if } e\mbox{>=0} \\ \frac{e}{e-\psi_-}, & \mbox{if } e\mbox{<0} \end{cases}$ ...
85 views

### Expressing $f(x)=-x \;\;\; -2\leq x \leq 0\\f(x)=x \;\;\; 0< x \leq 2\\f(x+4)=f(x)$ on Mathematica?

Can we express functions such as: $$f(x)=-x \quad -2\leq x \leq 0\\f(x)=x \quad 0< x \leq 2\\f(x+4)=f(x)$$ On Mathematica? I tried something with piecewise functions but it didn't work. Namely, I ...
53 views

### Different kind of PlotStyle via Piecewise

I have a Piecewise. For vertical line I have to add Exclusions -> None. ...
87 views

### Piecewise function within a vectorplot

I'm trying to do a vector plot with some code that includes piecewise functions and I keep getting the following error: Part::partw: Part 1 of {} does not exist. Here is the code: ...
86 views

### Piecewise Numerical results used in NDsolve

I have a solution of LinearSolve. And there are four conditions in single period. Then I used Which to expand this solution. <...
63 views

### Generate piecewise function using for loop

I want to specify a piecewise function by writing f[x_]:=Piecewise[piecewiseComponents], and use a loop to specify the components. I have tried ...
62 views

### Creating a dynamic piecewise plot

I'm trying to create a dynamic piecewise function. I can get 3 points, but after that, everything gets a bit complicated: ...
29 views

### Simplifying piecewise function containing symmetric equation terms

I have this large piecewise function that I'd like to simplify (click on image): I see that two first piecewise equations contain terms that are either completely equal or symmetrical. I would like ...
64 views

### Solving ODE for emptying water tank, exclude branch with complex infinity

I'm trying to simulate a water tank. The dynamic of the system should be described by: DSolve[{y'[x] == Piecewise[{{-Sqrt[y[x]], 0 < y[x]}}, 0.], y == 10}, y[x], x] An infinite object ...
63 views

### Solving a complicated time-dependent function

I want to solve the following time-dependent system of equations: ...
51 views

### Piecewise PDE Over 3 Regions with Continuity Boundary Conditions

I am using Wolfram Language for the first time for my research and could really use some help! I am trying to find the analytical solution of a PDE which has piecewise constants and a piecewise input. ...
132 views

### Problem with NDSolve and piecewise functions: Failure computing Filippov continuation

I am trying to solve a first order differential equation using NDSolve. The differential equation is ...
46 views

### Plotting iterates of a piecewise defined map

This is a follow up question to the one I asked here. I’ve succeeded in figuring out how to plot the first image of my piecewise defined transformation $T: [-1,1]^2 \to [-1,1]^2$, but now I want to ...
50 views

### Plotting image of piecewise-defined transformation

I have a transformation $T : [-1,1]^2 \to [-1,1]^2$ that is piecewise defined in the following way: \begin{align*} T(x,y) &= \big(a(x-1)+1,\:\left(b-cx\right)(y-1)+1\big) \quad \textrm{if } y > ...
176 views

### Approximate the piecewise constant with a smooth function

Let us first define a two regions as follow : inner=1;outer=2; reg1 = Disk[{0, 0}, inner]; reg2 = Annulus[{0, 0}, {inner, outer}]; glass=1.5;air=1; Now let's say I ...
290 views

### How to illustrate the optimal solution with kinked constraint?

I have a simple optimization problem with a linear, continuous constraint or a kinked constraint. The optimal solution is either a tangent point with f*<T or at the kink with f*=T. The standard ...
59 views

### Manipulate and Plot of Tangent Point in Optimization Problem with Kinked Constraint: Solve and PieceWise Problems

I'm trying to illustrate an optimization problem with a piecewise constraint creating a kink at the maximum value of T if n>0. ...
24 views

### Assumptions with piecewise problem?

I am trying to apply the assumpion of 0<s<1 throughout the calculation however the piecewise condition does not accept it automatically. Is there any way to avoid the manual choice of x>0. ...
103 views

### Benefits/pitfalls of defining function that is discontinuous at a point "explicitly" vs using piecewise?

For example, suppose I wanted to define a function, f that is $f(x)=x^2$ except at $x=1$, where $f(x)=5$ Two ways I can define this are ...
87 views

### How to convert a Piecewise function in a HeavisideTheta function?

I want to convert a Piecewise function in a HeavisideTheta function in order to correctly evaluate its derivatives at the point of abrupt change and then integrate the result along the axis. How can I ...
53 views

### Both Dsolve and NDsolve for a differential equation failed

I tried both Dsolve and NDsolve for the following differential equation, it failed: It contains piecewise function ...
73 views

### How to plot HeavisideTheta with y=0.5 at x=0, and similar piecewise functions

How does one plot piecewise functions, with the ability to plot individual points along with open points to clearly show how values are defined at discontinuities? Example: Image Credit with the ...
57 views

### How to get Integrate to determine units

In a similar fashion to the question asked here, I am having trouble trying to get Integrate to correctly determine the units of the integrand: Here I have plugged in specific values into the general ...
45 views

### Piecewise function inside ProbabilityDistribution causing errors

I'm using a complicated Piecewise function to create a probability distribution and draw random points from it. ...
78 views

### How to take limits in Fourier series?

I have a Fourier series which produces an impulse train of period j+1. In principle, it is given by ...
110 views

### Continuity and derivability of a multivariable function at a specific point

I have this function: f = Sqrt(Abs(x^2 - x*y)) So, how can I prove that it is derivable and/or continue in a point, like (0,0)?
30 views

### Plotting an iterated piecewise function with endogenous nodes

I am trying to plot a piecewise function that I can define recursively, where the nodes are endogenous as well. Basically, $f(l)=a^{t}$ when \$l \in \left( \frac{\mu}{\alpha^{t-1}(1-\alpha)+\mu(1-\...
58 views