### writing matematical expression with f power2

Hi Mortimer,

What is the formula for?

You can save some headaches by calculating the squares of constants before putting them in your patch. For example if 12200 is constant and always squared you can just put 148840000 and avoid calculating the square each time you need to process a new value.

Not sure how to do this with [expr]. You can always patch it using several math objects for each calculation or if you use IRCAM’s FTM libraries ( http://ftm.ircam.fr/index.php/Main_Page ) you can do it like this:

**all**of the following text. Then, in Max, select

*New From Clipboard*.

```
----------begin_max5_patcher----------
447.3ocyTsraCBCD7L7UX4zCPJkhcdfZu0uipHjC3j3JvNELUoMJ+60OfDHI
UDodn8Bvt63cGlYg8tNvkhczJH3Yvq.Gm8tNNlT5DNMwNvBxtzbRkAFbUtfW
W.CrkTOx34TooF5TRQsrMKtI6VhLcCiuNojlJsSbVbXT..imouMKxDntBVzb
DVlYjhku8v71ItRvkbRA0T4kRFIushclxO2RscWSUhDF.fKI70vicU2gJ1WF
THbXjN6AWW8kf+LQ.EgGVDl9+RDjEgETUPSKyYbZpnlK68BWRqnbIQxD7jgQ
bgrXEj4HT3rXLZ5z.vDbGwQwgDkxTRWkjJ3enOZz0bk1gMRoFYVknGxNVEZP
qZ.N0wvvCaXijkr0qokj77tb5Be7j0MhwYFBAO1CkjVuMm1sAR5tFVCS777P
XbTDX7X.1GLF3cGR+7Teevi5cCEBaFU06Adp8u41HC3d0NqQUuWJOGQTbXby
w+ILwShCepEiuOrmgVkJru1SFdY0bPyp2Y+EyXe5782fqD0kosZZy2TfSdWF
sRx3lcwNXv8vrgkkQ4c05BV1VAiKan.XwU+Z5VYD9FXz7eAiTAGb+FP74xkM
-----------end_max5_patcher-----------
```

Hope it helps

I obtain here a result to convert frequency to dba so now i woud like the inverse result :

**all**of the following text. Then, in Max, select

*New From Clipboard*.

```
----------begin_max5_patcher----------
510.3ocsU9rbaBCDF+L7TngoGfFWWj3OxzaoG5KQSlNxfri5.RDPz3zL4cuR
KPLNwoisYxED7S6GZ2OVIdx0wasZGu0C8MzOQNNO453.HKvY3YGuJ1t7RVKD
lWtpphK0dK5mSy2oA9eXkcbjPhJ990iSJ6pDxRtFThGfaTRcq3ubfQVFtOVU
mdL3QZMSmemPt8WM7bceZRhiMhPzzD6.NIzNPLWQ2NYEjrJXE7ttQvJGSHQA
vTq+8WxV4YYO65ZurXlU+OZ322wk4O9AW5XawlRIyqzStjReSoxjnyu9HCzd
j9wZdewYW.lwYQdqYxsduTRGwGvq.efRggK0FVkcI1PEusksk+lN.b3QsFx4
XM32yZ9+tQuMjlRsCQjkIldiUmsaPuD2PxevH9sGFv2U2X9jf9LxGUp1hCQ9
990pGP9XBIL7laVPBBryBrOsAaHwAFzW8MJlRswckgAHyG4TCCYgf72Ozw0Y
er9s22nekDzfldIgzkz8RBNMUzH5xropBfIIilRoPxyUcRvYhl81mSnGIWUp
Z5olMEwzvjrEl6xvQTRxz6vSZRNZiUDrMCCCogv9r3yuy5fia.sfo7pe6.If
keX6VqpqIerFGdclZ3kTnf2pERlVnjSCJ6fftSTTvkSOcsRTTqDR8PRft8nM
+mbNQOkbJYF4j4gmc+GBDEbY
-----------end_max5_patcher-----------
```

why don’t you implement this as a lookup table? With Buffer~ eg.

For a lot of reasons I prefer to write f^2 in an expr as f*f: [expr $f1*$f1]. The general-purpose exponentiation of $f1^$f2 is [expr pow($f1,$f2)]. But you seem to have worked that out, so I’m not sure what you need help with.

The thing is that pow() can be a fairly expensive function call, whereas multiplication is just a multiplication. I’m not sure if the implementation of pow() used by Max in expr optimizes for simple integer exponents, but I wouldn’t rely on it.

i agree, it should make more sense to use a table or signal look up table.

using a table will not be more inaccurate or unrealistic than such formulas.

Do I understand well that the original question is that you want to isolate the term (f to the power of 2) so that you can find the inverse relationship? It’s too long ago I worked with the math to do such things. Keep in mind however that the inverse is not a function, as the function you describe is parabolic; you would need to define the inverse with two functions.