Do you ever use exponentiation (^) in arithmetic comb?
-
- Filter Inserter
- Posts: 503
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Do you ever use exponentiation (^) in arithmetic comb?
I wonder if exponentiation (^) operation has any practical use in the arithmetic combinator. The only meaningful case I can imagine is 2 ^ X, that can be replaced to 2 << (X - 1). Anything else?
I never use it, maybe there are some great tricks I don't know?
I never use it, maybe there are some great tricks I don't know?
Re: Do you ever use exponentiation (^) in arithmetic comb?
No. I only use arithmetic combinators for subtracting values, negating values, and as a diode. Anything that needs more quickly becomes a pain in the arse to think about and i try to avoid that.
My problem with the combinators is, that they are only providing the most basic operations. Therefore doing anything more complex with them feels like programming in a language with no standard library and tends to use up vast amounts of space - wich makes the proportions of actual production footprint to control logic footprint look way off.
Whenever there are ways doing something without combinators, that is also almost always the better way to do it. I do use a circuit-optimized kovarex process though...
My problem with the combinators is, that they are only providing the most basic operations. Therefore doing anything more complex with them feels like programming in a language with no standard library and tends to use up vast amounts of space - wich makes the proportions of actual production footprint to control logic footprint look way off.
Whenever there are ways doing something without combinators, that is also almost always the better way to do it. I do use a circuit-optimized kovarex process though...
Re: Do you ever use exponentiation (^) in arithmetic comb?
No.
Its main purpose seems to be clarifying that the XOR operator (blue ^) is NOT an exponent.
Its main purpose seems to be clarifying that the XOR operator (blue ^) is NOT an exponent.
Re: Do you ever use exponentiation (^) in arithmetic comb?
No, each ^ x is pretty useless.
This is one of those functions that where added just to have the full set of operands available.
It might have been useful if we could do x ^ each = each to generate powers of 2 for binary conversions.
This is one of those functions that where added just to have the full set of operands available.
It might have been useful if we could do x ^ each = each to generate powers of 2 for binary conversions.
My Mods: mods.factorio.com
Re: Do you ever use exponentiation (^) in arithmetic comb?
No, problem of combinators is that there is no actual use for them in the game. Of course there are systems which are intended to use combinators to produce strange things and some control systems too, but at least for me they are more for use of combinators than actual need.
Combinators would be great to make systems adapt changing situations, like temperatures or non linear effects, but unfortunately devs have never used their potential. That may be too hard for average players and also most of advanced players want to build a megabase with the exact mathematical ratios instead of adaptive and varying systems but I hope there could be more complex difficulty level with varying conditions, side products etc. interesting things from engineering point of view (mods can give side products but not dynamic environment).
Combinators would be great to make systems adapt changing situations, like temperatures or non linear effects, but unfortunately devs have never used their potential. That may be too hard for average players and also most of advanced players want to build a megabase with the exact mathematical ratios instead of adaptive and varying systems but I hope there could be more complex difficulty level with varying conditions, side products etc. interesting things from engineering point of view (mods can give side products but not dynamic environment).
Re: Do you ever use exponentiation (^) in arithmetic comb?
You can use "each ^ 2 => each" to compute a square mean deviation. Too bad there is no sqrt() or "each ^ 0.5" to go along with it.
It's sad that each / everything / anything can't be used as second argument of an arithmetic combinator. Would be useful for - and / too.
It's sad that each / everything / anything can't be used as second argument of an arithmetic combinator. Would be useful for - and / too.
-
- Long Handed Inserter
- Posts: 85
- Joined: Sun Dec 04, 2016 9:18 pm
- Contact:
Re: Do you ever use exponentiation (^) in arithmetic comb?
The main application is elementwise multiplication of all signals on two wires. That is, each = each * each.
I think it can also be used for IIR filters.
I think it can also be used for IIR filters.
-
- Filter Inserter
- Posts: 503
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Re: Do you ever use exponentiation (^) in arithmetic comb?
If you like circuits, you can build sqrt() by yourself using Babylonian method, it's simple and converge fast, especially if you can precalculate good initial guess. It works with integers too.mrvn wrote: Mon Sep 02, 2019 3:43 pm You can use "each ^ 2 => each" to compute a square mean deviation. Too bad there is no sqrt() or "each ^ 0.5" to go along with it.
Re: Do you ever use exponentiation (^) in arithmetic comb?
You can do a lot of things. The question is: Would you want to?coppercoil wrote: Mon Sep 02, 2019 6:35 pmIf you like circuits, you can build sqrt() by yourself using Babylonian method, it's simple and converge fast, especially if you can precalculate good initial guess. It works with integers too.mrvn wrote: Mon Sep 02, 2019 3:43 pm You can use "each ^ 2 => each" to compute a square mean deviation. Too bad there is no sqrt() or "each ^ 0.5" to go along with it.
-
- Filter Inserter
- Posts: 503
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Re: Do you ever use exponentiation (^) in arithmetic comb?
That's a good question. Do I want a square mean deviation?mrvn wrote: Mon Sep 02, 2019 8:10 pm You can do a lot of things. The question is: Would you want to?
Re: Do you ever use exponentiation (^) in arithmetic comb?
Do you really have ideas which need deviations or IIR-filters for control of production of actual factory or are they some kind of special projects which just use Factorio as fun and strange programming language?mrvn wrote: Mon Sep 02, 2019 3:43 pm You can use "each ^ 2 => each" to compute a square mean deviation. Too bad there is no sqrt() or "each ^ 0.5" to go along with it.
Re: Do you ever use exponentiation (^) in arithmetic comb?
I used square to balance recipes to the availability (or lack) of inputs and outputs. In Angels mods there is a recipe to make steel from iron and one for making steel from iron + silicon. For each item I have a goal for how much of it I want to have around in buffer chests. That allows me to calculate a score for every recipe. For example if steel is below the goal then I want to use one of the two steel recipes to make more. If there is few iron but enough silicon then the second recipe is used. If iron starts to back up the first one is used instead.Hannu wrote: Fri Sep 06, 2019 5:32 amDo you really have ideas which need deviations or IIR-filters for control of production of actual factory or are they some kind of special projects which just use Factorio as fun and strange programming language?mrvn wrote: Mon Sep 02, 2019 3:43 pm You can use "each ^ 2 => each" to compute a square mean deviation. Too bad there is no sqrt() or "each ^ 0.5" to go along with it.
What I found is that using "buffered - goal" doesn't give the system enough of a feedback. When both iron and silicon are above the goal then it produces twice as much steel until both sides of the recipe balance and the recipe gets a score of 0. But if I used "sign(buffered - goal) * (buffered - goal)^2" even a small amount of steel in excess of iron or silicon will tip the scales the other way.