Questions tagged [piecewise]
Questions about the Piecewise function, which is represented by different expressions for different ranges of values of its independent variable.
389
questions
1
vote
1answer
36 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 ...
1
vote
1answer
44 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 > ...
3
votes
2answers
134 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 ...
2
votes
1answer
269 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 ...
1
vote
0answers
54 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.
...
0
votes
0answers
18 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.
...
2
votes
2answers
101 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
...
3
votes
1answer
51 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 ...
1
vote
1answer
48 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
...
1
vote
2answers
68 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 ...
2
votes
0answers
53 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 ...
0
votes
0answers
39 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.
...
1
vote
2answers
66 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
...
1
vote
1answer
84 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)?
1
vote
1answer
29 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-\...
0
votes
1answer
53 views
Error in drawing a Piecewise function!
I want to plot the piecewise function (FP), which is define as:
$$FP=\cases{1,&$\text{Eta}<J$\\
\frac{1-\left| \text{Gam}\right| }{2}, &$\text{Eta}=J$\\
\frac{\left| \text{Gam}*J\...
2
votes
1answer
85 views
Limit of multivariate piecewise function
Let's say we have a multivariate piecewise function
f[x1_,x2_]:=Piecewise[{{Sin[x1]/x1,x1>x2},{Sin[x2]/x2,x1<=x2}}]
Now we want to determine the limit in f(0,...
1
vote
1answer
57 views
How to evaluate a multidimensional NIntegral in a range where certain conditions must be satisfied by the variables
I have a function f which looks similar to this :
f[a_, b_, c_] := NIntegrate[sigma[a, b, c], {a, -valueA, valueA}, {b, -valueB, valueB}, {c, -valueC, valueC}]
and ...
0
votes
1answer
54 views
How do I introduce an assumption when defining a piecewise function?
Define m as an integer. I want to specify a Piecewise function f[x,n] that takes value ...
1
vote
0answers
35 views
Find edges of a piecewise curve
I have a continuous function f[x], and I want to calculate the coordinates of the discontinuities in Round[f[x]]. My code needs ...
1
vote
1answer
37 views
Should be a Piecewise function, a ConditionalExpression or Indeterminate, but it is a number
I apologize in advance for the lack of focus of my question. Consider the function:
f[x_, y_] := x/(x + y);
f[0,0] evaluates to ...
2
votes
0answers
93 views
How do I create a piecewise function using Do[] or While[]?
The following non-linear circuit is an uncontrolled three-phase full-wave 6-pulse rectifier. The inputs are $v_{an}(t) = V_m \sin (\omega t)$, $v_{bn}(t) = V_m \sin (\omega t-120°)$ and $v_{cn}(t) = ...
1
vote
2answers
157 views
Finding the maximum of a piecewise function
I have the following piecewise function of the variable $e_f$:
$$g(a,b,c,w,F,e_h,e_f)=\begin{cases}
\frac{(c-a e_f) (e_f (4e_f w-a)+c)}{8 b e_f^2} & \left(e_f=e_h\land e_f>\frac{c}{a}\...
5
votes
1answer
59 views
Piecewise function not evaluating properly
I have a simple Piecewise function that defines a square pulse:
...
1
vote
1answer
58 views
ParametricNDSolve “delayed time” error message
Issue reported to Wolfram, Inc as a possible bug in Version 12.1; CASE:4554034.
When trying to solve a system of delay-differential equations with ParametricNDSolve...
2
votes
2answers
65 views
Double integration with a piecewise function gives wrong result
I am attempting to solve a double integral
$$I(t) = \int_0^t dt' \int_0^{t'} dt'' f(t'')$$
of a piecewise function of the type
$$f(t) = \begin{cases}1 & \text{for } 0 \leq t < a \\ -1 & \...
1
vote
1answer
87 views
How to plot a thermodynamic cycle? [duplicate]
I try to plot a thermodynamic cycle with the data displayed using the tool, "Piecewise", but in the case of isochoric and isobaric processes, Mathematica shows nothing. Could someone please tell me ...
0
votes
0answers
47 views
Piecewise function and NDSolve [duplicate]
I'm trying to solve a system of differenial equations involving a piecewise function with NDSolve. I tried to define this function using Piecewise but the kernel ...
0
votes
1answer
50 views
Understand output of Integration
Could someone help me understand the output of the following Integration in Mathematica?
Specifically,
(a) what is the meaning of "True"?
(b) Why is the answer in two parts which seem to overlap ...
0
votes
1answer
31 views
6
votes
2answers
140 views
Best 5 segment piecewise linear fit
I'm trying to get a piecewise linear best-fit for the closing price of one of the stocks I'm interested in. The logic seems ok, and the workflow works for a straight-line (ie 2 pts, ie 1 segment) ...
3
votes
2answers
69 views
HeavisidePi Plot
how could i change This Plot
to something like this plot
each two plots are concatenation of HeavisidePi
The code for the first plot is :
...
2
votes
1answer
51 views
Why does HeavisideTheta not have an implicit piecewise expansion?
The Heaviside step function implicitly expands to a piecewise function:
UnitStep[t - 3] // PiecewiseExpand
$$ \begin{cases} 1 & t\geq 3 \\ 0 & \text{...
4
votes
1answer
72 views
TransformedRegion with piecewise function
Is it possible to use TransformedRegion with a Piecewise defined function?
I tried the following, but it doesn't work and I don'...
0
votes
0answers
33 views
Plotting a piecewise function MRI problem
I have this M.R.I. question, and i need to plot a function with some 'a' and 'b' parameters and 't' as a variable:
...
1
vote
0answers
35 views
Solving a Piecewise ODE [closed]
I am attempting to solve a piecewise ODE.
$y' = \begin{cases} -1 & \text{for $y \geq 0$}\\ 1 & \text{for $y < 0$} \end{cases}, \qquad y(0)=0, \qquad x \in [0,1]$
I have attempted solving ...
1
vote
0answers
21 views
```PiecewiseExpand``` doesn't work as expected with a recursive function
In an effort to examine this question on Math.SE, I defined the following functions
...
0
votes
0answers
25 views
Find and indicate the minimum of a piecewise function in the `Plot3D` diagram
I'm trying to indicate in my Plot3D diagram the minimum level of the dependent variable and the corresponding levels of two independent variables. More specifically,...
0
votes
1answer
50 views
Using subscripted symbol affects integration — why?
Below is a sample program that shows that Integrate is giving different results depending on whether I name the variable duration1 or ...
0
votes
1answer
43 views
Why do Integrate and DSolve/DSolveValue yield such complex expressions for Piecewise functions?
This code uses two different methods for integrating a very simple piecewise function but yields surprisingly complicated integrals:
...
2
votes
1answer
60 views
Piecewise integration not giving continuous result
I'm trying to integrate a piecewise function symbolically and I'm ending up with discontinuities which is surprising since the help mentions that constants are determined to ensure continuity.
If I ...
2
votes
2answers
241 views
Graphing a Fourier Series
First off, I have created the following Fourier series for the below equation/condition:
$$f(t) = \begin{cases} 0, & 0<t<1 \\ 1, & 1<t<2 \end{cases} $$
My Fourier Equation for ...
1
vote
1answer
24 views
Limiting the Domain of a Function
Currently, I am trying to plot (using Mathematica) the following function:
$$f(t) = \begin{cases} 0, & 0<t<1 \\ 1, & 1<t<2 \end{cases} $$
And, to try to plot this, I did some ...
0
votes
0answers
41 views
Bad Integral evaluation for Piecewise function
I have been trying to evaluate this symbolic function:
f[ρ_, R_, α_, yp0_, yp_] := R*((ρ - R*Cos[α])^2 + (R*Sin[α])^2 + (yp-yp0)^2)^(-(1/2));
Mathematica can ...
3
votes
1answer
70 views
Plot of Piecewise function is slow
While working on answer for question (here) I found out that the Plot is incredible slow for Piecewise function:
Some preparations:
...
0
votes
1answer
56 views
Plotting Piecewise function?
I am facing a problem in plotting the Piecewise function. I simplified my problem to take the following form:
where \[Sigma][i] are Pauli matrices. My code is:
<...
0
votes
1answer
65 views
How do I combine a piecewise function within a parametric plot?
I'm trying to combine two functions together piecewise style, but nest that within a ParametricPlot function. Here's my code right now:
...
3
votes
3answers
119 views
count conditional items in list
I have a list of the form:
{1,1, (1 if x>y, -1 if y>=x), -1}
I want to count the number of 1's in the list. The output I'm looking for is something of the ...
2
votes
1answer
79 views
3
votes
2answers
83 views
IVP Piecewise ODE: Changing the Domain outside region of interest changes result dramatically
Good afternoon,
I am attempting to solve the following ODE:
...