## php – loop through meta_query relations

I am currently working on a project which uses WP_Query to XML conversion so that you can filter through the XML like you would in a normal query. The data only exists in the XML so there is no database tables and/or data as its form an external party.

The query is like this as you would normally in WP_Query and this works in the XML parser, this would generate an url like
https://example.com/cars/?brand=Renault,Mercedes

Query

``````                \$filters = array(
'relation' => 'OR',
array(
'key' => 'brand',
'value' => 'Renault',
'compare' => 'LIKE'
),
array(
'key' => 'brand',
'value' => 'Mercedes',
'compare' => 'LIKE'
)
);
``````

XML Function which reads through relation and reruns the function this if statement lives in.

``````        if ( array_key_exists( 'relation', \$query ) ) {
\$new_query = \$query;
\$relation  = \$query('relation');
unset( \$new_query('relation') );

return \$this->compare_meta_query( \$new_query, \$item, \$relation );
}
``````

However if the filtering gets more complex like:
https://example.com/cars/?brand=Renault,Mercedes&fuel=Electric

The query would look like this

``````                    'relation' => 'OR',
array(
'key' => 'brand',
'value' => 'Renault',
'compare' => 'LIKE'
),
array(
'key' => 'brand',
'value' => 'Mercedes',
'compare' => 'LIKE'
),
array(
'relation' => 'AND',
array(
'key' => 'fuel',
'value' => 'Electric',
'compare' => 'LIKE'
),
)
);
``````

But the function above no longer returns the desired results as it doesn’t look through a multi-dimensional array and doesn’t see the second relation.

How would i go on to solve this or expand this function to support it like WordPres does?
I know it needs to know if it’s multi-dimensional but I lost sight on how to proceed.

## group theory – Relations from quotient of free product

This question arose from an exercise which asks you show that the fiber coproduct exists in the category of groups. I was eventually able to (mostly) solve the problem by “gluing” the images of elements under the two homomorphisms(i.e letting $$phi(h)psi^{-1}(h)=1$$ where $$phi : H rightarrow G$$ and $$psi : H rightarrow G’$$ are homomorphisms.)

I looked further into this concept (amalgamation) on the Wikipedia page and it says that in order to obtain the relation $$phi(h)psi^{-1}(h)=1$$ on the free product $$G * G’$$ you must quotient out by the smallest normal subgroup (i.e. the intersection of all normal subgroups) containing the words $$phi(h)psi^{-1}(h)$$. So my questions are: why isn’t it sufficient to simply adjust the definition of the binary operation so that whenever we have a product ($$a_1a’_1…a’_nphi(h)$$)($$psi(h)b_1…b_kb’_k$$) it is equivalent to $$a_1a’_1…a_nb_1…b_kb’_k$$ and how do we know that the normal subgroup isn’t “too big”(that is, it establishes an unwanted relation)?

I am familiar with relations established by quotients of free groups, however I don’t quite see why this works.

## Is there a class of recurrence relations that can’t be solved using the substitution method?

Is there a class of recurrence relations that can’t be solved using the substitution method? Let me explain the motivation behind this question by an example.

Consider the recurrence relation $$T(n) = 2T(n/2) + n$$. It’s obvious that $$T$$ is in $$Theta(n log n)$$.

To verify that $$T(n)$$ is in $$O(nlog n)$$, one could use the substitution method and the inductive hypotheses $$T(n) ≤ cnlog n + d$$, where $$d$$ is to be replaced by term of lower order.

Inductive step:

$$T(n) = 2T(n/2) + n ≤ 2(cnlog n + d) = 2cnlog(n/2) + 2d + n = cnlog n + ell d + n,$$ where $$ell = 2$$.

As $$ell > 1$$ holds, one can choose $$(ell-1)d := -n$$. As a result, the last term $$n$$ vanishes in the next step:

$$cnlog n + ell d + n = cnlog n + d$$

Choosing $$c$$ properly for the the given $$d$$ should complete this proof. However, this approach sometimes fails if $$ell$$ equals 1.

This is illustrated by the following example, where the goal is to prove a lower bound:

$$T(n) = T(n – 2) + n^2$$

Hypothesis: $$T(n – 2) ≥ cn^3 + d$$ for all $$n’ ≤ n$$:

$$T(n + 1) = T(n – 1) + (n-1)^3 ≥ c(n-1)^3 + d + n^2$$

I would be very thankful for an explanation.

## linear algebra – Implementing solution of a system of recurrence relations

Let us consider a system of recurrence relations such as

$$a_{n-1} = ( lambda_1 + n lambda_2 ) a_n + lambda_3 b_n$$

$$b_{n-1} = ( lambda_4 + n lambda_2 ) b_n + lambda_5 a_n$$

subject to the initial conditions say, $$a_0 = k_1$$ and $$b_0 = k_2$$. So, what I have done so far is that I reexpressed the system as

