Solve Matrix equations with Cross Product: weird system of equations

I would like to find the values {Pfx, Pfy, Pfz} that satisfy the equation A X B = C . The code of everything is at the end, I want to ilustrate with images what i think of first:

A is this:

B is this: {0,0,0}

And C is this: {100,500,200}

The image of the complete code is this one:

My variable here are {Pfx,Pfy,Pfz} and the {i,j,k} are the unit vectors. The way that the matrix is shown in the picture corresponds with a trick used to solve in papper this type of matrix.

The solution would give me the value of Pfx in the "x" coordinate (and this would be expressed by Pfx being multiplied with the i vector). And the same mechanism applies with Pfy related with j Vector ; and Pfz related with k.

The problem here comes with the fact that the I cant find the values {Pfx, Pfy, Pfz} that satisfy the equation A X B = C. I am not sure if the problem lies in the "LinearSolve" comand, in the use of the CrossProduct or in the use of the versor {i, j, k} inside the matrix.

Any kind of help in this regard will be extreamly useful, thanks in advance!!

Code:

i := {1, 0, 0}  j := {0, 1, 0}  k := {0, 0, 1}  LinearSolve[({ {i, j, k},{1, 2, 3},{Pfx, Pfy, Pfz}})\[Cross]({{0},{0},{0}}) == ( {{100},{500},{200}} )]    

Hey can anyone help me to solve this question?

From the Adjacency matrix of a simple digraph how will you determine whether it’s directed tree ? If it is directed tree , how will you determine its root and terminal nodes?

Changes When Using Solve with Plot3D and Evaluate

I’m solving the following equation, which should be straightforward:

func1[A1_, A2_] := -((    4 I + 4 I A2^2 - 12 I A1 (1 + A2 ((2 - I) + A2 - 2 I eig)) +      A2 ((1 + 2 I) + 2 eig) ((5 + 4 I) + 4 eig ((1 + 2 I) + eig)))/(    8 A2)); sol1[A1_, A2_] := Solve[func1[A1, A2] == 0, eig]; 

I want to extract the analytic solution to this, but I’m not sure that what Mathematica is producing is correct. Here are the plots to explain what I mean:

This is a smooth plot and something that I expect. I’m plotting this with the line:

Plot3D[Re[eig /. sol1[A1, A2][[1]]], {A1, 0, 1}, {A2, 0, 1}] 

Now if I try to get the analytic expression for this solution and I plot it, I get something different. I can demonstrate this just by changing my Plot3D command:

Plot3D[Evaluate[Re[eig /. sol1[A1, A2][[1]]]], {A1, 0, 1}, {A2, 0, 1}] 

produces:

As you can see, the plot is different; it’s jagged with a discontinuity. With this, I can’t be sure that the analytic solution I extract from Mathematica is right. I’d like to either replicate the first plot with an explicit expression that I can acquire somehow or find out what function exactly Mathematica is plotting in the first instance. Am I missing something in regard to rule solutions here?

Thanks

Solve an algebraic equation with an integral

I am trying to compute for the variable zm in terms of t which is written as an algebraic equation with an integral in it. The final answer should be zm = zm[t].

t - Integrate[(c[zm] z^(d - 1))/(f[z] Sqrt[f[z] + c[zm]^2 z^(2 d - 2)]), {z, 0, zm}] == 0

Just a note, c[zm] contains a negative sign inside the square root so that zm must be greater than zh in order for c[zm] to be real.

d = 3; zh = 2; c[zm_] := Sqrt[-(1 - zm^(d + 1)/zh^(d + 1))]/zm^(d - 1); f[z_] := (1 - z^(d + 1)/zh^(d + 1));  In[8]:= Integrate[(c[zm] z^(d - 1))/(f[z] Sqrt[f[z] + c[zm]^2 z^(2 d - 2)]), {z, 0, zm},   Assumptions -> zm > 2]  Out[8]= (1/64)*Pi*((-32 - 32*I) - (Sqrt[2*Pi]*zm*Sqrt[-16 + zm^4]*(-1 + Hypergeometric2F1[-(1/4), 1, 1/4, 16/zm^4]))/Gamma[5/4]^2)  Solve[t - Integrate[(c[zm] z^(d - 1))/(f[z] Sqrt[f[z] + c[zm]^2 z^(2 d - 2)]), {z, 0, zm}] == 0 , zm] 

I am not sure if using Solve can really find the expression, also the result of the integral contains an imaginary term, but it should not right since c[zm] is real from the Assumptions -> zm>2?

Solve an equation in mathematica without replacing the value of the parameter

Suppose I want to solve a simple equation in mathematica x-a=0.So I am writing the mathematica code for this as below:

Solve[x - a == 0, x] 

So the output will be as below:

{{x -> a}} 

Now suppose I have assigned a value for ‘a’ beforehand and then want to solve the same equation.So my code will look like below:

a = 1; Solve[x - a == 0, x] 

And the output in this case will be like below:

{{x -> 1}} 

Now if I want an output in this case as {{x -> a}},what modification should I do in my code ?

