// Messy math with map() and pow()
// Forum:
//   https://forum.arduino.cc/t/messy-math-with-map-and-pow/1275821
// This Wokwi project: https://wokwi.com/projects/401785042678168577
//    
//
// A simple power curve could be enough.
// But the lower part of the graph has a more linear part.
// Therefor I made a smooth transition from linear to
// a power curve.
//
// The "y(forum)" are guessed values from the graph
// on the forum
//   x    y(forum)  y(this sketch)
//   -----------------------------
//   0    1         1    
//   20   2         2.8
//   40   4.5       4.5
//   60   12        10.4
//   80   33        33.5 
//   100  100       100  
//
// The values are calculated between 0...1 for simplicity.

void setup() 
{
  Serial.begin(115200);

  float x = 0;
  for(int i=0; i<=10; i++)
  {
    float ypow = pow(x,4.2);         // the power curve
    float ylin = 0.01 + x/8.0;       // the linear curve
    float y = (1.0-x)*ylin + x*ypow; // smooth transistion

    Serial.print(x*100.0);
    Serial.print(", ");
    Serial.println(y*100.0);
    x += 0.1;
  }
}

void loop() 
{
  delay(10);
}