## layout: How to draw different colors in a 2D layout with color depending on the xy coordinates?

I'm doing a composite 2D graphic, combining different types of graphics (`Graphics`, `ListPlot` etc.) with `Show`. A layer of the plots contains a polygon filled with colors that depend on the 2D coordinates in the polygon. (The vertices of the polygon are `{{0.6400744901465835, 0.3299704937157755}, {0.29999999497269986, 0.5999999722714001}, {0.15001662467009716, 0.060006658004021524}}`.)

To draw the polygon, first I thought about using `ColorFunction` with `DensityPlot`, but it seems that it only receives the value of the function itself, not the coordinates. My next attempt was with `RegionPlot`, which gets the coordinates. This looks like the following code.

``````(* Functions to calculate the color from the coordinates x and y *)
xyY2XYZ[x_, y_, Y_] = {(xY) / y, Y, - (((- 1 + x + y) Y) / y)};
normalize[x_] : = x / Max @ x
XYZ2sRGB[c_] : = (normalize[( {
{3.2406255, -1.537208, -0.4986286},
{-0.9689307, 1.8757561, 0.0415175},
{0.0557101, -0.2040211, 1.0569959}
} ).c]) ^ (1 / 2.2)
(* Actual layout *)
RegionPlot[True, {x, 0.14, 0.65}, {y, 0.05, 0.61},
ColorFunction ->
Function[{x, y},
RGBColor[
If[Max@Abs@Im@# != 0, {1, 1, 1}, Re@#] & @
XYZ2sRGB @ xyY2XYZ[x, y, 1]]], ColorFunctionScaling -> False,
Tracing points -> 250]
``````

But I had to increase `PlotPoints` to `250`Otherwise, the result was too pixelated at the edge, and `MaxRecursion` It does not seem to affect the output. This results in a long waiting time, and the edge still remains irregular.
In addition, the blue line between the image and the frame is an unwanted artifact.

So, what is a better way to do this?

## Find all ordered pairs (x, y) that satisfy both (3x-4y) / xy = -8 and (2x + 7y) / xy = 43

This is listed in the "multiple variable" category of my Alg 1 task.

Find all ordered pairs (x, y) that satisfy both (3x-4y) / xy = -8 and (2x + 7y) / xy = 43

## How to project 3d images in the planes xy, xz, yz.

Some idea of ​​how to do something similar to the image, but with any 3d object

## formal languages ​​- does | xy | ≤ p in the pumping slogan count for all i?

While learning about pumping the slogan, I found the following question:

Since the language is L $$a ^ n (0 | 1) ^ *$$ with $$c_0 cdot c_1 = n$$, where $$c_0$$ Indicate the number of zeros present, use the pumping motto to prove that this language is not regular. Examples of valid words in L are `0`, `one`, `a01`, `aa001`, etc …

In regular English: a word with a leader. `a`s, followed by any amount of any `0` or `one` characters, where the number of zeros multiplied by the number of ones needs to match the number of zeros `a`s.

My first attempt was the following:

• Pick up w as $$a ^ p0 ^ p1$$. This obviously remains from $$p cdot 1 = p$$.
• Divide w in xyz as $$x = epsilon$$, $$y = a ^ p$$, $$z = 0 ^ p1$$.
• Show that $$xy ^ 2z = a ^ {2p} 0 ^ p1$$ can not stand, because $$p cdot 1 ne 2p$$.

However, the answer key chooses to introduce two new variables. $$m geq 0$$, $$n gt 0$$, then it is divided into $$x = a ^ m$$, $$y = a ^ n$$, $$z = a ^ {p-n-m} 0 ^ p1$$ (dividing the sequence of a into three parts). So, they also use $$i = 2$$ to show that $$xy ^ 2z = a ^ m to 2n a ^ p-n-m} 0 ^ p1 = a ^ p + n} 0 ^ p1$$, that is not a member of the language (since n was more than 0).

From what I can see, my attempt sticks to the $$| xy | leq p$$ Condition of the pumping motto: x is empty and $$| and | = p$$. As such, I had the impression that my answer was correct.

However, the enormous increase in the complexity of the response in the response key leads me to believe that this is not a valid approach. I suspect that this is because in reality my answer make violate the $$| xy | leq p$$ condition.

Is my attempt a correct way to prove that the language is not regular? If not, what error / mistake did I make on the road?

## \$ f (x, y) = begin {cases} frac {xy ^ 2} {x ^ 2 + y ^ 2} text {if} (x, y) not = (0,0) \ 0 text {if} (x, y) = (0,0) end {cases} \$ differentiable?

$$f (x, y) = begin {cases} frac {xy ^ 2} {x ^ 2 + y ^ 2} text {if} (x, y) not = (0,0 ) \ 0 text {if} (x, y) = (0,0) end {cases}$$

Is this function of two variables differentiable in (0,0)?

## python – Error with Image.putpixel (). return self.im.putpixel (xy, value) TypeError: the function takes exactly 1 argument (3 dice)

Here is the code:

``````import numpy as np
import matplotlib.pyplot as plt
from PIL import image
#from Scipy Import Misc
import cv2

i = Image.open ("originalfit.jpg")
w = Image.open ("originalfit_wiener.jpg")
r = Image.open ("binary_img.png")

