1
$\begingroup$

I want to evaluate the expression below, $((2 (a_{01}+2 ya_{02}+x a_{11})^2+(b_{01}+2 y b_{02}+x b_{11})^2) (2 (a_{10}+y a_{11}+2 x a_{20})^2+(b_{10}+y b_{11}+2 x b_{20})^2))$,

at $x=-((2 (2 a_{02}a_{11} + b_{02}b_{11}))/(2 a_{11}^2 + b_{11}^2))y+\sigma$, assuming the following conditions,

$-(a_{11}b_{02}-a_{02}b_{11})^2 = 0$ and $- (-a_{20}b_{11}+a_{11}b_{20})^2 = 0$ .

To that end, I have been trying to employ Evaluation's command. However, Mathematica does not return a result, but rather an error message, as you may see in my attempts below.

Evaluate[((2 (a[0, 1] + 2 y a[0, 2] + x a[1, 1])^2 + (b[0, 1] + 
   2 y b[0, 2] + 
   x b[1, 1])^2) (2 (a[1, 0] + y a[1, 1] + 2 x a[2, 0])^2 + (b[1, 
    0] + y b[1, 1] + 2 x b[2, 0])^2)), x = (-((2 (2 a[0, 2] a[1, 1] + b[0, 2] b[1, 1]))/(
  2 a[1, 1]^2 + b[1, 1]^2)))*y + \[Sigma], Assuming -> -(a[1, 1] b[0, 2] - a[0, 2] b[1, 1])^2 = 0, -2 (-a[2, 0] b[1, 1] + a[1, 1] b[2, 0])^2 = 0]
(*Set: Tag Rule in Assuming->a[1,1] b[0,2]-a[0,2] b[1,1] is Protected.*)
(*Set:Tag Plus in -a[2,0]\ b[1,1]+a[1,1]\ b[2,0] is Protected*)

Bearing this in mind, How may I evaluate that equation under the conditions specified above?

$\endgroup$
4
  • 1
    $\begingroup$ Equations use Equal (i.e., ==) rather than Set (i.e., =). Assumptions is an option, Assuming is a function. Where did the expression that includes \[Sigma] come from? It wasn't in the problem statement. Evaluate doesn't mean what you apparently think it does. Re-read its documentation. $\endgroup$
    – Bob Hanlon
    Commented May 5, 2023 at 19:11
  • 1
    $\begingroup$ it is not very clear, what you want to achieve in the end. Maybe you explain what kind of simplification do you expect here? $\endgroup$ Commented May 5, 2023 at 19:54
  • $\begingroup$ @BobHanlon. Hi, Bob. I hope you are doing well. Thanks for the observation. I have edited my question based on your comment. I want to evaluate that equation at $x=(-((2 (2 a_{02} a_{11}+b_{02}b_{11}))/(2 a_{11}^2+b_{11}^2)))*y+\sigma$. $\endgroup$
    – VH84
    Commented May 5, 2023 at 19:56
  • $\begingroup$ @AlexeiBoulbitch. Hi Alexei. As I have just mentioned above, I have just edited my question. My goal is to evaluate that equation at $x=(-((2 (2 a_{02} a_{11}+b_{02}b_{11}))/(2 a_{11}^2+b_{11}^2)))*y+\sigma$ under the conditions outlined above. Thanks for your observation. $\endgroup$
    – VH84
    Commented May 5, 2023 at 19:59

1 Answer 1

3
$\begingroup$
$Version

(* "13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)" *)

Clear["Global`*"]

Display the indexed variables as subscripts using Format

(Format[#[n__]] := Subscript[#, Row[{n}]]) & /@ {a, b};

expr = ((2 (a[0, 1] + 2 y a[0, 2] + x a[1, 1])^2 + (b[0, 1] + 2 y b[0, 2] + 
         x b[1, 1])^2) (2 (a[1, 0] + y a[1, 1] + 2 x a[2, 0])^2 + (b[1, 0] + 
         y b[1, 1] + 2 x b[2, 0])^2));

xVal = x -> (-((2 (2 a[0, 2] a[1, 1] + b[0, 2] b[1, 1]))/(2 a[1, 1]^2 + 
           b[1, 1]^2)))*y + σ;

assume = {-(a[1, 1] b[0, 2] - a[0, 2] b[1, 1])^2 == 
    0, -(-a[2, 0] b[1, 1] + a[1, 1] b[2, 0])^2 == 0};

Using the Assumptions with Simplify

expr2 = Simplify[expr /. xVal, Assumptions -> assume]

enter image description here

LeafCount /@ {expr /. xVal, expr2}

(* {215, 207} *)

This had limited effect.

Using an alternate approach, the two assumptions can be used to eliminate two variables

vars = Cases[assume, _a | _b, All]

enter image description here

The possible replacements are

(solns = First /@ ((Solve[assume, #] & /@ Subsets[vars, {2}]) /. {} -> 
       Nothing)) // Short[#, 3] &

enter image description here

Using brute force to find the replacement that provides the best simplification

{repl, expr3} = MinimalBy[Select[{#, Simplify[expr2 /. #]} & /@ solns,
     FreeQ[#, Indeterminate] &] // Quiet, LeafCount[#[[2]]] &][[1]]

enter image description here

expr2 and expr3 are equivalent with the replacements derived from the assumptions

expr2 == expr3 /. repl // Simplify

(* True *)

The simplification is significant

LeafCount /@ {expr2, expr3}

(* {207, 107} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.