Hyperbolic function in combinator

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
netbrehon
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Oct 01, 2020 7:06 pm
Contact:

Hyperbolic function in combinator

Post by netbrehon »

I'm trying to implement hyperbolic function, that could use any input signal as an `x` parameter.

taking simple hyperbolic function: y = A / x

where y is output (`any` signal), A is just `A` signal in input, and x would be `Any` signal in input.

That would be really simple, if I could select `any` signal as an denominator in division in arithmetic combinator. But it is impossible.

Do you have any idea on workaround for this? Nothing comes to my mind honestly.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Hyperbolic function in combinator

Post by DaveMcW »

There is no workaround in the general case, besides using O(N) time or O(N) combinators.

In the special case where you have a small set of X values, you can use Y = A * (least_common_multiple / X) / least_common_multiple, with a list of precomputed (least_common_multiple / X) values.
Post Reply

Return to “Gameplay Help”