Skip to main content

Questions tagged [piecewise]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

How to simplify the conditions of a Piecewise function (Maximize output)?

I'm new on the forum and on Mathematica. I'm studying the crest of a function of the three variables c, e, g3. With "crest" I mean I'm maximizing the function only over c, keeping the ...
VitoV's user avatar
  • 1
7 votes
2 answers
176 views

How to draw a VectorPlot where each component is a piecewise function? [closed]

I want to draw a VectorPlot where each component is a piecewise function in Mathematica14.0, such as ...
Phy-zr's user avatar
  • 71
1 vote
2 answers
112 views

Problem with defining a bivariate piecewise function

I want to define the following function in Mathematica in order to evaluate its partial derivative later, $$C(u,v)= (1+\theta) uv + \theta(u+v-1) F(u+v-1)$$ $$F(a)= 1\quad \text{if} \quad a \ge 0 \...
Etemon's user avatar
  • 255
4 votes
2 answers
178 views

How to make the segmentation function automatically draw the correct function image at the break point?

The function is: We know that f[x] is an even function defined on x < 0 And x > 0, when x > 0, ...
csn899's user avatar
  • 4,315
0 votes
1 answer
64 views

How to Speed Up Piecewise Symbolic Integration

In Mathematica, I am attempting to integrate over 2-D $\phi$ "hat functions" for a FEM scheme. I suppose I am only observing "interior points" in the domain $\left( 0 , 2 \right) \...
Chloe's user avatar
  • 165
0 votes
0 answers
38 views

DiscreteDelta, DiscreteConvolve, PiecewiseExpand: odd behavior

I noticed something odd when trying DiscreteDelta, DiscreteConvolve and PiecewiseExpand for ...
user9716869 - supports Ukraine's user avatar
0 votes
1 answer
89 views

Finding the solution for the cubic formula over NonNegativeReals

The standard cubic polynomial is: $ax^3+bx^2+cx + d$. And when I used my function: ...
Teg Louis's user avatar
2 votes
1 answer
71 views

"Piecewise" in "ProbabilityDistribution" would not affect the result

...
Y. zeng's user avatar
  • 567
0 votes
0 answers
37 views

Parsing and visualizing outputs of piecewise gradients

I have a function ...
mijucik's user avatar
  • 157
3 votes
1 answer
90 views

Piecewise BVP not working on interval for NDSolve [duplicate]

My Mathematica skills aren't the best but this solution isn't making sense considering the boundary value I am supplying. The leftmost boundary condition, i.e. at $x=0$, $c[t,x]$ should be $1$ for $t\...
Kendall's user avatar
  • 363
1 vote
2 answers
49 views

Strange behavior when integrating vector valued piecewise function

The following straightforward integral should clearly equal $\{0,0\}$ for any $R\in\mathbb R$: ...
Funktorality's user avatar
2 votes
1 answer
86 views

How to transform the regions in which a piecewise function are defined?

I have a function f[x,y,z] that has a piecewise definition, i.e., its values depends on the ranges of the arguments. Now suppose I have a coordinate transformation <...
user1620696's user avatar
0 votes
0 answers
76 views

Improving the curve of a quadratic spline interpolation

I have these data and I want to make a curve using quadratic spline interpolation. I am successful in computing the equations and plotting the curves. However, I noticed that the peaks of the curves ...
Mule's user avatar
  • 43
0 votes
1 answer
38 views

Piecewise integration doesn't evaluate

I'm trying to integrate the following function: $$q(d, \theta) = q_x(d, \theta) + q_y(d, \theta) - 2q_x(d, \theta) q_y(d, \theta)$$ where $q_x(d, \theta) = \min\left(2 - d\cos\theta, d\cos\theta\right)...
Reality Check's user avatar
1 vote
1 answer
74 views

Finding the maximum of a symbolic piecewise function

I have the function: coded as: ...
vivelesmaths's user avatar
4 votes
1 answer
64 views

Confusing cases in Piecewise

The following FullSimplify[Integrate[Exp[I ω t] Sin[ω x]/ω, {ω, 0, ∞}, Assumptions -> t > 0 && x > 0]] gives a piecewise output of the form I ...
Adam's user avatar
  • 63
0 votes
0 answers
25 views

Problem with Piecewise function applying to matrix of polynomials

I have a matrix of a polynomial - function f f[t_, i_] := wielomianSpline[t, tx[[i]], wspfi[[i]]]; and I want to evaluate the ...
Magdalena Wilkołazka's user avatar
2 votes
1 answer
104 views

Need an equation for modeling Tytler's Cycle

