## writing matematical expression with f power2

Nov 29, 2012 at 9:31am

# writing matematical expression with f power2

Dear all

I would like to now if it's possible to write mathematical expression with f power 2
(12200*f) / (f+20,6)*(f+12200) *âˆš(f + 107,7) * âˆš(f + 737,9)

[attachment=209364,4696]

###### Attachments:
#58381
Nov 29, 2012 at 10:05am

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:

– Pasted Max Patch, click to expand. –

Hope it helps

#209813
Nov 29, 2012 at 11:01am

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

– Pasted Max Patch, click to expand. –
#209814
Nov 29, 2012 at 1:50pm

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

#209815
Nov 29, 2012 at 11:01pm

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.

#209816
Nov 30, 2012 at 1:26am

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.

#209817
Nov 30, 2012 at 8:26am

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.

#209818

You must be logged in to reply to this topic.