## Equations with Tensor product and Ket in Mathematica:

I tried to express this equation in Mathematica:

I defined necessary things:

``````P = {{Ket[0], Ket[2], Ket[1], Ket[3], Ket[5], Ket[4], Ket[6], Ket[8],
Ket[7]}, {Ket[2], Ket[1], Ket[0], Ket[5], Ket[4], Ket[3], Ket[8],
Ket[7], Ket[6]}, {Ket[1], Ket[0], Ket[2], Ket[4], Ket[3], Ket[5],
Ket[7], Ket[6], Ket[8]}, {Ket[6], Ket[8], Ket[7], Ket[0], Ket[2],
Ket[1], Ket[3], Ket[5], Ket[4]}, {Ket[8], Ket[7], Ket[6], Ket[2],
Ket[1], Ket[0], Ket[5], Ket[4], Ket[3]}, {Ket[7], Ket[6], Ket[8],
Ket[1], Ket[0], Ket[2], Ket[4], Ket[3], Ket[5]}, {Ket[a], Ket[c],
Ket[b], Ket[6], Ket[8], Ket[7], Ket[[Alpha]], Ket[[Gamma]],
Ket[[Beta]]}, {Ket[c], Ket[b], Ket[a], Ket[8], Ket[7], Ket[6],
Ket[[Gamma]], Ket[[Beta]], Ket[[Alpha]]}, {Ket[b], Ket[a],
Ket[c], Ket[7], Ket[6], Ket[8], Ket[[Beta]], Ket[[Alpha]],
Ket[[Gamma]]}}

{1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, [Omega], [Omega]2, 1, [Omega], [Omega]2,
1, [Omega], [Omega]2},
{1, [Omega]2, [Omega], 1, [Omega]2, [Omega],
1, [Omega]2, [Omega]},
{1, 1, 1, [Omega], [Omega], [Omega], [Omega]2, [Omega]2,
[Omega]2},
{1, 1, 1, [Omega], [Omega], [Omega], [Omega]2, [Omega]2,
[Omega]2},
{1, [Omega]2, [Omega], [Omega],
1, [Omega]2, [Omega]2, [Omega], 1},
{1, 1, 1, [Omega]2, [Omega]2, [Omega]2, [Omega], [Omega],
[Omega]},
{1, [Omega], [Omega]2, [Omega]2,
1, [Omega], [Omega], [Omega]2, 1},
{1, [Omega]2, [Omega], [Omega]2, [Omega], 1, [Omega],
1, [Omega]2}
}

``````

My attempt is:

``````A[u_, j_][n_, P_, Had_] :=
1/Sqrt[n] Sum[
TensorProduct[Ket[k], Part[P, k, j]]* Bra[k].Had. Ket[u], {k, 0,
n - 1}]

B[1, 2][9, P, H]
``````

I obtain:

Where is issues?

## differential equations – Error on DSolve

I’ve been trying to solve this initial value problem using ‘DSolve()’:

$$frac{dy}{dt}=1+tspace sin(tspace y),quad y(0)=0, quad t=(0,2)$$