pre = Image.open (& # 39; preprocessed.png & # 39;)

# Get properties of the image.
h, w, bpp = np.shape (rcv)

# iterate over the entire image.
for p and in range (0, h):
for px in range (0, w):
if r.getpixel ((px, p and)) == 0 and i.getpixel ((px, p and p)) - w.getpixel ((px, p and p))> 0:
pre.putpixel ((px, p and p), w.getpixel ((px, p and p)))
plus:
pre.putpixel ((px, py), i.getpixel ((px, py)))
``````

Here is the error message:

Tracking (recent calls latest):
File "preprocessing.py", line 23, in
pre.putpixel ((px, py), i.getpixel ((px, py)))

File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 1696, in putpixel
returns self.im.putpixel (xy, value)

TypeError: the function takes exactly 1 argument (3 dice)

## Algorithms – How to check if a list of XY coordinates meets the safety distance between them?

My record is not CS, so I regret the use of an inappropriate term. But basically I want to verify if a point in the XY plane is "too close" to other points, and do it with each point. In other words, if I draw a circle with radius R at each point, any circle will cross other circles in the plane.

I want to code this in Python, if that matters.

## position: describing the movement of the hand sliding in 3D like a curve in an XY plane

I am trying to describe a 3D sliding gesture (only vertical or horizontal, without diagonals) on a given flat surface using so much conventional geometry or similar dissimilar learning techniques (the hidden Markov model is hidden, artificial neural networks, etc.) ) as possible. From the multiple observations of the data recovered from the device, I came to the conclusion that a hit can be described "easily" as a curve (or in some cases as a really straight line). With this question, I would like to know how you can describe a curve and a curved movement in simple geometric terms in the most efficient way (mainly speed, but also memory).

The publication is divided into two parts: one that provides information on the data used and another that provides an overview of what I have found so far. I am sorry in advance for my poor painting skills. :RE

3D position data

The device that I am using, transmits 3D points that represent the position of the hand at a given moment. I can capture and evaluate these. The following image displays the diagram of the data from two different perspectives: top to bottom and isometric (more or less):

• Flat view XY (on the left, aka top-down view) – for each sample only the values ​​along the X and Y axes are taken into account. This view represents the surface of the device above which the movement of the hand is detected.
• XYZ view (on the right, aka isometric view) – for each sample, the three axes are taken into consideration. This view represents the complete 3D movement in a volume on the surface of the device that defines the space where gestures can be detected

In the following image I have added the movement of the hand as detected by the device:

The real movement looks more like this:

Based on the observation of the real movement and that detected by the device, I can mark almost half of the samples that the device has given me as invalid, that is, all the edge values ​​(along each axis, one position can be between 0 and 65534), which does not describe the actual movement of the hand from the user's perspective of the device (in the image below, the invalid data is represented as the part of the trajectory that is covered by a polygon):

Of course, sometimes the "valid" part of the trajectory is quite small compared to the invalid data:

The algorithm I described below does not care how much of the valid data, as long as there are at least 2 samples that meet the requirement of not being edge positions, which means that X and Y are different from 0 and 65534. This is a problem. that I will detail in the next part of this post.

Describing the movement

I've thought about it a bit and this is what I came up with:

1. Extract only the set of valid samples that excludes all those that have an edge position

2. For each sample, generate a local XY coordinate system that is aligned with the XY coordinate system of the device surface (to make things easier :)):

3. Next, I'm thinking about calculating the vector between the current and the next sample (if present) and calculating the angle between that vector and the X axis (you can also do it with the Y axis):

4. Using the magnitude of each angle, I can determine if the movement between the current and the next sample is tilted more toward a horizontal or vertical one and also in which direction.

This should allow me to determine the general direction of the sliding movement, as well as the position on the surface. I have swept a lot: D but since I want to describe this in a more formal way, obviously I need to describe my findings, hence the need to find a way to describe and classify a curve according to its properties. Maybe calculate the curvature of the entire trajectory?

Of course, there are some problems with this algorithm that came to my mind:

I searched online before I started thinking about creating the algorithm I described earlier, but I could not find anything. Even the issue of curves classification seems not to be as popular or the search terms I used are too broad / restrictive. The classification here is not so essential (unlike what follows) but it would still be good to be able to divide the resulting curves into sets, each representing a sliding gesture.

The next thing I've been thinking about is the curve adjustment. I have read articles about this but, frankly, along with a couple of assignments at my university during the math course, I have not thought much about it, except Bezier's curves. Can anyone tell me if the adaptation of curves is a plausible solution for my case? Since it is curved suitable it would be wise to assume that we need an initial curve against which we want to make our adjustment. This would require gathering sliding movements and then extracting a possible optimal curve that is something like an "average" of all the curves for a given slip. I can use the first algorithm I described earlier to get a compact description of a curve and then store and analyze multiple curves for a given stroke to get the "perfect" curve. How do you proceed when handling the classification of curves?

## partial derivative: particle that moves along the unit circle centered on the origin of the xy plane

A particle moves along the unit circle centered on the origin of the xy plane. Find the address of $$nabla times mathbf v$$.

My intent:

I found that $$displaystyle frac { partial v_x} { partial and}> 0$$ Y $$displaystyle frac { partial v_y} { partial x} <0$$. As $$v_z equiv 0$$, its partial derivatives with respect to $$x$$ Y $$and$$ They are also zero. But how do I find the signs of $$displaystyle frac { partial v_x} { partial z}$$ Y $$displaystyle frac { partial v_y} { partial z}$$?

## Help with elementary level Test of (xy) ^ 1

A little disconcerted in this test, I continue to reach the dead ends. Any help would be appreciated:

{Proposition 8.6:} For all $$x, and in mathbb {R} – {0 }$$, $$(xy) ^ {- 1} = x ^ {- 1} y ^ {- 1}$$.