0

Given a polynomial such as (a+b*i)*c+i, where a, b, c are defined as symbolic elements to represent three real values and i is the imaginary unit, how to return the real part and imaginary part of this polynomial?

apaderno
  • 28,547
  • 16
  • 75
  • 90
datcn
  • 751
  • 5
  • 13
  • 20

1 Answers1

0
a = sym('a','real');
b = sym('b','real');
c = sym('c','real');
expand(real((a+b*1i)*c+1i))
Anton
  • 1
  • Thanks for your rapidly reply. It works for the polynomial of (a+b*1i)*c+1i. But when I tried to use it on a more sophisticated polynomial, the return value still contains the imaginary unit i. – datcn Jun 27 '12 at 12:42
  • may be res = simplify(real((a+b*1i)*c+1i)); or res = simple(real((a+b*1i)*c+1i)); will help – Anton Jun 27 '12 at 12:58
  • Sorry. I made a mistake. It also works well for the sophisticated polynomial after a more clear clarification of each polynomial. – datcn Jun 27 '12 at 13:19