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

learn more… | top users | synonyms

0
votes
0answers
52 views

The graph of a piecewise function [closed]

Let $$f(x)=\begin{cases} n,\quad\text{if }\quad n<x<n+\frac{1}{n^3}, \\ 0,\quad\text{if }\quad n+\frac{1}{n^3}\leq x\leq n+1 , \end{cases}$$ Using mathematica, I attempted to draw the graph ...
2
votes
2answers
103 views

Piecewise function with integer conditions

I'm trying to define (and plot) a piecewise function with the following structure: $$f(x) = \begin{cases} g(x) & nT \leq x \leq \frac{2n+1}{2}T\\ -g(x) & \frac{2n+1}{2}T ...
4
votes
1answer
86 views

How to sort the ranges of a Piecewise expression?

I have the following PieceWise expression ...
2
votes
0answers
28 views

Inverse of piecewise function with pieces invertible on specific domain

I have piecewise continuous function defined below: f=Piecewise[{ {15 + 1/6*(# - 3), # <= 27}, {# - 12 + 4 * Exp[-5/24*(#-27)], 27 < #} }]; This ...
0
votes
1answer
87 views

How to enter piecewise functions into Mathematica [closed]

I'm trying to enter a piecewise function (named eq30) into Mathematica. However, it seems not to work. The expression I entered is ...
0
votes
0answers
32 views

R^2 values for piecewise regression

So I've used NonlinearModelFit on a Piecewise function and gotten a nice little piecewise regression. This is what my code looks like: ...
-2
votes
1answer
38 views

NIntegrate a function containing NDSolve

I am having an issue integrating a function for which I am getting values for when I evaluate it. ...
0
votes
1answer
68 views

DSolve with piecewise coefficeints wrong, why?

sorry if this is a duplicate (I am pretty sure) but I was not able to find the question. I am playing around with DSolve with variable coefficients. In the documentation it is said, that DSolve can ...
1
vote
1answer
66 views

Piecewise Function within NDSolve

So I am quite new to Mathematica and programming in general and I am running into an issue while trying to use the numerical diff eq solver (NDSolve) within mathematica. This is what my code looks ...
1
vote
2answers
63 views

Derivative of Continuous and Differentiable Piecewise function is indeterminate

I'm attempting to analytically stitch together two linear functions with two quadratic functions. The function I'm considering, then, is a piecewise function consisting of 4 parts. Below are the ...
0
votes
0answers
41 views
1
vote
0answers
57 views

Maximize and NMaximize don't work for my function

I defined the following function: d1[x_] := Min[Abs[FractionalPart[x]], 1 - Abs[FractionalPart[x]]] and tried to evaluate the following function: ...
0
votes
1answer
33 views

Cannot determine, what this partw error message is aiming at …

So i am trying to plot the magnetic vector field surrounding a "flat conducting cable" (don't know the proper english expression). This is the "code" (there are some constants in the analytic ...
2
votes
1answer
115 views

How I can make the StreamPlot of this differential equation?

I need the StreamPlot of this differential equation but I don't know how. dp/dt = 0.4 p(1 - p/30), 0 <= t < 5 and 0.4 p (1 - p/30) - 0.25 p, t > 5
1
vote
3answers
76 views

Fill an array, symmetric with respect to its centre

I want to create an array that must be symmetric with respect to the centre of it, as in the following example: 0 1 2 3 4 3 2 1 but, instead of having such ...
0
votes
0answers
41 views

Filling Piecewise Function leaves gaps [duplicate]

When I use the fill feature to shade the area between the curve and the x-axis, there is no fill when x=2. I don't understand how this is possible since the function is defined there. Any help to fill ...
0
votes
0answers
46 views

How to make Piecewise continuous [duplicate]

I have a function defined by its slope in a continuous sequence of intervals, e.g. ...
1
vote
1answer
86 views

How to draw dots at beginning and end of range when plotting [duplicate]

I'm trying to plot a Piecewise function which should look like this: How can I have similiar dots (filled or empty) at beginning and end of range? ...
0
votes
2answers
103 views

Using parts of piecewise function

I define: f[x_] := Piecewise[{{5, 0 <= x < 10}, {g[x], 10 <= x < 15}, {h[x], x > 15}}] Then I try to solve ODE: ...
1
vote
1answer
97 views

Piecewise ColorFunction for Plot3D

I want to make a 3D plot where the ColorFunction is different depending on whether the function value is positive or negative. I know how to do the following: ...
0
votes
2answers
155 views

Convolution of a piecewise function

I want to find the convolute the the functions in the Convolve command ...
1
vote
1answer
63 views

Piecewise function and integral function

Given a piecewise function f[t_]:=Piecewise[{{Exp[-1/t^2],t>0},{0,x<=0}}], I can define another function like this: ...
3
votes
1answer
80 views

How to make the result of Piecewise be a closed interval?

Description This question comes from two questions. Namely Q1 and Q2 The defintion of B-Spline basis function as shown below: Let $\vec{U}=\{u_0,u_1,\ldots,u_m\}$ a nondecreasing sequence of real ...
2
votes
2answers
195 views

Plotting boundary of piecewise function in ContourPlot

I am trying to do a ContourPlot of the following function: ...
5
votes
4answers
349 views

Plotting piecewise functions

I have a list of N functions called functionList. N can be any number. Also, I have a list ...
0
votes
1answer
66 views

Integral for piecewise function inconsistent with the usual way

I have the following piecewise function: ...
1
vote
1answer
59 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 ...
4
votes
2answers
268 views

Solving a discontinuous differential-algebraic equation system for plasticity behaviour

I need to solve a discontinuous equation which is typical in theory of plasticity. For a simple case I get the following equation system (reformulated for numerical implementation): $s(t) = ...
1
vote
1answer
55 views

Using If statement for more than two cases [closed]

I want to use the If statement for three different scenario. Can someone help me out? Pls also indicate if there is a better function to do that. This is an example ...
2
votes
1answer
253 views

Piecewise smooth rectangle pulse

I am wondering how to create a single rectangle pulse with nonlinear riding and falling edges on both sides. I don't know whether it is better to do it piecewise or to mathematically transform the ...
0
votes
1answer
55 views

Finding a solution when there are two piecewise functions at play

The goal is to mathematically figure out where is the point when the both of the diagrams are the same distance to the Y-axis. The solution to such a problem can be obtain quite easily by just ...
0
votes
0answers
75 views

Piecewise functions Integration with symbol

I want to integrate one piecewise functions as following, ...
3
votes
1answer
494 views

Define and plot a piecewise function with parameters [closed]

I have this function , but i do not know how to define it in mathematica \begin{equation} f_t(x)=% \begin{cases} i& \text{$\frac{1}{1+i}<|x-t|\le \frac{1}{i}$} \\ ...
0
votes
0answers
50 views

Transform NMinimze into LinearProgramming formulation

I have the following maximization problem that I currently try to solve with Minimize/NMinimize. Unfortunately, this kind of solution method takes really long for large systems of equations and ...
4
votes
1answer
398 views

Integrate over piecewise function defined using /;

f[x_] := x /; x<0 f[x_] := x^2 /; x>=0 Integrate[f[x],{x,-1,1}] The above does not work (Mathematica returns it unevaluated), but the below does. ...
1
vote
1answer
149 views

Understanding a piecewise function generated by Mathematica

After some simplifications I was eventually get the following piecewise function. ...
0
votes
1answer
135 views

PolarPlot works, ParametricPlot doesn't [closed]

Am new to Mathematica, so if this question has been asked already, apologies. Have a (polar) spline function and Mathematica did a fine job of calculating from my inputs and giving me the piecewise ...
2
votes
1answer
134 views

(Very) ill-behaved Piecewise Plot

I am interested in defining a function (with arguments: a symbol for a variable and a list of 6 points) that represents a quadratic interpolating spline of the points. Here is my attempt ...
2
votes
3answers
128 views

Why do plot functions fail to plot expressions containing piecewise functions? [closed]

Why do both of the following plots appear empty in Mathematica? I tried evaluating the functions $\chi_+$ and $\chi_-$ at various points and it seems valid, so why does Mathematica not plot them? ...
2
votes
1answer
75 views

Plotting a piecewise function with strange subdomains

I have a function, which analityc expression is $C=2*max[b-c,0]$(you can see the expressions of b and c down). Then I have to considerer $q_\pm=\frac{(1\pm \sqrt{ (1-C^2)})}{2}$ and then to plot ...
2
votes
0answers
64 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?
6
votes
3answers
607 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 ...
1
vote
2answers
306 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.
1
vote
1answer
51 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. ...
2
votes
1answer
139 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 ...
1
vote
2answers
626 views

3D Plotting with PieceWise function

Im trying to plot the following function: $f(x,y)$ = $\left\{\begin{matrix} (x+y) & (x,y) \in T \\ (x+y)^2 & (x,y) \notin T \end{matrix}\right.$ where $T= \{ y\leq -x+1, x\geq 0, y\geq ...
7
votes
2answers
440 views

How to plot this function?

I'd like to plot the function $f$ in this answer http://math.stackexchange.com/a/788818/66096 Let $h(x) = \begin{cases} e^{ -\frac{1}{1 - (1-2x)^2}} & \mbox{ for } 0<x < 1\\ 0 & ...
1
vote
1answer
74 views

Inaccuracy of Piecewise function? [duplicate]

I have the following issue and can't find a solution so far. ...
0
votes
1answer
86 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 ...
0
votes
1answer
111 views

Definite Integral, Piecewise, Error

I am trying to evaluate the following: ...