``````ClearAll(y, t)
eq1 := {y'(t) == 1 + t *Sin(t y(t)), y(0) == 0};
DSolve(eq1, y(t), {t, 0, 2})
``````

All I get is the Inverse function error.

``````
Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>

``````

The documentation suggests it has to do with the sine function but I’m not sure how to by-pass it.

Any help would be appreciated.

## linear algebra – Estimating Zeta from Hv and Hu , system of equations, estimation problem

Does anyone here know how $$beta$$ could be estimated in terms of $$H_u, H_v$$ in the below equations,

$$H_u = left | zeta; left(frac{ e^{-jcdot 2cdotpi}-e^{-jcdot 2cdotpi(1/T)(T-Delta t)}}{j2pi}right)-zeta-beta right|^2$$

$$H_v = left | zeta; left(frac{ e^{jcdot 2cdotpi}-e^{jcdot 2cdotpi(1/T)(Delta t)}}{j2pi}right)+zetabeta right|^2$$

This is absolute sqauare of $$H_v$$ and $$H_u$$

I am working on an estimation problem where from $$H_u , H_v$$ they estimated $$beta$$ that is inside $$H_u$$ and $$H_v$$.

Anyone who could tell me about any mathematical procedure that how I can we do so?

A previous example where we did so… Almost same problem

https://math.stackexchange.com/questions/3984685/estimating-p-from-a1-and-a1-system-of-equations-an-estimation-problem/3984708#3984708

$$A_1 = left | alpha; left(frac{ 1- e^{-jcdot 2cdotpi rho}}{j2pi rho}right) right|^2$$

$$A_2 = left |alpha; left(frac{ 1- e^{-jcdot 2cdotpi rho}}{j2pi+j2pi rho}right) right|^2$$
$$rho=frac{A_2+sqrt(A_1A_2)}{A_1-A_2}$$

divided $$A_1$$ by $$A_2$$ equations

A1A2=(ρ+1)2ρ2

which is a quadratic in ρ.

I Solved it and select the root you I needed. I found $$rho$$ in terms of $$A_1, A_2$$

## open source – Very old doc-file with equations

There are certain doc files, made in 1999, possibly on already old software.
These doc files have had equations or other mathematical expressions in them.

If I open these files with notepad, I can see “Equation” on certain places, which leads me to believe that the information is still there, but when I open it with OpenOffice, in these same places, I only see: “µ §”.

Please help me with reconstructing the equations as they were. I tried to convert the doc into odt, but it could not do it without error message. I would be very grateful, if anyone can help me.

## differential equations – How to add a velocity boundary condition with specific time period

I have a wave equation for displacement and velocity, I want to add this boundary condition $$v(x=0,t>0)=1$$
My mathematica code is

``````sol = NDSolve({1/1000 D(u(x, t), {t, 2}) == D(u(x, t), {x, 2}),
D(u(x, t), t) == v(x, t), u(x, 0) == 0, v(x, 0) == 0,
v(0, t > 0) == 1, v(L, t) == 0}, {u(x, t), v(x, t)}, {x, 0, L}, {t,
0, 1})
``````

L is a constant.

## differential equations – Infinity: Indeterminate expression 0.0389874+Complexinfinity+Complexinfinity encountered

I’d like to solve 2nd order differential equation:

Which I’d like to draw a graph of x_M and h. m, g, and M is a real constant. Cd is well defined function that has a parameter as x_M’
theta is piecewise defined function,
that appears as below:

for this equation, I used code :

``````(Theta)0 = 0.5236;
(Omega)1 = 5.2359877;
(Omega)2 = 1.396;
t1 = (Theta)0 / (Omega)1;
t2 = (Theta)0 / (Omega)2;
T=2*(t1+t2);
f(t_)=Piecewise({{ -Mod(t,T)*(Omega)1 ,0<=Mod(t,T)<t1},{ -(Theta)0+((Mod(t,T)-t1)*(Omega)2), t1<=Mod(t,T)<(t1+2t2)},{(Theta)0-((Mod(t,T)-t1-2t2)*(Omega)1),(t1+2t2)<=Mod(t,T)<T}})
``````

It is clear that derivative of the function is

``````thetaprime(t_):=Piecewise({{-5.2359877 ,0<=Mod(t,T)<t1},{ 1.396, t1<=Mod(t,T)<(t1+2t2)},{-5.2359877,(t1+2t2)<=Mod(t,T)<=T}});
``````

for differential equation, I used a code

``````initconds = {x(0) == 0, x'(0) == 0.00001, h(0) == (M + m)/((Rho)*A), h'(0) == 0}
eqns = {m Cos((Theta)(t)) Sin((Theta)(t)) h''(t) + (M + m (Sin((Theta)(t))^2)) x''(t) == - Cd(Derivative(1)(x)(t)) *h(t)* Derivative(1)(x)(t) + m Sin((Theta)(t)) (g Cos((Theta)(t)) + r thetaprime(t)^2),( -M-(m*Cos((Theta)(t))^2))*h''(t) - m Cos((Theta)(t)) Sin((Theta)(t)) x''(t) == -g M + A g (Rho) h(t) - m Cos((Theta)(t)) (g Cos((Theta)(t)) + r thetaprime(t)^2)}
``````

But when I try to solve the Equation,

``````sol = NDSolve(Append(eqns, initconds), {x, h}, {t, 0, tf}, Method -> {"DiscontinuityProcessing" -> False})
``````

It gives following three errors. I can’t understand why these errors occur.

Infinity::indet: Indeterminate expression 0.0389874 +ComplexInfinity+ComplexInfinity encountered.

Infinity::indet: Indeterminate expression -0.160636+ComplexInfinity+ComplexInfinity+ComplexInfinity+ComplexInfinity+ComplexInfinity encountered.

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0..

## diophantine equations – Does the formulation of a proof involve substitution of numerical solutions into the problem?

Does the formulation of a proof involve substitution of numerical solutions into the problem ?

I asked this because I was trying to find a way I can prove Erdos right in Brocard’s problem using Diophantine equations (something I am not acquainted with except problems involving a system of linear Diophantine equations). My approach is like this : if we assume that the next solution $$(m,n)$$ is $$(71 + x, 7 + y)$$ do the following to get a new equation:
$$(7 + y)! + 1 = (71 + x)^2 longrightarrow(1)$$
$$7! + 1 = 71^2 longrightarrow(2)$$
$$(1) – (2) = (7 + y)! – 5040 = x^2 + 142xlongrightarrow(3)$$
And then prove that only a finite number of integer solutions exist for (3) and out of them, only 3 satisfy the constraints in Brocard’s problem. I doubt whether what I am doing is proof-writing or not. I got a few numerical solutions using Wolfram Alpha and those are what I am using.

## differential equations – NDSolve evolution in a specific point

m = 0; n = 0; B = 0.7; W = 4;

T1(m_,n_):= NIntegrate((-Log(t))^(m – 1)*LaguerreL(n, m, -Log(t))*LaguerreL(n, m, -Log(t)), {t, 0, 1});

T2(m_,n_):= NIntegrate((-Log(t))^(m – 1)*LaguerreL(n – 1, m, -Log(t))*LaguerreL(n – 1, m, -Log(t)), {t, 0, 1});

T3(m_,n_):= NIntegrate((-Log(t))^(m – 1)*LaguerreL(n, m, -Log(t))*LaguerreL(n – 1, m, -Log(t)), {t, 0, 1});

T4(m_,n_):= NIntegrate((-Log(t))^(m + 1)LaguerreL(n, m, -Log(t))^2Exp(-B/(f0(z))^2*(-Log(t))^mtLaguerreL(n, m, -Log(t))^2)(-2n*(-Log(t))^(m – 1)tLaguerreL(n, m, -Log(t))^2 +2*(m + n)(-Log(t))^(m – 1)tLaguerreL(n, m, -Log(t))LaguerreL(n – 1, m, -Log(t)) – (-Log(t))^mtLaguerreL(n, m, -Log(t))^2 -m*(-Log(t))^(m – 1)tLaguerreL(n, m, -Log(t))^2), {t, 0, 1});

s(m_,n_,B_,W_,z):=NDSolve({f0”(z) + 1/f0(z)(f0′(z))^2 == n!/((n + m)!(2n + m + 1))1/(f0(z))^3(((n + m)!)/n!(-2n – m + 1) + T1(m, n)(2n + m)^2 + 4T2(m, n)(m + n)^2 – 4T3(m, n)(m + n)(m + 2n) + BW^2*T4(m, n, B, z)), f0(0) == 1, f0′(0) == 0},f0(z), {z, 0, 1});

f0(z_)/.s

f0(0.1)

My code is given above. I have some integrations T1,T2,T3,T4 and one differentiations. I want to find the result of NDSolve at a specific value z=0.1, but I am getting some error.
Can you suggest me to how to write the code.

## differential equations – Neumann boundary condition ignored

Im trying to solve a system of two PDE (im(t,x) and ia(t,x)) that are dependent on time and distance. I’m using my own anisotropic mesh (thanks to @TimLaska) that is aimed to represent an interface between a membrane and a liquid. The interface is located at L/2 where L = thickness of the system. “im” takes positive values in the interval 0 <= x <= L/2 and is equal to 0 at x > L/2. “ia” behaves similarly.

The problem that I’m encountering is that when I specify a Neumann boundary value at L/2, Mathematica doesn’t find this value in the mesh and the Neumann value is effectively ignored.

These are the functions for creating anisotropic meshes (kindly provided by @TimLaska in one of my previous questions)

``````(*Import required FEM package*)
Needs("NDSolve`FEM`");
(*Define Some Helper Functions For Structured Meshes*)
pointsToMesh(data_) := MeshRegion(Transpose({data}), Line@Table({i, i + 1}, {i,Length(data)- 1}));
unitMeshGrowth(n_, r_) :=  Table((r^(j/(-1 + n)) - 1.)/(r - 1.), {j, 0, n - 1})
meshGrowth(x0_, xf_, n_, r_) := (xf - x0) unitMeshGrowth(n, r) + x0
firstElmHeight(x0_, xf_, n_, r_) := Abs@First@Differences@meshGrowth(x0, xf, n, r)
lastElmHeight(x0_, xf_, n_, r_) := Abs@Last@Differences@meshGrowth(x0, xf, n, r)
findGrowthRate(x0_, xf_, n_, fElm_) :=  Quiet@Abs@ FindRoot(firstElmHeight(x0, xf, n, r) -    fElm, {r, 1.0001, 100000},Method -> "Brent")((1, 2))
meshGrowthByElm(x0_, xf_, n_, fElm_) := N@Sort@Chop@meshGrowth(x0, xf, n, findGrowthRate(x0, xf, n, fElm))
meshGrowthByElm0(len_, n_, fElm_) := meshGrowthByElm(0, len, n, fElm)
flipSegment(l_) := (#1 - #2) & @@ {First(#), #} &@Reverse(l);
leftSegmentGrowth(len_, n_, fElm_) := meshGrowthByElm0(len, n, fElm)
rightSegmentGrowth(len_, n_, fElm_) := Module({seg}, seg = leftSegmentGrowth(len, n, fElm);
flipSegment(seg))
extendMesh(mesh_, newmesh_) := Union(mesh, Max@mesh + newmesh)
``````

Here I define a couple of constants and create my own mesh

``````(* Constants *)
L = 0.1; dim = dia = 1.*^-6; kf = kr = 1; kr =
1./kf;
(* Mesh generation *)
seg1 = rightSegmentGrowth(L/2., 100, L/1000);
seg2 = leftSegmentGrowth(L/2., 100, L/1000);
totalseg = extendMesh(seg1, seg2);
rh = pointsToMesh@totalseg ;
crd = MeshCoordinates(rh);
mesh = ToElementMesh(crd);
``````

And here is the simple code I use to find the solution alongside the error I get

``````(*PDE system*)

eqsim = {D(im(t, x), t) - dim D(im(t, x), x, x) == NeumannValue(kf*ia(t, x), x == L/2.) + NeumannValue(0, x == L/2.),im(0, x) == 0.1};
eqsia = {D(ia(t, x), t) - dia D(ia(t, x), x, x) ==  NeumannValue(kr*im(t, x), x == L/2.) + NeumannValue(0, x ==   L/2.), ia(0, x) == 0.1};
sol = NDSolve({eqsim, eqsia}, {im, ia},x (Element) mesh, {t, 0, 60}, Method ->{"MethodOfLines", "SpatialDiscretization" -> {"FiniteElement"}})
(*NDSolve::bcnop: No places were found on the boundary where x==0.05 was True, so NeumannValue(ia,x==0.05) will effectively be ignored.*)
(*NDSolve::bcnop: No places were found on the boundary where x==0.05 was True, so NeumannValue(1. im,x==0.05) will effectively be ignored.*)
(* NDSolve::bcnop: No places were found on the boundary where x==0.05 was True, so NeumannValue(0,x==0.05) will effectively be ignored.*)
(*General::stop: Further output of NDSolve::bcnop will be suppressed during this calculation.*)
``````

I first thought that the discretisation in the mesh didn’t include the point L/2 but after double checking I found out that it’s there

``````Position(crd, L/2.)
(*{{100, 1}}*)
``````

Similar problems to this have been reported when using Dirichlet conditions here DiscretizeRegion does not include the boundary specified in ImplicitRegion (10.1)
, here PeriodicBoundaryConditions: missing points (a simpler example)
and here Solving Laplace’s equation in 2D using region primitives
, but after reading the solutions provided I haven’t been able to find a solution to my issue.

Any help, feedback or advice is more than welcome (I’m using v 12.2.0.0).

## differential equations – Solve PDE with contraints and unknown boundary conditions

I have a 2D PDE

``````mu = -0.1;
lambda = -1;
x10 = 0;
x20 = 0;
eq = {mu*x1 + D(h1(x1, x2), x1)*mu*x1 +
D(h1(x1, x2), x2)*lambda*(x2 - x1^2) == mu*(x1 + h1(x1, x2)),
lambda*(x2 - x1^2) + D(h2(x1, x2), x1)*mu*x1 +
D(h2(x1, x2), x2)*lambda*(x2 - x1^2) ==
lambda*(x2 + h2(x1, x2))};

``````

The problem is that I don’t know the boundary condition of the PDE, but I do have a constraint that the gradient of h1 and h2 at point (x10, x20) is zero.

``````D(h1(x1, x2), x1)/.{x1 -> x10, x2 -> x20} == 0
D(h1(x1, x2), x2)/.{x1 -> x10, x2 -> x20} == 0
D(h2(x1, x2), x1)/.{x1 -> x10, x2 -> x20} == 0
D(h2(x1, x2), x2)/.{x1 -> x10, x2 -> x20} == 0
``````

How can I approximate h1(x1, x2) and h2(x1, x2) numerically in Mathematica?