Excel-change cell formula dependent on input to another cell - format

I hope I'll be clear.
C13 has a Formula =E13/1.21
I want that if F13 has an X then C13 should have =E13
E13 has the base price of the item
I need C13 to show the price including VAT (%21 here) unless there is an X in F13, then C13 would show the same as E13
thx

Related

Google Sheets: cell value based on another cell's multiple possible values (list from a range data validated)

Simple task: Cell A32 is a data validated to "List from a range" cell. In other words it's a drop-down list cell with several pre-filled values (say, Alpha, Beta, Gamma, Delta). I want Cell B32 to check Cell A32 and return "$" value if A32 is only Alpha or Delta (here I'd like to be able to add as many conditions as I need, say return "$" if A32 is Alpha, Delta, Omega and etc.). If A32 is something else or blank - no value should be returned. How can it be done?
use:
=IF(REGEXMATCH(A32; "(?i)Alpha|Delta|Omega"); "$"; )

I am interested in drawing the solution for various ODEs and PDEs

How to draw the solution y=sinx+c for the ODE dy/dx = cosx?
I tried in excel but did not reach a solution.
I am new to this.
Please help
If you really want to do that in Microsoft Excel, then you can implement, for example, the Euler method for simplicity as follows:
B1 cell : initial value of y, for example, 0
B3 cell : initial value of x, for example, 0
B4 cell : step size, for example, 0.1, which should be sufficiently small
D1 cell : =$B$2
E1 cell : =$B$1
D2 cell : =D1+$B$3
E2 cell : =E1+COS(D1)*$B$3
Next, select the D2 cell and copy it to D3, D4, ... by dragging the fill handle, up to the point that you want to get. Then, select the E2 cell and copy it to E3, E4, ... by double-clicking the fill handle. This gives (x, y) data in D and E columns, and you can make a plot with them. The above initial values correspond to c=0 in your equation.

Sat solver for Lights Out game

I have a school project where I have to find solutions of the game "Lights Out" ( https://en.wikipedia.org/wiki/Lights_Out_(game) ) with a SAT Solver but I am having troubles trying to set a conjuctive normal form of the game.
The game consists of a 5 by 5 grid of lights. Pressing any of the lights will toggle it and the four adjacent lights. The goal of the puzzle is to switch all the lights off.
How I tried until now:
For a 3x3 grid (to begin with), I set 9 terms (for each button) thus:
C11 : the button at the position 1,1 is lighten up
C12 : the button at the position 1,2 is lighten up
C13 : the button at the position 1,3 is lighten up.
[...]
Since the button at 1,1 lights off the button at the position 1,2 and 2,1
I did C11 => C12 and C21
the button at 1,2 lights off the button at the position 1,1 and 1,3 and 2,2 I did C12 => C11 and C13 and C22
and continued for the other:
C13 => C12 and C23
C21 => C11 and C22 and C31
C22 => C12 and C21 and C23 and C32
C23 => C13 and C22 and C33
C31 => C21 and C32
C32 => C31 and C33 and C22
C33 => C23 and C32
then I just converted these to CNF to get the clauses I need for the sat solver, but it seems that what I did was wrong..
can Anyone help me to write this game into CNF form ?
Thank you very much !
Here is the game if you need to understand it better:
https://www.geogebra.org/m/JexnDJpt#material/KArehWn8
The wikipedia article you posted cites something that looks like a pretty good solution: Marlow Anderson, Todd Feil (1998). "Turning Lights Out with Linear Algebra" (PDF). Mathematics Magazine. 71 (4): 300–303. You will need to understand the math in the paper and how to encode Z_2 operations into CNF. (IMO less implementation effort than BMC.) Best of luck on the assignment!
A way to solve the problem is to encode the sequence of actions needed to reach your goal.
One way of doing this is to consider that it takes K moves to solve the puzzle. You will then encode for each step the select cell, and the impact on the related cells, and ask the solver for a model such that the K-th configuration has all lights off.
This technique is called bounded model checking, and you should find several explanations on how to convert to sat.

Evenly distributing items into buckets

I'm working on a problem where I have 18 items that need to be sorted into 3 buckets. Half of the items are red, and half are blue. Also each item is of a specific size; however the sizes are not evenly distributed (I.e. 18, 20, 24, 18, 19, 26...). I need an algorithm that can distribute these items into 3 buckets as follows: 1) Each bucket must end up with six items. 2) Each bucket must end up with 3 red items and 3 blue items. 3) (the part I'm struggling with) If you average the size of the six items in each bucket, they need to be as close as possible to the average size of the items in the other buckets.
I'm just learning to code, and am working on this problem as part of a project; however, I have been reading about sorting algorithms for a couple of days now, but I have not found any solutions that would help in solving the problem at hand, and I am thouroghly stumped. I would prefer to come to the solution on my own, but would greatly appreciate a push in the right direction.
Thanks!
Here is a possible algorithm:
Let the red items in sorted order be r1, r2, r3 ... r9.
Let the blue items in sorted order be b1, b2, b3 ... b9.
Let the 3 buckets be B1, B2, B3.
Put r1 and r9 in B1, r2 and r8 in B2, r3 and r7 in B3.
Similarly, put b1 and b9 in B1, b2 and b8 in B2, b3 and b7 in B3.
Now, we are left with r4, r5, r6 and b4, b5, b6.
Put r4 and b6 in B1, r5 and b5 in B2, r6 and b4 in B3.

Setting up collision groups in farseer

I'm trying to set up collision groups in Farseer so that the items in the picture collide as follows:
G1 Collides with All.
B1 and B2 collide with each other and G1, but not R1 or R2
R1 and R2 collide with each other and G1, but not B1 or B2.
I've been playing around with _Body.CollidesWith = Category.Cat1; and _Body.CollisionCategories = ..., but I'm basically just guessing. Haven't really found any usefull examples in the docs, but I might not have been looking in the right place either.
Edit 1:
Ok, so experimenting some more.
Assuming _Body is B1 (and also applied to B2) in the picture, and Cat1 is G1, and Cat2 is all blue items..
_Body.CollidesWith = Category.Cat1 & Category.Cat2;
_Body.CollisionCategories = Category.Cat2;
Should this not then allow B1 to collide with the ground (G1) and all other blues (B# items)?
Applying the above code makes all blue items collide with nothing not even each other...
_Body.CollisionCategories = Category.Cat1 | Category.Cat2;
instead of
_Body.CollisionCategories = Category.Cat1 & Category.Cat2;

Resources