$$v_n = A^T v_{n-1}$$

or equivalently,

$$v_n = (A^T)^n v_0$$,

where $$v_n = (a_n, b_n)^T$$, and $$A$$ is the coefficient matrix including $$n$$.

How do I implement such a system in Mathematica to get the sequences $$a_n$$ and $$b_n$$?

Also, is there a function, in Mathematica, similar to RSolve for solving such systems?

## Getting all data and only filtered relations

i have a table of products which is related to a pricing table, ideally i would want to get an array of all the products and those who have a pricing relation with the user be associated with the product.

`````` return this.repo
.createQueryBuilder("product")
.leftJoinAndSelect("product.pricings", "pricings")
.leftJoinAndSelect("pricings.driver", "driver")
.where("pricings.driver.id = :id", { id: 1 })
.getMany()
``````

This returns an array of products which have the aforementioned relation, i would want all the products.

## trusted computing – A good way to visualize mentally TPM PCRs, PCR banks and indexes and their relations

I’m reading about TPMs and I’m currently thinking how to visualize their relationships.

Basically reading from https://link.springer.com/chapter/10.1007/978-1-4302-6584-9_12 (and the TPM documents) I gather the following:

PCR: It is a memory register that stores output of a hash algorithm. A PCR can store the output of more than one hash algorithm. An example is the output of 256 bits for SHA-256.

Question: Can a PCR store simultatenously output from multiple types of hash algorithms? Or are PCRs are tied to some specific hash algorithm? I think only the latest hashed value of any given operation is saved (and concatenated with the previous). But I’m not sure if multiple hash algorithms can use the same PCRs simultanously (e.g. like operating shadow registers or a stack).

PCR bank: a PCR bank is a set, or a collection, of PCRs that are used to store the output of the same type of a hash algorithm. As for an example, output of SHA-256 or a SHA-1 algorithm would be disjoint PCR banks. However, I don’t know if the underlying PCRs used by these banks could be the same. So, effectively a PCR bank would be a way to group PCRs together logically but they could use the same underlying PCRs.

PCR Index: Points to some PCR.

PCR Attribute: This is some attribute a PCR has, such as being resettable. If attribute is applicable to some index location in one bank, it is applicable across all PCR banks on the same index.

Not all PCR banks are required to have the same number of PCRs, so they need to not to be equally large.

The main reason I’m considering visualization is that I’m not sure how should one understand PCR indexing and attributes. The usual images online are like

``````PCR(0)  = (what's in this this cell?)
PCR(1)  =
.
.
.
PCR(23) = (what's in this scell)
``````

But if the idea is like `PCR(Index)`, then what is the size and number of each of the cells? Is there only one cell width of which is the maximum width needed to store output of the hash algorithm that produces the longest output? Or does it mean there are multiple cells of some fixed with?

That is, if there’s both SHA-1 and SHA-256, then `PCR(23).length = 256 bits` or `PCR(23)(0).length = 256 bits`?

I also think the case of `attribute` confuse me here. I.e. is it so that for each of those indexes `PCR(n)` there are multiple cells of length denoted by the hashing algorithm? It makes me feel there should be a concept of `attribute index`, which would index this system like matrix:

``````          (Attr1)   (Attr2)
PCR(0)  = (pcr0-0), (pcr0-1), ... (???)
PCR(1)  = (pcr1-0), (pcr1-1), ... (???)
.
.
.
PCR(23) = (pcr23-0), (pcr23-1), ... (???)
``````

So I’m trying to understand how PCRs related to indexes and attributes. I may come across unclear as this feels a bit confusing.

## Issues normalizing 2NF relations to 3NF

I have an assignment to submit and Im having trouble normalizing my 2NF relations to 3NF. Can anyone tell me whether this is possible? and if so, what would it look like. Im really struggling but my guess is that it cant normalize. (See image below)

## discrete mathematics – how to generate Hasse diagram for the given relations

currently learning about hasse diagrams and equivalences.

given the following relations R1,R2,R3 how should I generate the Hasse diagram (could someone show me how it would look like?).

I understand that only one of these relations is able to generate the Hasse (my guess is R3 but correct me if I am wrong)

The set is made up of:

{a, b, c, d, e, f}

I would assume I need the hasse diagram to find the minimal elements,lowest bound and upper bound elements.

Any help would be appreciated 🙂

## reference request – Relations of Lambert W function with Hypergeometric function

Let $$X_1,dots,X_n$$ be non commutative variables such that $$operatorname{tr} f(X_1,dots,X_n) = 0$$ whenever the $$X_i$$ are specialized to square matrices in $$M_r(k)$$ for any $$r geq 1$$. Does this imply that $$f$$ is in the ideal generated by cyclic permutations: $$g_1dots g_k – g_2dots g_k g_1$$ for any polynomials $$g_i$$ in the $$X_i$$ and $$k geq 2$$?