Note: Clear[a] will work,but I don’t want to remove permanently the assigned value to a

Can Mathematica solve matrix-based parametric (convex or semidefinite) constrained optimization problems?

I have gone through Mathematica’s documentation and guides on ConvexOptimization, ParametricConvexOptimization and SemidefiniteOptimization. I am also running the latest version of Mathematica.

The kind of matrix-based, parametric, constrained optimization problems I want to solve is this:

$$$$\min_{X_j, \, L_{jk}} \text{Tr}(A L) \ \text{such that, } X_j \text{ and } L_{jk} \text{ are } 4\times4 \text{ Hermitian matrices} \ G_k \cdot X_j = \delta_{j k}\ L:=\begin{bmatrix}L_{11} &L_{12} &L_{13} \ L_{12} &L_{22} &L_{23} \ L_{13} &L_{23} &L_{33}\end{bmatrix} \succeq \begin{bmatrix} X_1 \ X_2 \ X_3 \end{bmatrix}\begin{bmatrix}X_1 &X_2 &X_3\end{bmatrix}$$$$ where the variables to be optimized over are $$X_j$$ and $$L_{jk}$$ ($$j$$ and $$k$$ run from 1 to 3), which are themselves matrices! The matrices $$G_k$$ and $$A$$ depend on some parameter $$\alpha$$ (and satisfy additional properties).

I have been able to run this kind of optimization in MATLAB, and also a much simpler version of this in Mathematica, where $$j, k=1$$ and the parameter value is fixed, using,

ConvexOptimization[   Tr[\[Rho]0 .      v11], {VectorGreaterEqual[{v11, x1}, "SemidefiniteCone"] &&       Tr[\[Rho]0 . x1] == 0  && Tr[\[Rho]1 . x1] == 1   &&      Element[x1, Matrices[{4, 4}, Complexes, Hermitian]] &&      Element[v11, Matrices[{4, 4}, Complexes, Hermitian]]} , {x1,     v11}]] 

However I simply can not get the full problem to run on Mathematica, using either ConvexOptimization[ ] (at fixed parameter values), ParametricConvexOptimization[ ], SemidefiniteOptimization[ ], or Minimize[ ].

ConvexOptimization[ ] at fixed parameter values for $$j, k = 1, 2$$ shows the warning ConvexOptimization::ctuc: The curvature (convexity or concavity) of the term X1.X2 in the constraint {{L11,L12},{L12,L22}}Underscript[\[VectorGreaterEqual], Subsuperscript[\[ScriptCapitalS], +, \[FilledSquare]]]{{X1.X1,X1.X2},{X1.X2,X2.X2}} could not be determined.

Minimize[ ] shows the error Minimize::vecin: Unable to resolve vector inequalities ...

And ParametricConvexOptimization[ ] and SemidefiniteOptimization[ ] simply return the input as output.

Has anyone got some experience with running such matrix-based optimizations in Mathematica? Thanks for your help.

EDIT 1: For the two-dimensional case ($$j, k=1, 2$$) I tried (with $$A$$ the identity matrix, and at fixed parameter value):

ConvexOptimization[  Tr[Tr[ArrayFlatten[{{L11, L12}, {L12,        L22}}]]], {VectorGreaterEqual[{ArrayFlatten[{{L11, L12}, {L12,          L22}}], ArrayFlatten[{{X1 . X1, X1 . X2}, {X1 . X2,          X2 . X2}}]}, "SemidefiniteCone"] &&  Tr[\[Rho]0 . X1] == 0  &&     Tr[\[Rho]0 . X2] == 0 && Tr[\[Rho]1 . X1] == 1  &&     Tr[\[Rho]1 . X2] == 0  && Tr[\[Rho]2 . X1] == 0  &&     Tr[\[Rho]2 . X2] == 1  &&     Element[X1, Matrices[{4, 4}, Complexes, Hermitian]] &&     Element[X2, Matrices[{4, 4}, Complexes, Hermitian]] &&     Element[L11, Matrices[{4, 4}, Complexes, Hermitian]] &&     Element[L12, Matrices[{4, 4}, Complexes, Hermitian]]  &&     Element[L22, Matrices[{4, 4}, Complexes, Hermitian]] }, {X1, X2,    L11, L12, L22}] 

and for the three-dimensional case ($$j, k = 1, 2, 3$$) with variable parameter value and $$A$$ the identity matrix, I tried

