How to link segments on a draw in Excel - excel

I have a plot in Excel (displayed below) which includes 5 different segments (A, B, C, D and E). These segments were drawn separately and move also separately. Now, I would like to do two things:
"link" them together in other that if, I move the intersection point between A and B then the length of A and B automatically adjust (however keeping the intersection point between B and C static).
I like to force Excel to consider segment A for example vertical. In other words, it means that if I move the intersection between segments A and B as stated under 1, then segment A parallelly moves and stays vertical.
Is there a way to do these 2 things in Excel (I guess maybe in the configuration of the draw)?

Related

Satisfiability 3-towers assignment

I have stared at this assignment for far too long now and I simply don't understand what I am supposed to do exactly. We are given a 3x3 chess board and have to produce some propositonal clauses to this problem. This is what information we have been given:
Write a Python program that generates the input for a SAT
solver to solve the 3-Towers problem:
a) Write a function pair2int(r,c)
which maps (1,1), (1,2), ..., (3,3) to 1 to 9
using the formula 3*(r-1)+c.
b) Write nested for-loops that go through
all positions on the board from (1,1) to (3,3)
and produces clauses that represent attacks.
c) Write a for-loop that produces clauses that
specify that all 3 rows contain a tower
We are expected to write clauses in Conjunctive normal form as far as I understand. Could also be done directly in DIMACS
So I have done the a part, but I simply don't understand how I am supposed to express attacks or even what an attack constitutes, exactly.
This is the part of the program that I have done (a):
def pair2int(r):
return [3*(p[0]-1)+p[1] for p in r]
print(pair2int([(1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)]))
which simply returns a list of positions 1-9 on a 3x3 board:
[1,2,3,4,5,6,7,8,9]
I don't understand what I am supposed to do with this.
Can somebody push me in the right direction?
The three towers (rooks) have to be put on the chessboard without attacking eachother. Towers can either move horizontally (within a row) or vertically (within a column). Therefore, towers attack eachother if they are put on the same row or on the same column.
A problem solution consists of a set of coordinates (1..3;1..3) or cell numbers (1..9) of the three towers.
A possible binary encoding for tower coordinates consists of four binary variables per tower:
row (encoded with two bits)
column (encoded with two bits)
As alternative, you could encode the cell number 1..9 per tower. This also would require four bits per tower or 12 bits in total.
The constraints to be expressed as clauses:
All towers must have valid coordinates within the chessboard
No pair of towers shares the same row (i.e. one tower per row)
No pair of towers shares the same column (i.e. one tower per column)
3 towers is a simplification of the n queens problem.
Example solution for 8 rooks (Wikipedia):

I only want to see actual x values to show on horizontal axis of Excel Chart (with scale matching those values) not let Excel do scaling and labeling

Below is an Excel Chart for the data shown in column A (x-coordinates--dates) and column B (y-coordinates--test results). There's no problem with the column B data. But note that the horizontal axis shows quite a few more dates than are contained in column A.
Is there any way to have only the actual x-coordinates shown on the horizontal axis with a scale that matches those values?
I kind of get it. Excel deliberately scales the horizontal axis to match as best it can the data in column A. But I don't want that. Beneath each "corner" point of the graph, I'd like to see the date that is associated with the test result in column B.
In other words, there is clearly a point with y-coordinate 154.5. I'd like to see 2/13/2018 directly below that point since that is the data in row 5. Note that the x-axis contains the "correct" date for the first plotted point: (2/9/2017, 70). But for the point with y-coordinate 80, it looks as if that test result occurred on 6/9/2017 rather than 6/16/2018.
So I'd like the graph to appear as shown in the second image, which likely would be impossible because of the "crowding" of x-coordinate values at the right-hand end, but just displaying whichever of the three dates would fit would be good enough, as would just showing one of the two dates in other "crowded" areas. That is to say that something like the third image would be fine.
I suppose I could write VBA code to make it happen, but I'd prefer that Excel do it.
(What crosses my mind is, "Are exact dates really this important?" And the jury is still out on this point. There are arguments both ways. I guess a hung jury goes to the judge, Excel.)
By inserting the points to be plotted into two arrays, datesArr and scaledArr, and putting those values into columns A and B (see worksheet) and in code saying ...
Set ch = ActiveChart
Set s = ch.SeriesCollection
s(1).Values = scaledArray
s(1).XValues = datesArr
... I got exactly what I wanted. Now granted that's not exactly built-in, but we're programmers, yes? And this was downright easy. Well, once I learned a few tricks, especially being able to set angle of dates to 45 degrees.
You need to plot two sets of data, the actual values, and a set of zeros, then smoke and mirrors make it work.
Data below left, make a line chart (top left chart). Add data labels to the second series; I colored the labels orange to match the points, for clarity in this description. Default labels show Y values, which are all zero (top right). Format the data labels to show category values (i.e., dates), below the points, rotated upwards (bottom left). Format format format (bottom right). Axis labels: none. Format second series with medium gray lines and medium gray cross markers. Drag bottom of plot area upwards to make room for the date labels. Hide legend.

