# How to flip S Curve sideways along diagonal?

S Curves increase at increasing rates, then at decreasing rates. I’d like to achieve the opposite effect: increase at decreasing rates, plateau for a bit then increase at increasing rates, so basically flipping the s curve along the (increasing) diagonal in the CHOP.

Mathematically I need to map (x,y) → (y,x), just not sure how to achieve this with the math CHOP.

Hello,
Not so trivial mathematicaly…
The S-curve is a Sigmoid function.
What can approximate the symetrical would be the Logit function. But as it use log(x), you cannot calculate log(0).
I made a script Chop with some arrangement to obtain something similar.
logitFunction.toe (7.8 KB)

1 Like

Oh right! I totally blanked on the logit to map (0,1) → Inf, thanks for the pointer!

I was bummed to think that we could not do that in TouchDesigner. I had almost given up but this works: Pattern CHOP set to Ramp with output range 1 to -1 (ramp +1 to -1). Send that to Function CHOP set to acos(x). Then scaled down to 0-1 as the result is in degrees. Which demonstrates, yes, we need an easier way.

@ Greg
Your solution is much more elegant than mine but I really love the possibility to use any (almost) mathematical function in script Chop.
Also there is a reason it would not be very popular, S-curve correspond to the movement equation : acceleration, constant speed, deceleration. Logit is a functiono used in statistics and AI. Also there is a singularity in 0 and 1 (non derivable function there, also in your solution), not with S-Curve.
Jacques

Here’s the cheating version:

FWIW having that curve easily available would be very useful in some cases. The logit function itself has little use here because there is no binary classification problem. What would be useful is the shape of the curve to allow for CHOP behavior where pattern increases at decreasing rates, then at increasing rates.

1 Like

What if - and I know this doesn’t make mathematical sense - but what if pushing the “steepness” parameter into negative numbers created a flattened sorta “inverted” version of the S-Curve like what is described in this thread. I’m not sure how one would go about doing that with a mathematical function, but it feels intuitively like the “steepness” parameter in the sCurve CHOP should work that way.

Right now negative numbers in the steepness parameter just do whatever the positive number would do anyways.

This is how I initially thought it would work, seems like it would be an intuitive implementation.