In all cultures over all time there appears, in different languages for different countries, the maxim "Shirtsleeves to shirtsleeves in three generations." This is a function with three ...
Rogo's user avatar
  • 930
0 votes
0 answers
39 views

Issue with piecewise functions and lists of rules

I have a list of data that I am connecting with a simple piecewise function. I then want to evaluate the piecewise function at a different list of points. I can do it the long way, but I am wondering ...
Claudia's user avatar
  • 31
1 vote
0 answers
43 views

Solving first-order ODE with piecewise component

I have an ODE I'd like to find an analytical solution to, $$ \frac{dZ}{dt}=-\alpha Z+\frac{\beta X^n}{(1+X^n)(1+Z^n)} $$ where $$ X(t) = \begin{cases} 1 & 1 \leq t \leq 6 \\ ...
Nick's user avatar
  • 11
6 votes
2 answers
524 views

How can I plot this piecewise function? [closed]

How can I plot function $g(x)$ given below: The following attempt I have tried does not work and returns errors: ...
csn899's user avatar
  • 4,315
3 votes
1 answer
164 views

How is this type of piecewise function represented and calculated? [closed]

How is this type of piecewise function as follows in the picture represented and calculated? Use: ...
csn899's user avatar
  • 4,315
1 vote
2 answers
151 views

How can I interpolate a piecewise constant function?

Let the given set of points ...
Superunknown's user avatar
4 votes
1 answer
125 views

Put a standalone wall barrier inside a 2D square well potential

Here is the code for the 2D square well potential: v[x_, y_] := Piecewise[{{1, 58 < Abs[x]}, {1, 58 < Abs[y]}}]; Plot3D[v[x, y], {x, -70, 70}, {y, -70, 70}] Is Piecewise the right function to ...
Michael B. Heaney's user avatar
0 votes
1 answer
82 views

Using NDSolve on piecewise-defined system of ODEs

I'd like to use NDSolve to solve a system of n coupled 1st-order linear ODEs expressed in matrix-vector form, but which are definied piecewise in n-space (in particular, to represent different linear ...
Cameron Alred's user avatar
2 votes
1 answer
47 views

How to plot this two variables piecewise function?

I was wondering if there is a suitable way to plot the function $$f(x, y) = \begin{cases} x & y < x^3 \\\\ y & y \geq x^3 \end{cases}$$ Maybe with piecewise? But it's a two variables ...
Heidegger's user avatar
  • 321
0 votes
0 answers
50 views

Piecewise Boundary Condition for axisymmetric heat equation [duplicate]

I'm trying to solve the 2D axisymmetric heat equation, where only one section of the tube is being heated up. I have written the following code below: ...
Lucas's user avatar
  • 103
2 votes
1 answer
452 views

How can one build this kind of graphics? What kind of plot is it?

i want to know how can i build this kind of plot? its a graphic of Moment -150 to 150(H.m)in fuction of time from 0 to 6 seconds.
prazerex's user avatar
4 votes
1 answer
166 views

RuleDelayed (:>) involving Piecewise leads to Piecewise::pairs warning in ReplaceAll (/.)

When I write a replacement rule like this: Piecewise[{{x^2, x < 0}}] /. Piecewise[a_, b___] :> Piecewise[a, b] It works fine, but I get the unexpected ...
JEM_Mosig's user avatar
  • 3,003
1 vote
1 answer
119 views

How to synatx a piecewise where x=0 is undefined?

How to write the synatx for a piecewise where x=0 is undefined in the domain of the function, and according to the below conditions ? y := Piecewise[{{1, 0 < x < Pi}, {-1, -Pi < x < 0}}]
ahmed mokhtar's user avatar
2 votes
2 answers
140 views

Combining two interpolating functions via Piecewise or If is very slow

For a given set of parameters $(i,l,m)$ I have a function which has been evaluated on a grid $x \in (-2,2)$. Since this function is not smooth (only continuous) at the "interface" $x=0$, I ...
Patrick.B's user avatar
  • 1,511
4 votes
1 answer
84 views

Piecewise Recursive function with 2 arguments

The following code is not working for argument nn>1. Hold statement Hold[0.62+v0[1,0]] come as output for v0[2,0]. ...
kdteam1's user avatar
  • 43
0 votes
0 answers
39 views

NDSolve not handling discontinuity in initial condition [duplicate]

I am trying to solve a PDE in two variables z and t. This PDE is from "Universality of Capillary Rise" by Zhou and Doi (2020). There is additonally a parameter n that can take positive ...
JamesVR's user avatar
  • 407
3 votes
1 answer
62 views