ParametricConvexOptimization[  Tr[Tr[ArrayFlatten[{{L11, L12, L13}, {L12, L22, L23}, {L13, L23,        L33}}]]], {VectorGreaterEqual[{ArrayFlatten[{{L11, L12,         L13}, {L12, L22, L23}, {L13, L23, L33}}],      ArrayFlatten[{{X1}, {X2}, {X3}}] .       Transpose[ArrayFlatten[{{X1}, {X2}, {X3}}]]},     "SemidefiniteCone"],  Tr[\[Rho]0 . X1] == 0 ,    Tr[\[Rho]0 . X2] == 0  , Tr[\[Rho]0 . X3] == 0 ,    Tr[\[Rho]1 . X1] == 1 , Tr[\[Rho]1 . X2] == 0  ,    Tr[\[Rho]1 . X3] == 0  , Tr[\[Rho]2 . X1] == 0 ,    Tr[\[Rho]2 . X2] == 1  , Tr[\[Rho]2 . X3] == 0 ,    Tr[\[Rho]3 . X1] == 0 , Tr[\[Rho]3 . X2] == 0  ,    Tr[\[Rho]3 . X3] == 1 }, {Element[X1,     Matrices[{4, 4}, Complexes, Hermitian]],    Element[X2, Matrices[{4, 4}, Complexes, Hermitian]],    Element[X3, Matrices[{4, 4}, Complexes, Hermitian]],    Element[L11, Matrices[{4, 4}, Complexes, Hermitian]],    Element[L12, Matrices[{4, 4}, Complexes, Hermitian]],    Element[L13, Matrices[{4, 4}, Complexes, Hermitian]],    Element[L22, Matrices[{4, 4}, Complexes, Hermitian]],    Element[L23, Matrices[{4, 4}, Complexes, Hermitian]],    Element[L33, Matrices[{4, 4}, Complexes, Hermitian]]}, {\[Alpha]}] 

Here, the $$\rho_{k}$$ matrices are the $$G_k$$ matrices.

NSolve connot solve my equation

I’m trying to solve $$\left(\frac{hc}{k_B} – 5x\right)e^{hc/k_Bx} + 5x = 0,$$ where $$h = 6.626 \times 10^{-34}$$, $$k = 1.381 \times 10^{-23}$$ and $$c = 3 \times 10^8$$. My code is

h = 6.626*^-34; k = 1.381*^-23; c = 3*^8; NSolve[((h c)/k - 5 x) Exp[(h c)/k x] + 5 x == 0, x] 

but Mathematica doesn’t solve the equation, am I doing something wrong?

How to solve the features problem

I am building an Influencer marketing platform in WordPress. It connects advertisers with influencers to promote their products (advertisers products) on their Instagram (social media) (Influencers), in return, Influencers get paid.

Influencers sign up, connect their social media so their following is seen on their profile, set up their profile, and find campaigns from advertisers and submit to the advertiser’s campaigns.

Advertisers sign up, submit their campaign: for example, they put in that they will give around $15 if an influencer promotes their products/services through their social media (they also have the option to select which social media they want the influencers to promote on, and how many followers the influencer must minimum have to submit to this campaign.). The advertisers have to add photos or videos of their products/services for the campaign. After the advertiser’s campaign is approved by us: The Influencers now have the option to submit offers: offer to receive money from the advertisers from their campaign to promote on their social media Influencers can choose to offer to receive money from the campaign starting from 3$ to X$. There will be a 19% fee from us, both and separate for the advertiser and the influencer. The advertiser sees from his account which influencers submitted to their campaign and can choose to accept or decline the offers. If the advertiser accepts the influencer’s offer to promote on their social media, the advertiser has to send the requirements to the influencer (via our platform). After that, the influencer has to accept the requirements and post on their social media. After that is done, the influencer gets paid (let there be a balance for the influencer on my website). The money is added to their balance and they can withdraw the money to their (for example) Paypal account whenever they want, with a minimum withdrawal of the amount of 5$ .

This requires 2 different accounts: 1 for the influencer and 1 for the advertiser, both having different features.

I want these features on my WordPress website, but I don’t know for example how to set up these accounts. And also for example to show the availability of creating a campaign for advertisers. And for example adding social media to the Influencer’s account page that shows how many followers the influencer has.

Any help would be appreciated. 🙂

WolframClient Converting Output Of Solve To Sympy

I’m trying to convert the output of WolframClient to Python. Here’s a toy example:

from wolframclient.evaluation import WolframLanguageSession from wolframclient.language import wl, wlexpr  def get_session():     session = WolframLanguageSession()     session.evaluate(wlexpr('Range[5]')) #warmup     return session  session = get_session() print(session.evaluate("Solve[a[0]==5/3,a[0]]]")) 

Giving

((Rule[Globala[0], Rational[5, 3]],),) 

I’m hoping to instead get something simpler (a string is sufficient):

"a[0] = 5/3" 

Motivation:

Ideally I’d like to port the output of mathematica to Sympy. I’ve tried Sympy’s Mathematica parser, but it doesn’t recognize any of the "non-whitelisted" expressions such as Rational[5,3]. I’ve tried using Mathematica’s InputForm function but that doesn’t seem to work.

Assign function to a variable and solve it symbolically

I have a function such as y = sin(x) + c. I’d like to solve it symbolically for c (but first assign the function to a variable, so I don’t have to enter it multiple times in case I want to solve it for x as well. Any suggestions how I can do this?

I’ve tried this:

fn[x_, c_] := Sin[x] + c Solve[fn, c] 

but getting an error ‘fn is not a quantified system of equations’.

Any help is appreciated.