Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8866453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:47:17+00:00 2026-06-14T16:47:17+00:00

I have the following problem: I need to extend following class Complex (representing complex

  • 0

I have the following problem:

I need to extend following class Complex (representing complex number) and add field with exponential form of it, additionaly overload methods from Complex:

class Complex{
public double re;
public double im;

public Complex(double r, double i){
    re =r;
    im = i;
}

public Complex add(Complex a,Complex b){
    return new Complex(a.re + b.re,a.im + b.im );
}

public Complex sub(Complex a,Complex b){
    return new Complex(a.re - b.re,a.im - b.im);
}

//more code
}

My class is like following

class ComplexE extends Complex{
   public double exponential;
    public ComplexE(double a, double b){
        re=a;
        im = b;
    }
    public ComplexE(double _exp){
        super(0,0);
        this.exponential = _exp;
    }

   public void setExpFromComplex(Complex comp){
    double module = Math.sqrt(Math.pow(comp.re,2) + Math.pow(comp.im,2));
    double fi = Math.atan2(comp.re,comp.im);
    this.exponential = module * Math.pow(Math.E, fi);
   } 

   public ComplexE add(ComplexE a,ComplexE b){
        return new ComplexE(a.exponential + b.exponential );
    }

}

My questions are: am I doing it right? Does my way of finding exponential form is correct?

Edit:
The math way i tried to use is:

z = |z|*(cos(phi) + i*sin(phi)) = |z|*e^(i*phi).
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:47:19+00:00Added an answer on June 14, 2026 at 4:47 pm

    This doesn’t really make sense. The exponential form is simply an alternative way of expressing a complex number. For example

     z = x + iy
    

    is the standard real and imaginary component representation that you use in your first class. The exponential form is

     z = r * exp(i * theta)
    

    where r is the modulus and theta is the argument where

     r = sqrt(x*x + y*y)
    

    and

     z = r*( cos(theta) + i*sin(theta))
    

    Essentially this is just converting the cartesian coordinates to the equivalent polar representation.

    You are storing a double in the second derived class called exponential which you are trying to calculate but really this value is meaningless. You are calculating the modulus as module correctly and the argument as fi but it appears you want exponential to be

     module*exp(fi)
    

    which is not really meaningful. If you want to store the values of modulus and argument that are correct for your values of x and y as cartesian real and imaginary components that would make more sense but storing just a double exponential is meaningless unless you have omitted something from the question.

    It seems that you would really be better off either just calculating the modulus and argument from your re and im variables and returning them from a function or storing them as additional member variables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem: I need to use XSLFO to generate a 2-column
Hi i have following Problem. I write a Mediawiki Extension where i need some
I have a problem with Matlab - I need to do the following :
I have a problem with JPA 1.0 (OpenJPA) Following situation @Entity public class A{
Hello, I have the following problem: public class TestCombo extends JFrame{ public TestCombo() {
I need to extend the TreeNode class such that I can add custom properties
I have a problem with following simple code. I create GraphicView class which extends
I have following problem: I have to make a ASP.NET Webapplication with a two-row
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.