Message Boards Message Boards

0
|
1219 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to keep the specified term unchanged and move other terms to the right of the equation?

Posted 9 months ago

The polynomial is:

x2 y0 (-b^2 - a^2 \[Lambda]) + 
  x0 y2 (-b^2 - a^2 \[Lambda]) + (x2 y1 - x1 y2) (b^2 - 
     a^2 \[Lambda]) + x1 y0 (b^2 + a^2 \[Lambda]) + 
  x0 y1 (b^2 + a^2 \[Lambda]) == 0

Keep the specified items (x2 y1- x1 y2) (b ^ 2- a ^ 2 [Lambda]) unchanged and move the other items to the right of the equation. The desired result is as follows:

(x2 y1 - x1 y2) (b^2 - 
    a^2 \[Lambda]) == -x2 y0 (-b^2 - a^2 \[Lambda]) - 
  x0 y2 (-b^2 - a^2 \[Lambda]) - x1 y0 (b^2 + a^2 \[Lambda]) - 
  x0 y1 (b^2 + a^2 \[Lambda])

But I tried using the following code operation but didn't get the desired answer. How can I correct the code?

x2 y0 (-b^2 - a^2 \[Lambda]) + 
  x0 y2 (-b^2 - a^2 \[Lambda]) + (x2 y1 - x1 y2) (b^2 - 
     a^2 \[Lambda]) + x1 y0 (b^2 + a^2 \[Lambda]) + 
  x0 y1 (b^2 + a^2 \[Lambda]) == 0
% /. k_.*((x2y1_) - (x1y2_)) + t_ == 0 :> k (x2y1 - x1y2) == -t

get the error answer:

x2 y0 (-b^2 - a^2 \[Lambda]) + 
  x0 y2 (-b^2 - a^2 \[Lambda]) + (x2 y1 - x1 y2) (b^2 - 
     a^2 \[Lambda]) + x1 y0 (b^2 + a^2 \[Lambda]) + 
  x0 y1 (b^2 + a^2 \[Lambda]) == 0
POSTED BY: Lee Tao
2 Replies
Posted 9 months ago

Does this do exactly what you want for this specific example?

poly=x2 y0(-b^2-a^2 λ)+x0 y2(-b^2-a^2 λ)+(x2 y1-x1 y2)(b^2-a^2 λ)+x1 y0(b^2+a^2 λ)+x0 y1(b^2+a^2 λ);
term=(x2 y1-x1 y2)(b^2-a^2 λ);
term==term-poly

which returns

(x2 y1-x1 y2)(b^2-a^2 λ)== -(x2 y0(-b^2-a^2 λ))-x0 y2(-b^2-a^2 λ)-x1 y0(b^2+a^2 λ)-x0 y1(b^2+a^2 λ)

Trying to do this is perhaps risky and trying to fight Mathematica at times. It may want to format things the way it wants and you want to format things the way you want. If you touch that result in some way it is possible that it will be reformatted in a way that you don't want.

POSTED BY: Bill Nelson
Posted 9 months ago

. k.*((x2y1) - (x1y2)) + t == 0 :> k (x2y1 - x1y2) == -t

How to use pattern matching methods?

POSTED BY: Lee Tao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract