Calculate Real Part of Expression in Mathematica

  • Mathematica
  • Thread starter bulash
  • Start date
  • Tags
    Mathematica
In summary, the conversation is about trying to get the Real part of a function in Mathematica, but a mistake in writing the imaginary symbol "i" caused the code to not work. The solution is to replace "i" with "I" or use the Mathematica symbol for an imaginary number and use ComplexExpand to get a symbolic representation.
  • #1
bulash
4
0
Dear all,

I try to get the Real part of the following function in Mathematica:

Code:
(-0.0006451572617131402 + 0.01297637024965604i)*
Log[(1.3104275557173537 - 1.368518505178231i]) + x]


by using Re[z]. However, it gives no solution other than just repetition of what I entered:


Code:
Re[(-0.0006451572617131402 + 0.01297637024965604i)*
Log[(1.3104275557173537 - 1.368518505178231i]) + x]]


Any suggestions? Thanks in advance.

bulash.
 
Physics news on Phys.org
  • #2
You have a rogue square bracket in your logarithm.
 
  • #3
OK. Right, thank you.

It was my "copy-paste fault". Must be like that:

Code:
(-0.0006451572617131402 + 0.01297637024965604i)*
Log[(1.3104275557173537 - 1.368518505178231i) + x]

The problem is, I think, the lack of definition of x as real. But how? tried almost every way, no way? :(

B.
 
  • #4
You have written the imaginary symbol "i" wrongly in your code. Replace it with a capital "I" or alternatively use the mathematica symbol for an imaginary number, which you can get by typing Esc, ii, Esc (Esc is the button Esc on the keyboard).

Try either method and you should get the code to work.
 
  • #5
Also, you can use ComplexExpand to get a symbolic representation assuming that x is real.
 

What is the purpose of calculating the real part of an expression in Mathematica?

The real part of an expression in Mathematica is calculated to find the portion of the expression that is a real number. This can be useful in many mathematical and scientific applications, such as solving equations, graphing functions, and analyzing data.

How do I calculate the real part of an expression in Mathematica?

To calculate the real part of an expression in Mathematica, you can use the Re[] function. This function takes in an expression as its argument and returns the real part of that expression. For example, Re[5+3i] would return 5, the real part of the complex number 5+3i.

Can the real part of an expression be a complex number?

No, by definition, the real part of an expression is a real number. This means that it does not have an imaginary component and can be represented on the real number line. If you are getting a complex number as the result of your calculation, you may need to check your input and make sure it is in the correct format.

What if my expression contains variables? Can I still calculate the real part?

Yes, you can still calculate the real part of an expression that contains variables. Mathematica will treat the variables as constants and return the real part of the expression with the variables plugged in. If you want to calculate the real part of a function with variables, you can use the Re[] function on the entire function, or use the Re[] function on each term separately and then combine them using the Plus[] function.

Are there any other functions that can be used to calculate the real part of an expression in Mathematica?

Yes, there are a few other functions that can be used to calculate the real part of an expression in Mathematica. These include RealPart[], which is equivalent to Re[], and ComplexExpand[], which can be used to simplify complex expressions and return the real part. Additionally, the Im[] function can be used to calculate the imaginary part of an expression.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
246
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top