Skip to main content

Questions tagged [discontinuity]

Tag for issues caused by discontinuity (e.g. Boole, Piecewise, UnitStep, If, etc) in arithmetic function.

Filter by
Sorted by
Tagged with
2 votes
1 answer
83 views

Tell Mathematica that the output of a function is a List / Vector

I have a function (Piecewise) that returns a list, e.g.: F[x_] := Piecewise[{{{x^2, x}, x < 0}, {{x, x^2}, x > 0}}, {0, 0}]; I would like to add another list ...
Luis's user avatar
  • 187
8 votes
3 answers
534 views

How to remove artefacts in Plot3D?

Consider the following code Plot3D[ArcTan[x/y] + ArcTan[y/x], {x, -1, 1}, {y, -1, 1}] Is it possible to remove the "dragging" artefacts observed at the ...
sam wolfe's user avatar
  • 4,863
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
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
0 answers
59 views

Derivatives at a discontinuity [duplicate]

The function $\frac{\sin x}{x}$ has a point discontinuity at $x=0$ but the function Sinc[x] takes account of the fact that the squeeze theorem suggests the sensible ...
CrimsonDark's user avatar
3 votes
3 answers
141 views

FunctionContinuous for a function defined with Which

The function: f[x_] := Which[0 <= x < 1/2, x^2, 1/2 <= x <= 1, x^2 + (x - 1/2)^3]; is continuous on the interval $0 \leq x \leq 1$, as a simple ...
David G. Stork's user avatar
1 vote
0 answers
462 views

How to include impulses in differential equations?

I have two coupled differential equations as follows: $$S'(t) = - \frac{a}{1 + B(t)} S(t),$$ $$B'(t) = \frac{c}{1 + S(t)} B(t) (1 - B(t)) - d B^2(t) \Big( \frac{1 - B(t)}{B(t)} \Big)^n,$$ where $a$, $...
user avatar
2 votes
1 answer
215 views

Machine overflow when defining boundary conditions

Recently I have been trying to code Maxwell's equations over a closed surface and have been facing some trouble defining the boundary conditions for the magnetic field. The equation for the normal of ...
Jole Stock's user avatar
2 votes
2 answers
86 views

Numerical solution of a nonlinear PDE that develops a growing piecewise linear region

I am trying to improve the numerical solution of some PDEs that develop a piecewise behavior during their evolution. The simplest example of one such PDE is for a function $u(t,x)$ with $t \in [-T,T]$ ...
bbrink's user avatar
  • 163
7 votes
1 answer
220 views

VectorPlot "Part 1 of {} does not exist" error

Bug introduced in 7.0, persisting through 13.2. I am looking to plot the Magnetic Vector potential, A, as a function of position along the edge of a density plot. The density plot is fine, and I ...
Jack Adams's user avatar
3 votes
1 answer
78 views

Why does contour plot not show point(s) where function has a discontinuity?

Consider the following code, which defines a function with a discontinuity, and then generates a contour plot when the function equals that discontinuity. ...
user106860's user avatar
7 votes
1 answer
152 views

Solve computes discontinuous eigenvalues of parameter-dependent matrix

So I have a family of unitary matrices $m(x,y)$, which depend on two parameters $x,y \in [0, 2 \pi)$. Its eigenvalues should be continuous in $(x,y)$. Since $m(x,y)$ is a unitary matrix, its ...
Andreas132's user avatar
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
4 votes
1 answer
94 views

Discontinuous ODE results in NDSolve::ndinid warning, initial condition is not in the range specified by the discrete variable (internal variable)

The equations and code are below. The short version is: I know the error is because NDSolve is doing something in the background to handle the discontinuous ODE. ...
Nolan King's user avatar
4 votes
1 answer
97 views

CaputoD of (Edge) BSplines

tl;dr Why does this works: CaputoD[BSplineBasis[{3, {0, 1, 2, 3, 4}}, 0, x], {x, 1/2}] // Simplify Whereas this fails ...
chris's user avatar
  • 23k
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
3 votes
1 answer
93 views

How to get $(1-x^2)^{1/2}\theta(1-x)$ continuous?

