You sure could. Although the setup would make the calculation rigid.
Two options.
1 - While there are a few math nodes available in the node editor. Some of the more complex functions like cosine aren’t. Arnold has math shaders that are great. But these only get calculated at render time so you wouldn’t be able to feed it to an attribute (I think but totes could be wrong, worth a try just in case).
2 - This is probably your best option for feeding to an attribute. Use an expression node! They are pretty simple and you can find the expressions you need online. You’ll just need a basic understanding of coding. But with this you can fetch and data and run your equations, then output directly to an Attrib.
let me know if this helps at all!