Simplifying Piecewise Function Evaluates Irrelevant Cases

Consider the following function: ...
Lauren Pearce's user avatar
0 votes
0 answers
73 views

How to fit piecewise functions with unknown domain?

Thank you for your comments, I will discribe the question in more detail. I have a piecewise function as below and I'm looking for the parameters :...
ZZZ's user avatar
  • 1
1 vote
1 answer
64 views

Piecewise function with form determined by current value

I would like to create a piecewise function that determines the dynamics of a variable $x_t$ as follows: Given a starting value $x_0$ and a parameter $\hat{x}$: ...
NC520's user avatar
  • 479
0 votes
2 answers
173 views

Accurate and efficient sampling of interpolated functions

Suppose we are given two interpolated functions ...
Math Gaudium's user avatar
2 votes
1 answer
169 views

Creating FormPage Calculator with a Piecewise Function

I am trying to make a calculator to help my mom calculate late fees in our rental property business. Thus, in this calculator all you're supposed to do is input the date on which the tenant is paying ...
SDH's user avatar
  • 33
-1 votes
1 answer
124 views

Finite Jerk Motion Profile

I try to define a function to plot a motion profile with constant jerk. It seems that my function doesn't work. Would you help me to debug my function ? I guess my issue comes from a bad management of ...
Bendesarts's user avatar
  • 1,099
3 votes
2 answers
121 views

Plot a sequence of functions in one plot

I would like to plot a sequence of functions in one plot. My function is defined piecewise: ...
JJJanezic's user avatar
  • 277
0 votes
2 answers
193 views

Defining Piecewise function using an Interval object

I was trying to define a Piecewise function using a previously defined Interval object (that is the union of several intervals). However, I realised that I wasn't ...
S -'s user avatar
  • 153
3 votes
2 answers
94 views

Derivative of piecewise function returns one more case

I define the following piecewise function: U[c_,n_,g_,p_]:=Piecewise[{{c^(1-g)/(1-g)-n^(1+p)/(1+p),g!=1}, {Log[c]-n^(1+p)/(1+p),g==1}}] When I take the derivative <...
NC520's user avatar
  • 479
2 votes
1 answer
133 views

How to plot a function with different conditions (if or which or piecewise)

The given function is This function is plotted to be ...
user444's user avatar
  • 2,446
7 votes
2 answers
376 views

How to remove branches in Piecewise with measure 0

I am doing Convolve over UnitTriangle in 2 dimensions and the resulting piecewise function has conditions with measure zero (...
carlosayam's user avatar
  • 2,080
-4 votes
1 answer
94 views

I can't plot a certain solution

DSolve[{x''[ u] == -(1/ 2)*(2*1*(\[CapitalTheta] (u + a) - \[CapitalTheta] (u - a)))*x[u]}, {x[u]}, {u}]; x[u] /. {{x[u] -> C[1] Cos[Sqrt[2] Sqrt[a] u Sqrt[[...
Deeshani Mitra's user avatar
1 vote
2 answers
145 views

NDSolve with piece-wise function and BVP

How to numerically solve a system of differential equation with boundary conditions and piece wise affine functions ? Consider the following system of differential equations from some optimal control ...
Kredan's user avatar
  • 11
0 votes
1 answer
122 views

How to plot the derivative of a piecewise discontinuous function (by excluding discontinuity points)?

With the following code I am trying to get a plot for the derivative of the ftot1 function, which is a piecewise discontinuous function defined as the sum of other two piecewise discontinuous ...
Alex's user avatar
  • 1
0 votes
0 answers
68 views

Using DSolve, For A System With A Piecewise Function, And For Given Boundary & Continuity Conditions

I'm trying to solve a system of ODE's, analytically, to find the integration constants. The system is the following (with zUpper=125 000 and zLower= 200 000). For 0 <= z <= zUpper: 3 T''[z] == 0....
Canada709's user avatar
1 vote
1 answer
113 views

Derivative of long expression renders Piecewise[…<<…>>…] in Jupyter notebook

My mathematical problem is to solve the optimization problem: $$ Max_{u} \quad \mathbb{E}[\gamma S-S^2]$$ where $$S= A_0 u X+a-\max(\alpha u X+b,0)$$ with $\gamma,A_0,a,\alpha,b$ some constants and $X\...
Wiles01's user avatar
  • 123
1 vote
1 answer
65 views

Vectorplot shows empty result

I've tried to draw a vector plot with piecewise functions, but it shows empty result. When I don't use piecewise functions, Vectorplot works well.. I can't figure out what the problem is. I would ...
Son's user avatar
  • 13

1
2 3 4 5
10