The function $f(x)=(1-x^2)^{1/2}\theta(1-x),$ where $\theta(x)$ is the Heaviside function, should be a continuous function for $x\geq-1$. Another way to define the same function is, $$ g(x)= \begin{...
fizeca's user avatar
  • 33
5 votes
1 answer
128 views

NDEigensystem: 1D problem with discontinuous coefficients

I am trying to use NDEigensystem to solve the 1D problem -cs[x]^2 vx''[x] = w^2 vx[x] with vx[x] and w the eigenfunction and eigenvalue. The coefficient cs[x] is discontinuous at x = -xp, +xp and vx[x]...
Ramon Oliver's user avatar
4 votes
4 answers
211 views

Parts of a Piecewise Matrix Function in NDSolve

First time posting. Reproducing the Problem I'm relatively new to Mathematica (using v.12.3), and working on a project. My problem can be reproduced with this. ...
celestialmelody's user avatar
1 vote
0 answers
96 views

Numerical solution for multi-step PDEs

I am trying to numerically solve the following PDEs in MMA (v12.0) $$\partial_u f(x,u) = \left\{\begin{matrix}&-a f(x,u) + b \, \partial_x^2 f(x,u), & 0<u<T\\ &r(x;\alpha_1) \, f(...
SaMaSo's user avatar
  • 231
4 votes
3 answers
492 views

Jump discontinuities in Mathematica

I would like to find discontinuities of the first kind of the function: Floor[x*Floor[x*Floor[x]]] = f(x) given a specific interval. For example: how to compute ...
MathRevenge's user avatar
9 votes
3 answers
532 views

How to make all the balls move until they stop by NBodySimulation

...
yode's user avatar
  • 26.8k
3 votes
1 answer
192 views

How to express a periodic piecewise linear function in terms of Mod function? or linear combination of Mod?

I am programming a small game (with other programming language) in which I have to use Mod function to express piecewise linear period functions. In my case, two ...
xinxin guo's user avatar
  • 1,345
-2 votes
1 answer
204 views

How Can I Visualize a PDE Boundary Condition? [closed]

I want to use Mathematica to visualize boundary/initial conditions for PDEs in 3-dimensional space. This was sparked by the initial comment in this question, which attempts to solve the PDE $$\...
user10478's user avatar
  • 129
4 votes
2 answers
168 views

What is the scope of the bug where Piecewise breaks DSolve?

Bug introduced after 9.0.1, persisting through 12.3.1. Fixed in 13.0 I have identified a bug in DSolve when differential equation includes a ...
rhermans's user avatar
  • 36.7k
0 votes
1 answer
67 views

Can't extend the function to continuous [closed]

I have code: Am0[ω_] := Abs[H[I*ω]] Am[ω_] := Piecewise[{{Limit[Am0[ω], ω -> 0], ω == 0}, {Am0[ω], ω!= 0}}] Limit[Am0[ω], ω -> 0] Am[0] Function ...
Cpp Nosavvier's user avatar
4 votes
1 answer
174 views

Sided Exclusions in Plot

Consider Plot[Floor[x],{x,-5.5,5.5},ExclusionsStyle->{None,Blue}] At each discontinuity, we get circles indicating the jump. Mathematically, ...
Adam's user avatar
  • 3,956
3 votes
3 answers
89 views

Plotting the sign of a two-variables function

I have a continous function f(x,y), and I want the 2D plot of its sign. I then created a function sign=Sign[f] and used ...
Ire's user avatar
  • 33
4 votes
1 answer
377 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 ...
art's user avatar
  • 155
2 votes
1 answer
431 views

Discontinuity problem with 3D cylindrical heat equation (possibly due to a conversion between Cartesian to Cylindrical coordinates)

I have been working a certain type of 3D cylindrical diffusion equation for a bit now. I am trying to simulate a longitudinal diffusion process in a cylinder with a dislocation defect that will make ...
ConfuzzledStudent's user avatar
0 votes
2 answers
94 views

Unpredictable behavior of a function

The Hermitian matrix mat is used to construct a function fun[x, y, z] as follows: ...
Mike's user avatar
  • 471
8 votes
1 answer
326 views

Ugly streaks caused by Arg in a contour plot

I had a more general question about a similar problem more than two years ago, Getting rid of discontinuities in plots caused by square roots, logarithms, `Arg`, etc, which got lots of interesting ...
მამუკა ჯიბლაძე's user avatar
3 votes
2 answers
389 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 ...
krishnendu maji's user avatar
2 votes
2 answers
364 views

Checking for discontinuities

There was an older post about checking the continuity of a function but the routines in the reply don't seem to work for my function. Hence the new post. If I have a function ...
123infinity's user avatar
4 votes
3 answers
434 views

Boundary value problem with a DiracDelta

It seems that Mathematica can solve an initial value problem with a DiracDelta, but not a boundary value problem with a ...
mattiav27's user avatar
  • 6,727
1 vote
1 answer
49 views

sorting out the coordinate and respective solution values for plotting

I want to plot for coordinates and corresponding solution values below. ...
user75507's user avatar
6 votes
2 answers
146 views

Benefits/downsides 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 ...
user106860's user avatar
0 votes
2 answers
176 views

Can someone please comment on the efficiency of Mathematica, Maple and Matlab in conditional plotting?

I use Mathematica to plot ...
charmin's user avatar
  • 1,159
5 votes
2 answers
2k views

Smooth Boxcar function (Rectangle Pulse function)

There are some answers on how to get a smooth squarewave function. But I would like to have a smooth boxcar function or rectangle function with 2 different widths.: ...
Nam Nguyen's user avatar
  • 1,761
9 votes
3 answers
307 views

Solving a Nonlinear Complementary Problem (plasticity)

I would like to solve the following: given $t\mapsto\sigma(t)$ and $E>0$, $\sigma_y>0$, find $\epsilon$ such that: $$\left\lbrace\begin{array}{l}g(t,\epsilon)\geq 0,\\ \phi(t,\epsilon,\epsilon')\...
anderstood's user avatar
  • 14.3k
14 votes
5 answers
2k views

3D FEM Vector Potential

I am trying to reproduce an FEM result in a paper. Due to possible copyright I cannot show the result directly but fortunately there is a free link An Incomplete Gauge for 3D Nodal Finite Element ...
Greenasnz's user avatar
  • 381
0 votes
2 answers
125 views

Problem for defining continuously Eigenvectors from Kane and Mele model

The model is a simple eigenvalue problem. A matrix that depends on some parameters kx, ky, t, defined by: ...
Gabriel Aller's user avatar
1 vote
1 answer
181 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)?
Teo7's user avatar
  • 139
2 votes
1 answer
81 views

Inconsistent behavior of Limit function when evaluating a directed limit at a discontinuity

Consider the following expression: (* In *) expr1 = Hold[Limit[Sign[x], x -> y, Direction -> "FromAbove"] == Sign[y]] Now let's substitute a ...
user1747134's user avatar
0 votes
0 answers
55 views

Is there a functionality to analytically find discontinutites of function?

I would like know whether it is somehow possible to analytically get discontinuities of a given function on a given interval (possibly with some reasonable assumption of the function otherwise being ...
user1747134's user avatar
0 votes
0 answers
53 views

Exiting CrossSlidingDiscontinuity in NDSolve to follow equilibrium curve

I am trying to figure out how to get the solution curve to an NDSolve to slide along once it reaches a boundary and then to exit the ...
user's user avatar
  • 1
2 votes
1 answer
108 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{...
Matt Murphy's user avatar
1 vote
1 answer
183 views

Computing limits from the left and right and getting the same answer which isn't correct

When I use the following code: ...
Jan Eerland's user avatar
  • 2,001
8 votes
1 answer
704 views

Mathematica is unable to compute the derivative of the function $\frac{\sin^2(x)}x$

Consider the function $$f: \mathbb R\to\mathbb R, x\mapsto\begin{cases}\frac{\sin^2(x)}x, & x\neq 0, \\ 0, & x=0.\end{cases}$$ It is true that $f\in\mathcal C^1(\mathbb R)$ and that $$f'(x)=\...
Maximilian Janisch's user avatar