## pattern matching – Multiplying two expressions with a specific function, effectively

To paraphrase, the problem I am trying to solve is as follows. I am given two sums "evaluated by matrix"

``````expr1 = Sum(c(i) M(i), {i, range1})
expr2 = Sum(d(j) M(j), {j, range2})
``````

where cs and ds are coefficients and Ms are unspecified (symbolic) matrices. I would like to multiply these two sums, with the multiplication of two of these matrices understood by me, ie specified by a function, let's call it "f". I'm trying to do this effectively. I do not know in advance which matrices will appear, only that they have the head M.

Defining an explicitly linear matrix multiplication works, but seems to be quite ineffective, at least the way I managed to find (my coefficients are other generic expressions).

Using the collection and matching of models instead, I managed to find the following

``````desiredfunction(a_, b_) :=
Module({c = Collect(a, M(_)), d = Collect(b, M(_))},
c((0)) = List; d((0)) = List;
Outer(#1((1 ;; -2))*#2((1 ;; -2))*f(#1((-1)), #2((-1))) &, c, d)//Flatten//Tr)
``````

that is, I explicitly transform the sums into lists of terms, and generate the external product of the two lists, multiplying the coefficients and combining the matrices using "f", and finally adding everything together.

It does what I want, but I can't shake the feeling that this is some kind of elementary operation (combine two expressions written in the form coefficients * objects with a rule for combining objects and coefficients) that there must be a better way to do this, perhaps via built-in functions. Am I neglecting something obvious here?

To copy and paste in Mathematics:

``````expr1 = Sum(c(i) M(i), {i, 1, 3});
expr2 = Sum(d(i) M(i), {i, 2, 6});

desiredfunction(a_, b_) :=
Module({c = Collect(a, M(_)), d = Collect(b, M(_))},
c((0)) = List;
d((0)) = List;
Outer(#1((1 ;; -2))*#2((1 ;; -2))*f(#1((-1)), #2((-1))) &, c, d) //
Flatten // Tr)

desiredfunction(expr1, expr2)
``````

## Microsoft Excel – matching all dates highlighted in one column to those in another column

My ultimate goal is to highlight all of the dates highlighted in column P of column M. I was wondering if there was a formula so that I could choose all the values ​​highlighted only in column P and highlight the same values ​​in column M.

So I have a bunch of highlighted dates in one column, see column P. I didn't find a way to copy the highlighted dates in column M, so I had to have them copy manually, which led to the formation of column N, as I was hoping that there would be a formula to highlight all of the same values ​​in column N and column M. I could only still not find the appropriate formula to do so.

As there are several documents, it would take an extremely long time to do it by hand. Thanks to the advance picture of my document

## pattern matching – DeleteCases with a case as a float?

Could the `DeleteCases` have matching problems when the list is floats (machine precision numbers)? For example. in this code, it may not match correctly because float == float is not a good operation:

``````ClearAll(a);
a = RandomReal({0, 1}, 5)
DeleteCases(a, Max(a))
``````

How would you handle these types of situations? What is the robust method?

## pattern matching – Take some terms from a polynomial

You can use `CoefficientList` and select the necessary elements in the matrix:

``````ser =
1 - x/2 - x^2/8 - x^3/16 +
y/2 + (3 x y)/4 + (23 x^2 y)/16 + (27 x^3 y)/32 -
y^2/8 - (31 x y^2)/16 - (127 x^2 y^2)/64 - (351 x^3 y^2)/128 +
y^3/16 + (35 x y^3)/32 + (407 x^2 y^3)/128 + (1915 x^3 y^3)/256;

PolynomialQ(ser, x)
(* True *)

coef = CoefficientList(ser, {x, y})
(* {{1, 1/2, -(1/8), 1/16}, {-(1/2), 3/4, -(31/16), 35/
32}, {-(1/8), 23/16, -(127/64), 407/128}, {-(1/16), 27/
32, -(351/128), 1915/256}} *)
``````

List of necessary coefficients:

``````selectedCoef = Reverse@LowerTriangularize(Reverse@coef, 1)
(* {{1, 1/2, -(1/8), 1/16}, {-(1/2), 3/4, -(31/16), 35/
32}, {-(1/8), 23/16, -(127/64), 0}, {-(1/16), 27/32, 0, 0}} *)
``````

You can now build a polynomial from these coefficients:

``````Expand@Fold(FromDigits(Reverse(#1), #2) &, selectedCoef, {x, y})
(* 1 - x/2 - x^2/8 - x^3/16 + y/2 + (3 x y)/4 + (
23 x^2 y)/16 + (27 x^3 y)/32 - y^2/8 - (31 x y^2)/16 - (
127 x^2 y^2)/64 + y^3/16 + (35 x y^3)/32 *)
``````

## Show the row selected for matching in all columns of a drop-down list in Google Sheets

I would like to create a search from a dropdown list with all unique sheet data which finds a match in any column and returns the selected line items.

Let's say that each row represents a single device with several components described in each column with a unique ID for all. How can I find an ID and get all the column IDs associated with this row selection?

I can do this for a single column or row with VLOOKUP or INDEX, MATCH but maybe there is a way to make it work without a single parent key …

Thanks for the help

## python – Error passing numpy.core._exceptions.UFuncTypeError parameters: ufunc & # 39; subtract & # 39; did not contain matching loop signature types (dtype (& # 39; <U21 & # 39;)

Basically I have the following code:

``````import numpy as np

def localize(aux1, aux2, aux3, aux4, aux5, aux6):

search = np.array(((aux1,aux2,aux3,aux4,aux5,aux6)))

B1A = np.array(((-46,-78,-72,-70,-81,-59)))     #B1A
B1B = np.array(((-100,-82,-85,-100,-76,-55)))   #B1B
B1C = np.array(((-100,-100,-100,-78,-100,-58))) #B1C
B2A = np.array(((-100,-88,-100,-100,-100,-60)))  #B2A
B2B = np.array(((-100,-78,-79,-80,-80,-59)))     #B2B

candidatos = (B1A, B1B, B1C, B2A, B2B)
margem_erroP = 10.0
margem_erroN = -10.0

distancias = candidatos(::) - search

avaliar_dist = np.where(np.absolute(distancias) < margem_erroP, True, False)
avaliar_distN = np.where(np.absolute(distancias) < margem_erroN, True, False)

print()
print("Busca: {}".format(search))
print(candidatos(x))

here = candidatos(x)(-1)
print("Aquii")
print(here)

print("Local: B1A")
local = "B1A"
print("Local: B1B")
local = "B1B"
print("Local: B1C")
local = "B1C"
print("Local: B2A")
local = "B2A"
print("Local: B2B")
local = "B2B"
else:

x = {
"search" : search.tolist(),
"locale" : local,
"result" : here.tolist()
}
json.dumps(x)
return x

``````

So far so good, it works as it should!

The problem is when I try to execute this function from another location. For example:

I have a variable find which contains the following string: `'-100,-67,-63,-49,-53,-48'`

Since I have to pass 6 values ​​and in this case I only pass 1 (a string), I separate my string into whole numbers using the following command:
`valores = find.split(",")`

Now my list becomes this: `('-100', '-67', '-63', '-49', '-53', '-48')`

To make my function work, I did it as follows: `aux = localize.localize(valores(0),valores(1),valores(2),valores(3),valores(4),valores(5))`

In other words, what I'm doing is basically: `localize.localize(-100 -67 -63 -49 -53 -48)`

However, this does not work by returning the error:
`distancias = candidatos(::) - search numpy.core._exceptions.UFuncTypeError: ufunc 'subtract' did not contain a loop with signature matching types (dtype(' dtype('`

``` IMPORTANT TO MENTION THAT If I call my function passing the values ​​directly like this: aux = localize.localize(-100,-70,-68,-55,-53,-55) It works perfectly but going in that other direction, which I need, won't work at all. I came to think that it didn't work because there was no comma separating each integer value, so I did it as follows: localize.localize(valores(0)+',',valores(1)+',',valores(2)+',',valores(3)+',',valores(4)+',',valores(5)) What came to pass: localize.localize(-100,-67,-63,-49,-53,-48) which didn't work either. I would like help to understand how I can pass values ​​functionally and across variables as I have described it. Thanks in advance for any help If that helps, I leave the function I am trying to perform underneath. It is a POST of an API that comes with certain parameters (coordinates) and the algorithm will help me tell where the coordinates are closest. It is only after receiving the data and checking the location that the data is saved in the bank. I was printing everything to see how the data got there hehe @app.route('/api/v1/resources/positions/app', methods=('POST')) def positions_post_app(): conn = sqlite3.connect('locale.db') conn.row_factory = dict_factory cur = conn.cursor() users = request.get_json() for user in users: user_id = user('user_id') find = user('search') date = user('date') # print("valor que chega!") # print(find) # valores = find.split(",") # print("lista de inteiros") # print(valores) # print("Tabela atualizada:") # print(valores(0)+',',valores(1)+',',valores(2)+',',valores(3)+',',valores(4)+',',valores(5)) # aux = localize.localize(-100,-70,-68,-55,-53,-55) #FUNÇÃO FUNCIONANDO aux = localize.localize(valores(0),valores(1),valores(2),valores(3),valores(4),valores(5)) locale = aux('locale') result = aux('result') print("insert into positions values(NULL, '{}','{}', {}, {}, '{}')".format(user_id, find, result, locale, date)) #PRINT PARA VER COMO FICARIA O SQL # cur.execute("insert into positions values(NULL, '{}','{}', {}, {}, '{}')".format(user_id, search, result, locale, date)) # conn.commit() return {'Status' : 'Success'} ```
``` jQuery(document).ready(function() {jQuery.ajax({type: "POST",url : rating_form_script.ajaxurl,data : { action : "display_rating_form_ajax", args : {"id":1,"post_id":201004,"comment_id":0,"custom_id":"0","user_id":0,"term_id":0,"title":false,"score":true,"total":true,"stats":true,"user_stats":false,"tooltip":true,"result":true,"rich_snippet":true,"is_widget":false,"state":"","before_content":"","after_content":"","rates":"rating,ratings","txt_score":"%1\$s\/%2\$s"} }, success : function(data) { jQuery("body").find("[data-id=\"RFR1P201004\"]").html(data); }});}); { "@context": "http://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://newproxylists.com/python-error-passing-numpy-core-_exceptions-ufunctypeerror-parameters-ufunc-39-subtract-39-did-not-contain-matching-loop-signature-types-dtype-39-u21-39/" }, "headline": "python - Error passing numpy.core._exceptions.UFuncTypeError parameters: ufunc &amp; # 39; subtract &amp; # 39; did not contain matching loop signature types (dtype (&amp; # 39; &lt;U21 &amp; # 39;)", "url": "https://newproxylists.com/python-error-passing-numpy-core-_exceptions-ufunctypeerror-parameters-ufunc-39-subtract-39-did-not-contain-matching-loop-signature-types-dtype-39-u21-39/", "author": { "@type": "Person", "name":"Admin" }, "publisher": { "@type": "Organization", "name": "New and Fresh Private + Public Proxies Lists Everyday!", "logo": { "@type": "ImageObject", "url": " ", "width": "", "height": "" } }, "datePublished": "2020-03-20T07:10:45+02:00", "dateModified": "2020-03-20T07:10:45+02:00", "aggregateRating": { "@type": "AggregateRating", "bestRating": "5", "worstRating": "1", "ratingValue": "5", "ratingCount": "48" } } ```
``` Author AdminPosted on March 20, 2020Tags amp, dtype, error, loop, ltU21, matching, numpycoreexceptionsUFuncTypeError, parameters, passing, Python, signature, subtract, types, ufunc ```
``` SQL Server – Quick insertion from the temporary table to the main table – advice needed, matching index order? I'm rewriting a C # console app from a single insert to perform bulk insertions based on the tips here, I need to insert loose in a transfer table (with the seed identity id) Then I load in the temporary tables, do some processing, then insert into the main table It's for real time 24/7 so it has to be as fast and efficient as possible 1) What is the fastest way to insert data in bulk from the C # console application to the middle table (every 1 min, approximately 50,000 to 150,000 records) – I plan to 39; use SqlBulkCopy 2) Does having an identifier with an identity seed on the middle table slow things down? should i use a bunch? 3) My main question and the highest risk area is inserting into the main occupied table, so this should be as quick as possible to reduce locking: when inserting loose into the table main, do I need to pre-order the data so that it matches the main cluster index (sound on 3 columns: sensorId, DateTime, pkId) or will I just sort twice? this table is extremely busy. Any other advice in this area is appreciated. this whole block insertion process is just a stored procedure, and I thought I would call it every 1 min from the sql agent to make sure that It works (I'm not sure if this is the best solution) sql server 2017 ent. jQuery(document).ready(function() {jQuery.ajax({type: "POST",url : rating_form_script.ajaxurl,data : { action : "display_rating_form_ajax", args : {"id":1,"post_id":200676,"comment_id":0,"custom_id":"0","user_id":0,"term_id":0,"title":false,"score":true,"total":true,"stats":true,"user_stats":false,"tooltip":true,"result":true,"rich_snippet":true,"is_widget":false,"state":"","before_content":"","after_content":"","rates":"rating,ratings","txt_score":"%1\$s\/%2\$s"} }, success : function(data) { jQuery("body").find("[data-id=\"RFR1P200676\"]").html(data); }});}); { "@context": "http://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://newproxylists.com/sql-server-quick-insertion-from-the-temporary-table-to-the-main-table-advice-needed-matching-index-order/" }, "headline": "SQL Server - Quick insertion from the temporary table to the main table - advice needed, matching index order?", "url": "https://newproxylists.com/sql-server-quick-insertion-from-the-temporary-table-to-the-main-table-advice-needed-matching-index-order/", "author": { "@type": "Person", "name":"Admin" }, "publisher": { "@type": "Organization", "name": "New and Fresh Private + Public Proxies Lists Everyday!", "logo": { "@type": "ImageObject", "url": " ", "width": "", "height": "" } }, "datePublished": "2020-03-19T07:59:45+02:00", "dateModified": "2020-03-19T07:59:45+02:00", "aggregateRating": { "@type": "AggregateRating", "bestRating": "5", "worstRating": "1", "ratingValue": "5", "ratingCount": "12" } } Author AdminPosted on March 19, 2020Tags advice, index, insertion, main, matching, needed, order, quick, Server, SQL, table, temporary ms access – Line search without matching the second field for the constants given in the first field Consider an example of a table with two string fields FIRST_NAME and LAST_NAME. For a given Lastname == Smith, I find waiting a row with another data Lastname == Johnson and first name identical. How to find lines for which this is not the case, that is to say Lastname == Smith, Firstname == Julia exists but Lastname == Johnson, Firstname == Julia does not?. Examples of data: FIRST_NAME, LAST_NAME Jane, Smith John, Smith Blake, Smith Jane, Johnson Blake, Johnson Request so far: SELECT FIRST_NAME FROM (SELECT DISTINCT LAST_NAME, COUNT(*) AS c, FIRST_NAME FROM Table1 GROUP BY FIRST_NAME) WHERE c = 1 What I would like to get: John, Smith jQuery(document).ready(function() {jQuery.ajax({type: "POST",url : rating_form_script.ajaxurl,data : { action : "display_rating_form_ajax", args : {"id":1,"post_id":200437,"comment_id":0,"custom_id":"0","user_id":0,"term_id":0,"title":false,"score":true,"total":true,"stats":true,"user_stats":false,"tooltip":true,"result":true,"rich_snippet":true,"is_widget":false,"state":"","before_content":"","after_content":"","rates":"rating,ratings","txt_score":"%1\$s\/%2\$s"} }, success : function(data) { jQuery("body").find("[data-id=\"RFR1P200437\"]").html(data); }});}); { "@context": "http://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://newproxylists.com/ms-access-line-search-without-matching-the-second-field-for-the-constants-given-in-the-first-field/" }, "headline": "ms access - Line search without matching the second field for the constants given in the first field", "url": "https://newproxylists.com/ms-access-line-search-without-matching-the-second-field-for-the-constants-given-in-the-first-field/", "author": { "@type": "Person", "name":"Admin" }, "publisher": { "@type": "Organization", "name": "New and Fresh Private + Public Proxies Lists Everyday!", "logo": { "@type": "ImageObject", "url": " ", "width": "", "height": "" } }, "datePublished": "2020-03-18T16:22:48+02:00", "dateModified": "2020-03-18T16:22:48+02:00", "aggregateRating": { "@type": "AggregateRating", "bestRating": "5", "worstRating": "1", "ratingValue": "5", "ratingCount": "12" } } Author AdminPosted on March 18, 2020Tags access, constants, field, line, matching, Search Google sheets – How to find matching cells online based on search? I have 5 rows with 10 columns. Below this 5×10 grid, I fill a cell with a value listed in column 1 of the grid. "ABC" for example. If "ABC" is row 3, column 1, I want them to get the values ​​from row 3, columns 4, 5, 6. These three values ​​will go into the cells just above or below the cell "ABC" which is below the grid. The value where is "ABC" will change because I get information from different lines, but will always correspond to a value in column 1 of the 5×10 grid. do you have any ideas for doing that? jQuery(document).ready(function() {jQuery.ajax({type: "POST",url : rating_form_script.ajaxurl,data : { action : "display_rating_form_ajax", args : {"id":1,"post_id":198226,"comment_id":0,"custom_id":"0","user_id":0,"term_id":0,"title":false,"score":true,"total":true,"stats":true,"user_stats":false,"tooltip":true,"result":true,"rich_snippet":true,"is_widget":false,"state":"","before_content":"","after_content":"","rates":"rating,ratings","txt_score":"%1\$s\/%2\$s"} }, success : function(data) { jQuery("body").find("[data-id=\"RFR1P198226\"]").html(data); }});}); { "@context": "http://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://newproxylists.com/google-sheets-how-to-find-matching-cells-online-based-on-search/" }, "headline": "Google sheets - How to find matching cells online based on search?", "url": "https://newproxylists.com/google-sheets-how-to-find-matching-cells-online-based-on-search/", "author": { "@type": "Person", "name":"Admin" }, "publisher": { "@type": "Organization", "name": "New and Fresh Private + Public Proxies Lists Everyday!", "logo": { "@type": "ImageObject", "url": " ", "width": "", "height": "" } }, "datePublished": "2020-03-11T23:58:24+02:00", "dateModified": "2020-03-11T23:58:24+02:00", "aggregateRating": { "@type": "AggregateRating", "bestRating": "5", "worstRating": "1", "ratingValue": "4.5", "ratingCount": "5" } } Author AdminPosted on March 11, 2020Tags based, cells, find, google, matching, online, Search, sheets pattern matching – How to make a Flat function return x when it is evaluated as f[x]? With SetAttributes[f, Flat], f[a_] can be paired with f any number of arguments. How can i do that call it with exactly one argument f[x] Return x? I'm trying to have an operation like NonCommutativeMultiply but without the "possible problems" that it has. It is important to me that if the result of some simplification is a "product" of a term, it will no longer be treated as such. I especially want to avoid endless loops like f[a_] := a f[a__] /; AnyTrue[{a}, FreeQ[_Symbol]] := "free" f[a, a] \$ IterationLimit :: itlim: The iteration limit of 4096 has been exceeded. >> jQuery(document).ready(function() {jQuery.ajax({type: "POST",url : rating_form_script.ajaxurl,data : { action : "display_rating_form_ajax", args : {"id":1,"post_id":197724,"comment_id":0,"custom_id":"0","user_id":0,"term_id":0,"title":false,"score":true,"total":true,"stats":true,"user_stats":false,"tooltip":true,"result":true,"rich_snippet":true,"is_widget":false,"state":"","before_content":"","after_content":"","rates":"rating,ratings","txt_score":"%1\$s\/%2\$s"} }, success : function(data) { jQuery("body").find("[data-id=\"RFR1P197724\"]").html(data); }});}); { "@context": "http://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://newproxylists.com/pattern-matching-how-to-make-a-flat-function-return-x-when-it-is-evaluated-as-fx/" }, "headline": "pattern matching - How to make a Flat function return x when it is evaluated as f[x]?", "url": "https://newproxylists.com/pattern-matching-how-to-make-a-flat-function-return-x-when-it-is-evaluated-as-fx/", "author": { "@type": "Person", "name":"Admin" }, "publisher": { "@type": "Organization", "name": "New and Fresh Private + Public Proxies Lists Everyday!", "logo": { "@type": "ImageObject", "url": " ", "width": "", "height": "" } }, "datePublished": "2020-03-10T13:14:30+02:00", "dateModified": "2020-03-10T13:14:30+02:00", "aggregateRating": { "@type": "AggregateRating", "bestRating": "5", "worstRating": "1", "ratingValue": "5", "ratingCount": "18" } } Author AdminPosted on March 10, 2020Tags Evaluated, flat, function, matching, Pattern, return Posts navigation Page 1 Page 2 … Page 10 Next page ```