Piecewise function

Luiz Felipe Pompermaier shared this question 3 years ago
Answered

Hello,


I'm attempting to join the three functions below, multiplying them by the Heaviside function and then adding each other, but, as you can see, the imaginary part of one function are interfering with the other function.

I would like to know if there are someway to fix this problem.

Comments (10)

photo
1

also another syntax If[x<=-1,sqrt(4-(x+2)²),-1<x<=1,sqrt(4-x²),1<x,sqrt(4-(x-2)²)]

photo
1

I don't think you understand,


I want to do it without an if, in a single function, like the batman equation.

photo
1

  1. The batman curve is a piecewise curve in the shape of the logo of the

    Batman superhero originally posted on reddit.com on Jul. 28, 2011.

the piecewise are not single functions

http://mathworld.wolfram.co...

photo
1

This is the syntax for Batman without If[ ] (Zbynek's version :) )


  1. ((y > s(x)) ∨ (y > f(x))) ∧ ((y < g(x)) ∨ (y < p(x)) ∨ (y < h(x)) ∨ (y < r(x)) ∨ (y < q(x)))


https://www.geogebra.org/ma...

photo
1

I tryed f(x) = (x ≤ -1) sqrt(4 - (x + 2)²) + (-1 < x ≤ 1) sqrt(4 - x²) + (1 < x) sqrt(4 - (x - 2)²)

it should work but it does not work becasue "0*f(x)" reduce the domain of whole function

I think that if[] is used implicitly

f(x) = sqrt((x ≤ -1) (4 - (x + 2)²)) + sqrt((-1 < x ≤ 1) (4 - x²)) + sqrt((1 < x) (4 - (x - 2)²))

worked

photo
1

Ok, it worked, but if I want to use a smoothing function like 1/(1 - e^(-10x)) instead of using the heaviside function.

The problem in here is that, it should work, because at any given point you should have a number in the shape of a + bi, where the bi part should not apear in the graphic.

photo
photo
1

Maybe by defining sqrt2() which is real everywhere?

  1. sqrt2(x) = sqrt(abs(x)) (x > 0)
  2. f(x)=sqrt2(4 - (x + 2)²)
  3. g(x)=sqrt2(4 - x²)
  4. h(x)=sqrt2(4 - (x - 2)²)
  5. p(x)=(x < -1) f(x) + (-1 ≤ x ≤ 1) g(x) + (x > 1) h(x)

photo
1

your sqrt2(x) and sqrt((x>=0)*x) are the same function so your p(x) and my f(x) are the same function

photo
1

Thanks, this is neater :)


  1. sqrt2(x)=sqrt((x>=0)*x)

photo
photo
1

Hi,


an other way, with floor(...),

...

© 2020 International GeoGebra Institute