## How to store outputs as coordinates and use ListPlot to plot them?

so I have a program that outputs a desired value for incrementing values of alpha. Right now, my program prints a list of these for 40 values of alpha in the form {alpha, newValue}.

``d = 1000; For[k = 1, k <= 40, k++,   alpha = 0.1*k;   fd = 3*d^2/(Pi^2);    fs = fd*FareySequence[d];   count = 0;    For[i = 1, i < fd, i++,     For[j = (i - 1), j > 0, j--,       If[(fs[[i]] - fs[[j]]) < alpha, count++, Break[]]];];     newValue = count/d^2;   Print["{", alpha, ",", newValue, "}"];   ]; ``

Here are the first few outputs:

``{0.1,0} {0.2,0} {0.3,0} {0.4,1911/100000} {0.5,13593/250000} {0.6,90521/1000000} .. .. .. {3.9,1155653/1000000} {4.,74163/62500} ``

I want to make a plot all of these outputs as coordinates. I want to plot these point on a graph with alpha on the x axis and newValue on the y axis. Any help would be appreciated.

## Symmetry unique atom coordinates

One thing I love about Mathematica is how easily I can go from the name of a molecule to estimated coordinates of its atoms, with a command like

`AtomList[Molecule[Entity["Chemical", "Toluene"]], All, {"AtomicNumber", "AtomCoordinates"}]`

(although, oddly enough, "AtomCoordinates" does not appear in the "AtomList" documentation)

I can also easily get the point group:

`Molecule[Entity["Chemical", "Toluene"]]["PointGroup"]`

This is exciting because this is exactly the input I need to run GAMESS and do quantum chemistry calculations (starting with a geometry optimization, of course, since JM has informed me that these coordinates are heuristic guesses).

But, really, this is not exactly the input that I need: what I really need are coordinates of only the symmetry-unique atoms.

I don’t suppose there’s a way to get coordinates of symmetry-unique atoms, which I can use for GAMESS input? I know there’s some functions related to point group symmetry, but I haven’t thought of how to do it.

## Find the maximum number of valid cartesian coordinates

Given a list X containing m number of x coordinates and a list Y containing m number of y coordinates. The coordinate (x, y) is valid if and only if the difference between x and y is less than or equal to d. I need to find out the maximum number of valid coordinates. Here is my algorithm.

``sort the list X in non-decreasing order sort the list Y in non-decreasing order for x in X:      for y in Y:          if abs(x - y) <= d:              let x match with y              remove x from X              remove y from Y ``

Can this algorithm give me maximum number of valid pairs? If yes, is there any more efficient algorithm? The nested loop means the worst-case time is $$O(m^2)$$. Is there any log linear time $$O(mlogm)$$ algorithm for this question?

## How to transform robot motor steps into X/Y coordinates?

I have a robot with two motors A and B connected to wheels 21.6mm in diameter. The motors move in steps, and there are twenty steps for each complete revolution of the wheel. To make the robot move forwards, I turn on A and B in the forward direction and have it rotate a number of steps. To make it move backwards, I turn on A and B in the reverse direction. To get it to turn left, I turn on A and turn off B. Similarly to get it to turn right, I turn off A and turn on B. Using this scheme, I can get the robot to move in any direction.

My question is this: is it possible to transform the steps of motor A and motor B into the X/Y coordinates for the robot? For example, if I move the robot forward 10 steps, turn right 10 steps and move forwards again 10 steps can I calculate the X/Y coordinates of the robot? Assume that the robot starts at point 0,0.

## Collision Detection without Coordinates in Tilemaps in Pygame

So if I wan’t to make a collision detection with rectangles, than I can just do this as I have the coordinates of the rectangle:

``rcx = 200 rcy = 200 rcw = 200 rch = 100 plx = 500 ply = 450 plw = 50 plh = 50 rectcolor = (100, 150, 200)  testobj = pygame.draw.rect(win, rectcolor, (rcx, rcy, rcw, rch)) player = pygame.draw.rect(win, (150, 200, 100), (plx, ply, plw, plh))     if plx <= rcx + rcw and plx + plw >= rcx and ply <= rcy + rch and ply + plh >= rcy:     rectcolor = (50, 100, 50) else:     rectcolor = (100, 150, 200) ``

Ok, good! I made a collision detection with rectangles because I know the coordinates of the rectangles. (I don’t think this is the most efficient way but it works) Anyways I am programming a Bomberman game, right now I don’t have any sprites but I use rectangles for it. This is my code:

``import pygame  pygame.init()  WinWidth = 800 WinHeight = 608 p1x = 32 p1y = 32 vel = 1 clock = pygame.time.Clock()  win = pygame.display.set_mode((WinWidth, WinHeight))  def player():     pygame.draw.rect(win, (0, 200, 200), (p1x, p1y, 32, 32))  class invi:     def __init__(self, x, y):         self.x = x         self.y = y         pygame.draw.rect(win, (0, 255, 200), (x, y, 32, 32))   class Wall:     def __init__(self, x, y):         self.x = x         self.y = y         pygame.draw.rect(win, (50, 50, 50), (x, y, 32, 32))   class Breakable:     def __init__(self, x, y):         self.x = x         self.y = y         pygame.draw.rect(win, (200, 150, 100), (x, y, 32, 32))   game_map1 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],              [0, 10, 10, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 10, 10, 0],              [0, 10, 0, 2, 0, 2, 0, 2, 0, 0, 0, 2, 0, 2, 0, 2, 0, 10, 0],              [0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0],              [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0],              [0, 2, 2, 2, 2, 10, 10, 2, 2, 10, 2, 2, 10, 10, 2, 2, 2, 2, 0],              [0, 2, 0, 2, 0, 10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 2, 0, 2, 0],              [0, 2, 2, 2, 2, 2, 0, 2, 2, 10, 2, 2, 0, 2, 2, 2, 2, 2, 0],              [0, 2, 0, 2, 0, 2, 0, 2, 10, 10, 10, 2, 0, 2, 0, 2, 0, 2, 0],              [0, 0, 0, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 2, 2, 0, 0, 0],              [0, 2, 0, 2, 0, 2, 0, 2, 10, 10, 10, 2, 0, 2, 0, 2, 0, 2, 0],              [0, 2, 2, 2, 2, 2, 0, 2, 2, 10, 2, 2, 0, 2, 2, 2, 2, 2, 0],              [0, 2, 0, 2, 0, 10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 2, 0, 2, 0],              [0, 2, 2, 2, 2, 10, 10, 2, 2, 10, 2, 2, 10, 10, 2, 2, 2, 2, 0],              [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0],              [0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0],              [0, 10, 0, 2, 0, 2, 0, 2, 0, 0, 0, 2, 0, 2, 0, 2, 0, 10, 0],              [0, 10, 10, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 10, 10, 0],              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]  run = True while run:      pygame.init()      clock.tick(100)     win.fill((0, 255, 200))     y = 0     for layer in game_map1:         x = 0         for tile in layer:             if tile == 0:                 Wall(x * 32, y * 32)             if tile == 10:                 invi(x * 32, y * 32)             if tile == 2:                 Breakable(x * 32, y * 32)             x += 1         y += 1      player()      for event in pygame.event.get():         if event.type == pygame.QUIT:             pygame.quit()             run = False     if event.type == pygame.KEYDOWN:         if event.key == pygame.K_d:             p1x += vel         elif event.key == pygame.K_a:             p1x -= vel      pygame.display.update() ``

sooo… I watched a tutorial and even tried to make a collision detection on my own. But I just can’t do it. I don’t have coordinates for the rectangles in the tilemap and there are very much rectangles in the tilemap, too. How could you make a collision detection with a tilemap with no coordinates and many rectangles? And yeah, the game doesn’t have much stuff going un ’til now… oh and I deleted the parts where I tried to make a collision detection as they all were bad, didn’t work, took up much of the place and just made the whole code more confusing.

Btw if this is not a good question to ask in this StackExchange Q&A Website, sorry, im new to this Website. But I would still be happy to get an answer on this question! 🙂

## Algorithm for drawing the horizon given the current coordinates, elevation and field of view

I have a large database containing coordinates along with an elevation number. If I am a person looking in some direction (0-360) with an n degree field of view, and located at some coordinate and at some elevation, how can I generate an image representing the horizon? What algorithm should I use?

## Given a plot of a network Graph[] how can the {x,y} screen coordinates be output?

Is there a general way to get the screen or "world" coordinates for every vertex in the graphic output of something like this?

``Table[Graph[Table[i \[UndirectedEdge] i + 1, {i, 20}],    GraphLayout -> l,    PlotLabel -> l],  {l, {"CircularEmbedding", "SpiralEmbedding"}}] ``

Trying to build an algorithm to generate novel layouts and want to use a large amount of other algorithms for training data.

## Diamond shaped map: converting tile number to coordinates and back

I have a diamond shaped map that is deserialized/represented as follows:

``   j  0  1  2  3  4  5  6  7 i  0     *  *  *  0  1  *  *  * 1     *  *  2  3  4  5  *  * 2     *  6  7  8  9 10 11  * 3    12 13 14 15 16 17 18 19 4    20 21 22 23 24 25 26 27 5     * 28 29 30 31 32 33  * 6     *  * 34 35 36 37  *  * 7     *  *  * 38 39  *  *  *  ``

I want to convert the tile number, to its coordinates (i, j) and back. I have managed to convert a coordinate to its tile number like so:

``Given a map width and height n: if(i< (n/2):     number = i*(i+1) + j else:     number = (2*((n/2)*((n/2)+1))) - ((n-i)*(n-i+1))) + j  So: (0, 3) -> 0; (6, 2) -> 34; ``

However, I cannot figure out to go back to the coordinates from the tile numbers, because I have trouble with distilling the i parameter from the tile number.

I have tried googling with terms like "diamond shaped map tile numbers coordinates convert", but no luck.

Can someone point me in the right direction?

## Is there a function to, given a set of co-ordinates, return a list of co-ordinates on the edge [closed]

For example, return the coordinates (-1, 1) (0,0) (1,1) and (1,2) from the following cartesian plane

## Transform the mouse coordinates to the GLSL plane

I am creating a 2D map editor in C ++ with GLFW. I want move and drag entities with the mouse, but I have a problem, the mouse coords are in the window size range (1200, 720) and the entity is in the GLSL range (100×100 I think), I compare the mouse coord with the 4 entity edges. How can I do this?