Give an example of a function when I have two intervals

I was wondering if there’s a widged that can help me calculate or form a function of when I know the two intervals.

example: Create a function f(x) that has a postivie derivative interval (-1 , 0) and a negative derivative interval (0,1)

f(x) = ?

If there aint one, anyone who can give me a step by step solution cause I am completly lost on how to do it.

One way is with DSolveValue:

DSolveValue[{f'[x] == Piecewise[{{1, -1 < x < 0}, {-1, 0 <= x < 1}}], 
  f[0] == 0}, f[x], x]
Plot[%, {x, -2, 2}]

Hi there!

Thanks for the answer, but I’m not exactly sure what to do with those lines. I copied it into the Wolfram search bar and got a page up, would the answer to my question be the diffrential equation solution? The reason I’m asking is the fact that I can’t actually write it like that in the online course I’m taking and I need a “normal” function and I don’t know how to begin making one.

Take, for instance

    f(x)  = - x^2

(you know the notation x^2 ? It means x squared, also known as x times x).
You should be able to verify (without using Mathematica) that this function satisfies your condition. Otherwise you are in the wrong course.