## Is there a way to teach Mathematica to treat an expression as a protected constant?

Mathematica doesn’t recognize that $$displaystyle Wleft( e^{e+1}right) =e$$ and it’d be really nice if it did.

Is there any way to ‘teach’ it to treat ProductLog (E^(E+1)) as e so that it will simplify outputs as such?

## Proving that a language defined by a regular expression is equivalent to a right linear grammar

After thinking for a bit, I am not able to prove a double inclusion proof for the following problem. It seems very interesting to me.

Consider the regular expression $$r= ((1(00)^∗1 + 0)1)^∗$$ and the right-linear grammar $$G= ({S,A},{0,1},S,P)$$, where $$P$$ consists of the following rules:

$$Srightarrow 1A|01S|lambda$$

$$Arightarrow 00A|11S$$

Prove that $$L(G)subseteq L(r)$$ and vice versa.

## fourier transform – how to describe delta convolution using integral expression

We express the radiation from a source by the expression bellow:
$$U(x,y)=frac{e^{jkz}e^{frac{k}{2z}(x^2+y^2)}}{jlambda z}iint_{-infty}^{+infty}u(x’,y’)e^{-jfrac{2pi}{lambda z}(x’x+y’y)}dx’dy’$$
the fourier transform is $$f_x=frac{x}{lambda z}$$ and $$f_y=frac{y}{lambda z}$$.
Our system bellow has two apartures which has distance between them.
each aparture has fourier transform of sinc $$F(rect(ax)rect(by))=frac{1}{|ab|}sinc(frac{f_x}{a})sinc(frac{f_y}{b})$$.
$$F(delta(f_x-frac{a}{2},f_y-frac{b}{2}))=e^{(ipi(ax+by))}$$.
I know that convolution with delta is a shift in space.
how to find using the integral expression shown above the fourier transform of the shape bellow?
Thanks.

## Question about sum containing expression of prime:

I cannot use mathematica properly so forgive me for the following post:

I want to calculate values of following sum for large $$x$$:

$$sum_{pleq x} frac{1}{sqrt{ep}-1}$$

Where e is Euler’s constant.

Also I like to get plot and asymptotic of this sum.

## How to create Webform Pattern regular expression for restrict email domain

I want to create a Pattern regular expression in a webform email element to reject form submission if user input in email element/field @gmail.com or @yahoo.com or @hotmail.com etc

Pattern like here

^(?=.*?b@gmail.comb).*\$

## linq – Make a method that uses Expression> for filtering and sorting more flexible

I have a method in a service that performs a Linq-to-SQL query:

Expression<Func<Incident, bool>> whereExpression,
Expression<Func<Incident, TOrderBy>> orderByExpression
)
{
return await (
from i in _context.Incidents
// inner join
.Include(i => i.IncidentType)
.Where(whereExpression)
.OrderBy(orderByExpression)
// left-outer join
join ft in _context.Driver on i.FaultTypeId equals ft.Id into ift
from faultTypes in ift.DefaultIfEmpty()
// left-outer join
join v in _context.Vehicles on i.VehicleSerialNo equals v.VehicleSerialNo into iv
from vehicles in iv.DefaultIfEmpty()
select new Incident
{
Id = i.Id,
IncidentTypeId = i.IncidentTypeId,
IncidentType = i.IncidentType,
// datetimes
Occurred = i.Occurred,
Reported = i.Reported,
Resolved = i.Resolved,
//
VehicleSerialNo = i.VehicleSerialNo,
Vehicle = vehicles,
//
DriverSerialNo = i.DriverSerialNo,
Driver = drivers
}
).ToListAsync();
}

Improvements:

• having to manually compose the Incident to be returned feels like an anti-pattern
• handle situations where the whereExpression is null; this will try an exception now
• handle situations where the orderByExpression is null; this will try an exception now
• change the sorting direction from ascending to descending by changing the orderByExpression (if this is possible)
• is there value to marking the method as <TOrderBy>?

## automata – Write a regular expression – Contains an equal number of 01 and 10 subtrings

Part of your confusion stems from the fact that there are two different formulations of Arden’s Lemma, which I’ll call LR and RL. To illustrate them, let’s take a simple FA with three states, \$P,Q,R\$, where \$P\$ is the start state and \$R\$ is the only final state. The transitions are
\$\$begin{array}{c|cc}
& 0 & 1\ hline
P & Q & varnothing\
Q & R & Q\
R & R & R
end{array}\$\$
It’s clear with a moment’s thought that the language accepted by this FA is denoted by the regular expression \$01^*0(0+1)^*\$, so let’s see what the two versions of Arden’s Lemma produce.

LR: In this version we generate the regular expression from left to right. If we have a state \$X\$ with a transition on \$a\$ to state \$Y\$ we will include the equation \$X=aY\$, along with any other terms that arise from transitions from \$X\$ to other states. Along with this, we add a “\$+epsilon\$” to the expression for \$X\$ if \$X\$ happens to be a final state. Having made the collection of equations, we may apply the simplification rule that says that whenever we have \$X=rX + s\$ for regular expressions \$r, s\$ we can replace the equation by its solution \$X=r^*s\$. Note that here the goal is to product a regular expression for the start state.

In the example above, we’ll have the equations
\$\$begin{align}
P&=0Q\
Q&=0R+1Q\
R&=(0+1)R+epsilon & text{since R is final}
end{align}\$\$
Substituting, we see that \$R=(0+1)^*epsilon = (0+1)*\$ and \$Q=1^*(0R)=1^*0(0+1)^*\$, and finally \$P=0Q=01^*0(0+1)^*\$, as we expected.

RL: In this version we construct the regular expression from right to left. The difference is that if we have a state \$X\$ with transition on \$a\$ to state \$Y\$ we include the equation \$Y=Xa\$, along with any similar terms. In this case, we add the “\$+epsilon\$” only to the start state’s equation and the substitution in this case says that if we have \$X=Xr+s\$ we have the solution \$X=sr^*\$.

Returning to our example, we’ll have
\$\$begin{align}
P&=epsilon & text{since \$P\$ is the start state and has no incoming transitions}\
Q&=P0+Q1\
R&=Q0+R(0+1)
end{align}\$\$
Now our goal is just opposite of what we had in the LR version: we want an expression for the final state, \$R\$. Working from the top down we have \$Q=Q1+P0=Q1+0\$ so \$Q=01^*\$ and \$R=Q0(0+1)^*=01^*0(0+1)^*\$: the same result generated in a different order.

Assuming you want to use the LR version, your equations should be
\$\$begin{align}
a_1&=0a_2\
a_2&=0a_3+1a_5+epsilon\
a_3&=0a_3+1a_4+epsilon\
a_4&=0a_3+1a_4\
a_5&=0a_6+1a_5\
a_6&=0a_6+1a_5+epsilon
end{align}\$\$
As for your problem with \$a_5, a_6\$, for example, we could do this:
\$\$begin{align}
a_5 &= 1^*(0a_6)=1^*0a_6 & text{Arden}\
a_6 &= 0^*(1a_5+epsilon) &text{Arden again, now substitute \$a_6\$}\
a_5 &= 1^*0(0^*(1a_5+epsilon))\
&= (1^*00^*1)a_5+1^*00^* &text{so we have}\
a_5 &= (1^*00^*1)^*1^*00^*
end{align}\$\$

## How to simplify a very large expression?

How to simplify a very large expression? – Mathematica Stack Exchange

## intervals – Computing possibles values (range) for an (polynomial) expression that takes values from two 2-simplex

Let $$(p,q) in Delta_2$$ and $$(k,m) in Delta_2$$, where
$$Delta_2$$ is the 2-simplex, that is,
$$0leq pleq 1$$, $$0leq qleq 1$$, and $$0leq 1-p-qleq 1$$.

Consider the expression

2 (p - q) + 3 k^2 (-1 + 2 p + q) +
k (1 + 6 (-1 + m) p + (3 - 6 m) q) -
m (1 + 3 p - 6 q + 3 m (-1 + p + 2 q))

I want to find the values that the expression above can take, given the
conditions on p, q, m, and k.

I tried an approach using Interval

expression(p_, q_, m_, k_) :=
2 (p - q) + 3 k^2 (-1 + 2 p + q) +
k (1 + 6 (-1 + m) p + (3 - 6 m) q) -
m (1 + 3 p - 6 q + 3 m (-1 + p + 2 q))

and observing the values that it takes

substitute(\$p_, \$k_) :=
N((2 (p - q) + 3 k^2 (-1 + 2 p + q) +
k (1 + 6 (-1 + m) p + (3 - 6 m) q) -
m (1 + 3 p - 6 q + 3 m (-1 + p + 2 q)) /. {p -> \$p,
k -> \$k}) /. {q -> Interval({0, 1 - \$p}),
m -> Interval({0, 1 - \$k})})

then

Manipulate(substitute(p, q), {p, 0, 1, 1/10}, {q, 0, 1, 1/10})

However, using this values in the original expression, return lower values:

Table(expression(0, i, j, 0), {i, 0, 1, .1}, {j, 0, 1, .1}) //
Flatten // MinMax

## trigonometry – Use trigonometric output expression for calculation in a next step

Can’t use output sin[p] since Sin[p] is expected.

As a result of D[x, u] D[x, u] + D[y, u] D[y, u] + D[z, u] D[z, u] I’ve got a Mathematica output like u²+v²cos[p]² + v²sin[p]². As you see, cos and sin are given in lowercase letters, and Mathematica can’t use the expression for further simplifications since Cos and Sin are expected. What can I do to get the expected solution u²+v²?