How to remove grid lines to distinguish between lattice sites using Python?

The result for certain calculations when drawn using python matshow
.
Is there any way to draw lines
like a border between the various colors like in this figure?
This is a grid n X n that looks like this initially.
Each square has 4 small squares(lattices) within it. i.e in the case of the first square, it has (0,0), (1,0), (0,1) and (1,1) indices occupied by the same number say 0 and the next square has (0,3), (0,3), (1,3) and (1,3) indices occupied by a different number say 1.
This is resulting in a different color. After subjecting it to some mathematical operations I got the first image. Now I want to distinguish between these colors as in figure 2. Is there a way to do this? Any leads would be appreciated!
You could iterate over each cell in the final grid to compare its color with its N, S, E, W neighbors, and draw a line segment corresponding to the border, when the condition is met, and not when the cells share the same color.
I would have provided a small sample code, but you did not explain how your cells and grids are represented; however, this is rather straightforward code that you can probably write.

How to create a line graph on Excel which have very different values

I have a question about plotting a line graph on Excel.
I have 4 variables (say a, b, c, and d) which will be plotted on the vertical axis against one other variable (say x) which will be plotted on the horizontal axis.
Now variables a and b have large values in the millions where as variables c and d have very small values less than 1.
Is it possible to plot this on one line graph instead of having to create two graphs? (i.e a graph for the large values and a graph for the small values)
As the scale is so big for the large data values, the two small data values appear on top of each other and is unclear.
Thanks
Yes... You can create second vertical axis either for a and b or for c and d.. Just keep in mind you can define where the x(horizontal) axis crosses at the left(first) vertical axis. Add all the series (a, b, c, and d) and then right click one by one those you want to take to the second vertical axis and select "Format Data Series" and then select secondary axis in the series options

Excel Line chart using start and end values as data

So I need to make a line chart, the columns will be split to 9 objectives, and the rows a 1-6 scale. USers are asked to rank themselves between 1 and 6 at the start and end of the course and I wish to show a line for each objective to signify the travel from point A. (start) to point B (end)Somehting like this:
I just can;t seem to make it work! Any suggestions?
In my opinion there are at least three possible approaches to this but each one has it drawbacks:-
(1) Just plot each Line separately as a Line graph and move it to a separate sheet (right-click and select Move Graph). Then you can put the graphs next to each other. The down-side is that it is rather fiddly and you may not want them to appear as separate graphs.
(2) Do the first graph as a Scatter using 1 and 2 as the x-coordinates and your first 2 points as the y-coordinates. Then do the next graph with x-coordinates 2 and 3 and use copy and paste to move it onto the same axes as the first graph (click on the line joining the points and use Ctrl-C and Ctlr-V to copy it onto the first graph). The downside is that each line copied in this way will come out in a different colour and once again it is fiddly to change it.
(3) Do the whole thing as one Scatter graph. You need to re-format the data as below to get some suitable coordinates. To get the break between the lines you need a genuine empty cell (not "" produced by a formula) so I suggest you copy the coordinates in pairs (e.g. F2:G3 to F5:G6) and leave every third pair of cells in the column empty. Then select the whole range F2:G27 and insert a Scatter with straight lines joining the points. Fix the X-axis range from 1 to 9.9 and the y-axis range from 1 to 6 and add axis labels and title as required. The downside of using a Scatter like this is that you only have numbers rather than text along the X-axis but it shouldn't matter in your case where you just need an objective number at each tick mark.
In F2:-
=INT((ROWS(F$1:F1)+2)/3)
In F3:-
=F2+0.9
In G2:-
=IFERROR(INDEX($B$2:$C$10,INT((ROWS(G$1:G1)+1)/3),MOD(ROWS(G$1:G1),3)),"")

Resources