New Posts  All Forums:Forum Nav:

C# programming help

post #1 of 8
Thread Starter 
700

my question is, how do i get the program to caluclate the product of these numbers in console?
 
Simba
(16 items)
 
Gulftown Memories
(16 items)
 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 @3.6GHz Asus Maximus II Formula EVGA GTX 570 @900 Core 4GB (aww yea) GeiL Black Dragons 
Hard DriveHard DriveHard DriveHard Drive
128GB Crucial M4 Seagate Barracuda 3TB 7200.14 2TB Western Digital Red 1TB Western Digital Caviar Green 
Optical DriveCoolingCoolingCooling
ASUS DVD R/RW SATA x24 Prolimatech Megahalems Boss Status 2x 1850rpm Scythe Gentle Typhoons 2x Sanyo Denki San Ace 9G1212H1011 
CoolingOSMonitorKeyboard
1x Scythe Ultra Kaze 3k Windows 8 Pro Dell S2740 27 Inch IPS Das Keyboard 
PowerCaseMouseMouse Pad
NZXT Hale90 1000W Antec P280 Steelseries Sensei Steelseries QCK Mini 
AudioOther
Fiio E9 to Asus Xonar DX (headphone amp AND DAC) Sennheiser HD598 
CPUMotherboardGraphicsRAM
Intel Core i7 3770K @ 5GHz 1.43V Gigabyte GA-Z77X-UP4 TB MSI Twinfrozr III 7870 2x4GB Samsung Wonder Ram 
Hard DriveHard DriveHard DriveCooling
128GB Crucial M4 1TB Caviar Blue, 640GB Caviar Blue 2x2TB Western Digital Reds coming Prolimatech Megahalems w/ 2x San Ace H1011's pu... 
OSMonitorKeyboardPower
Windows 8 Pro 32 inch Toshiba LCD, 24 inch Dell ST2412L Coolermaster Quickfire Rapid Antec Truepower New 750W 
CaseMouseMouse PadAudio
Antec P280 Razer Deathadder 1800dpi frankenstein! just hdmi audio to the tv for now 
  hide details  
Reply
 
Simba
(16 items)
 
Gulftown Memories
(16 items)
 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 @3.6GHz Asus Maximus II Formula EVGA GTX 570 @900 Core 4GB (aww yea) GeiL Black Dragons 
Hard DriveHard DriveHard DriveHard Drive
128GB Crucial M4 Seagate Barracuda 3TB 7200.14 2TB Western Digital Red 1TB Western Digital Caviar Green 
Optical DriveCoolingCoolingCooling
ASUS DVD R/RW SATA x24 Prolimatech Megahalems Boss Status 2x 1850rpm Scythe Gentle Typhoons 2x Sanyo Denki San Ace 9G1212H1011 
CoolingOSMonitorKeyboard
1x Scythe Ultra Kaze 3k Windows 8 Pro Dell S2740 27 Inch IPS Das Keyboard 
PowerCaseMouseMouse Pad
NZXT Hale90 1000W Antec P280 Steelseries Sensei Steelseries QCK Mini 
AudioOther
Fiio E9 to Asus Xonar DX (headphone amp AND DAC) Sennheiser HD598 
CPUMotherboardGraphicsRAM
Intel Core i7 3770K @ 5GHz 1.43V Gigabyte GA-Z77X-UP4 TB MSI Twinfrozr III 7870 2x4GB Samsung Wonder Ram 
Hard DriveHard DriveHard DriveCooling
128GB Crucial M4 1TB Caviar Blue, 640GB Caviar Blue 2x2TB Western Digital Reds coming Prolimatech Megahalems w/ 2x San Ace H1011's pu... 
OSMonitorKeyboardPower
Windows 8 Pro 32 inch Toshiba LCD, 24 inch Dell ST2412L Coolermaster Quickfire Rapid Antec Truepower New 750W 
CaseMouseMouse PadAudio
Antec P280 Razer Deathadder 1800dpi frankenstein! just hdmi audio to the tv for now 
  hide details  
Reply
post #2 of 8
edit: sorry, nvm.
Edited by ronnin426850 - 2/20/12 at 11:55pm
My Rig
(14 items)
 
Ex-wife's Rig
(15 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 4460 AsRock H81M-DG4 Sapphire Rx470 Platinum KVR 1600 16Gb 
Hard DriveHard DriveCoolingOS
2x Seagate 3Tb Samsung 850 EVO 120 Scythe Ninja 3 Rev.B Windows 10 Pro 
MonitorKeyboardPowerCase
Fujitsu Siemens A17-2A Logitech K280e SuperFlower SF-550K12XP Thermaltake Versa H25 
MouseAudio
Logitech G402 Sony MDR XD150 
CPUMotherboardGraphicsRAM
Athlon 750K 4.0Ghz AsRock FM2A75 Pro4+ Sapphire R9 270X Dual-X Kingston 2x4Gb 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 850 EVO 120  Western Digital 320Gb LiteON DVD-RW CoolerMaster Hyper Z600 
OSMonitorKeyboardPower
Windows 7 Pro x64 Toshiba 32" FullHD TV Logitech FSP Hexa 550 
CaseMouse
DeLUX Logitech 
  hide details  
Reply
My Rig
(14 items)
 
Ex-wife's Rig
(15 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 4460 AsRock H81M-DG4 Sapphire Rx470 Platinum KVR 1600 16Gb 
Hard DriveHard DriveCoolingOS
2x Seagate 3Tb Samsung 850 EVO 120 Scythe Ninja 3 Rev.B Windows 10 Pro 
MonitorKeyboardPowerCase
Fujitsu Siemens A17-2A Logitech K280e SuperFlower SF-550K12XP Thermaltake Versa H25 
MouseAudio
Logitech G402 Sony MDR XD150 
CPUMotherboardGraphicsRAM
Athlon 750K 4.0Ghz AsRock FM2A75 Pro4+ Sapphire R9 270X Dual-X Kingston 2x4Gb 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 850 EVO 120  Western Digital 320Gb LiteON DVD-RW CoolerMaster Hyper Z600 
OSMonitorKeyboardPower
Windows 7 Pro x64 Toshiba 32" FullHD TV Logitech FSP Hexa 550 
CaseMouse
DeLUX Logitech 
  hide details  
Reply
post #3 of 8
You want to read in the numbers and then add them, rather than have them hard-coded? If that's the case, try this:

Oh, and rather than take a screenshot of your code, that cannot be used for copy/paste here on the forums, just wrap your code with [ CODE ] and [ /CODE ] (without the spaces next to the brackets), or use the 'Code' button in the tools at the top of the text window.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    public struct Complex
    {
        public int real;
        public int imaginary;

        public Complex( int real, int imaginary )
        {
            this.real = real;
            this.imaginary = imaginary;
        }

        public static Complex operator +( Complex c1, Complex c2 )
        {
            return new Complex(c1.real + c2.real, c1.imaginary + c2.imaginary);
        }

        public override string ToString()
        {
            return (System.String.Format("{0} + {1}i", real, imaginary));
        }
    }

    class Program
    {
        static void Main( string[] args )
        {
            Complex num1 = new Complex();

            bool validInput = false;
            while (!validInput)
            {
                Console.WriteLine("Please input an integer value for the first 'real': ");
                validInput = GetInputForNum(out num1.real);             
            }
            
            validInput = false;
            while (!validInput)
            {
                Console.WriteLine("Please input an integer value for the first 'imaginary': ");
                validInput = GetInputForNum(out num1.imaginary);
            }

            Complex num2 = new Complex();
            validInput = false;
            while (!validInput)
            {
                Console.WriteLine("Please input an integer value for the second 'real': ");
                validInput = GetInputForNum(out num2.real);
            }

            validInput = false;
            while (!validInput)
            {
                Console.WriteLine("Please input an integer value for the second 'imaginary': ");
                validInput = GetInputForNum(out num2.imaginary);
            }

            Complex sum = num1 + num2;

            Console.WriteLine("The sum of the two numbers: " + sum);
        }

        static bool GetInputForNum( out int retVal )
        {
            retVal = -1;
            string input = Console.ReadLine();

            // ToInt32 can throw FormatException or OverflowException.
            try
            {
                retVal = Convert.ToInt32(input);
            }
            catch (FormatException)
            {
                Console.WriteLine("Input string is not a sequence of digits.");
                return false;
            }
            catch (OverflowException)
            {
                Console.WriteLine("The number cannot fit in an Int32.");
                return false;
            }

            return true;
        }
    }
}
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
post #4 of 8
Thread Starter 
lordkion thanks. +rep. still only for the sum though, im having issues with getting the product.
Edited by srsparky32 - 2/21/12 at 8:48am
 
Simba
(16 items)
 
Gulftown Memories
(16 items)
 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 @3.6GHz Asus Maximus II Formula EVGA GTX 570 @900 Core 4GB (aww yea) GeiL Black Dragons 
Hard DriveHard DriveHard DriveHard Drive
128GB Crucial M4 Seagate Barracuda 3TB 7200.14 2TB Western Digital Red 1TB Western Digital Caviar Green 
Optical DriveCoolingCoolingCooling
ASUS DVD R/RW SATA x24 Prolimatech Megahalems Boss Status 2x 1850rpm Scythe Gentle Typhoons 2x Sanyo Denki San Ace 9G1212H1011 
CoolingOSMonitorKeyboard
1x Scythe Ultra Kaze 3k Windows 8 Pro Dell S2740 27 Inch IPS Das Keyboard 
PowerCaseMouseMouse Pad
NZXT Hale90 1000W Antec P280 Steelseries Sensei Steelseries QCK Mini 
AudioOther
Fiio E9 to Asus Xonar DX (headphone amp AND DAC) Sennheiser HD598 
CPUMotherboardGraphicsRAM
Intel Core i7 3770K @ 5GHz 1.43V Gigabyte GA-Z77X-UP4 TB MSI Twinfrozr III 7870 2x4GB Samsung Wonder Ram 
Hard DriveHard DriveHard DriveCooling
128GB Crucial M4 1TB Caviar Blue, 640GB Caviar Blue 2x2TB Western Digital Reds coming Prolimatech Megahalems w/ 2x San Ace H1011's pu... 
OSMonitorKeyboardPower
Windows 8 Pro 32 inch Toshiba LCD, 24 inch Dell ST2412L Coolermaster Quickfire Rapid Antec Truepower New 750W 
CaseMouseMouse PadAudio
Antec P280 Razer Deathadder 1800dpi frankenstein! just hdmi audio to the tv for now 
  hide details  
Reply
 
Simba
(16 items)
 
Gulftown Memories
(16 items)
 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 @3.6GHz Asus Maximus II Formula EVGA GTX 570 @900 Core 4GB (aww yea) GeiL Black Dragons 
Hard DriveHard DriveHard DriveHard Drive
128GB Crucial M4 Seagate Barracuda 3TB 7200.14 2TB Western Digital Red 1TB Western Digital Caviar Green 
Optical DriveCoolingCoolingCooling
ASUS DVD R/RW SATA x24 Prolimatech Megahalems Boss Status 2x 1850rpm Scythe Gentle Typhoons 2x Sanyo Denki San Ace 9G1212H1011 
CoolingOSMonitorKeyboard
1x Scythe Ultra Kaze 3k Windows 8 Pro Dell S2740 27 Inch IPS Das Keyboard 
PowerCaseMouseMouse Pad
NZXT Hale90 1000W Antec P280 Steelseries Sensei Steelseries QCK Mini 
AudioOther
Fiio E9 to Asus Xonar DX (headphone amp AND DAC) Sennheiser HD598 
CPUMotherboardGraphicsRAM
Intel Core i7 3770K @ 5GHz 1.43V Gigabyte GA-Z77X-UP4 TB MSI Twinfrozr III 7870 2x4GB Samsung Wonder Ram 
Hard DriveHard DriveHard DriveCooling
128GB Crucial M4 1TB Caviar Blue, 640GB Caviar Blue 2x2TB Western Digital Reds coming Prolimatech Megahalems w/ 2x San Ace H1011's pu... 
OSMonitorKeyboardPower
Windows 8 Pro 32 inch Toshiba LCD, 24 inch Dell ST2412L Coolermaster Quickfire Rapid Antec Truepower New 750W 
CaseMouseMouse PadAudio
Antec P280 Razer Deathadder 1800dpi frankenstein! just hdmi audio to the tv for now 
  hide details  
Reply
post #5 of 8
Quote:
Originally Posted by srsparky32 View Post

lordkion thanks. +rep. still only for the sum though, im having issues with getting the product.

The product of two complex numbers, using the code sample I posted, would be:
((num1.real * num2.real) + (num1.real * num2.imaginary) + (num1.imaginary * num2.real) + (num1.imaginary * num2.imaginary))

An example with numbers:
(3 + 2i)(1 + 4i) = 3 + 12i + 2i + 8*(i^2) = 3 + 14i + 8*(i^2)

Just basic associative multiplication.

If you do it this way though it will no longer be a standard complex number by the definition your 'Complex' struct goes by, as you will now have an i^2. Your struct will need to support a List of values, and their imaginary exponents. Something like
Code:
struct Imaginary
{
    public Imaginary( int value, int exponent )
    {
        this.value = value;
        this.exponent = exponent;
    }
    public int value;
    public int exponent;
}

struct Complex
{
    public int real;
    public List<Imaginary> imaginaryValues = new List<Imaginary>();
}

// In program.cs

Imaginary first = new Imaginary(14, 1);   // 14i
Imaginary second = new Imaginary(8, 2);   //8*(i^2)

Complex myNum;
myNum.real = 3;
myNum.imaginaryValues.Add(first);
myNum.imaginaryValues.Add(second);

// 'myNum' is now 3 + 14i + 8*(i^2)

Edited by lordikon - 2/21/12 at 9:33am
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
post #6 of 8
Quote:
Originally Posted by srsparky32 View Post

lordkion thanks. +rep. still only for the sum though, im having issues with getting the product.

Ok, not sure if I'm getting this the right way, but can't you do something in the lines of
Code:
public static Complex operator *( Complex c1, Complex c2 )
        {
            return new Complex(c1.real * c2.real, c1.imaginary * c2.imaginary);
        }

? That would give you products. Can't test it now, I'm far from my dev rig.
My Rig
(14 items)
 
Ex-wife's Rig
(15 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 4460 AsRock H81M-DG4 Sapphire Rx470 Platinum KVR 1600 16Gb 
Hard DriveHard DriveCoolingOS
2x Seagate 3Tb Samsung 850 EVO 120 Scythe Ninja 3 Rev.B Windows 10 Pro 
MonitorKeyboardPowerCase
Fujitsu Siemens A17-2A Logitech K280e SuperFlower SF-550K12XP Thermaltake Versa H25 
MouseAudio
Logitech G402 Sony MDR XD150 
CPUMotherboardGraphicsRAM
Athlon 750K 4.0Ghz AsRock FM2A75 Pro4+ Sapphire R9 270X Dual-X Kingston 2x4Gb 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 850 EVO 120  Western Digital 320Gb LiteON DVD-RW CoolerMaster Hyper Z600 
OSMonitorKeyboardPower
Windows 7 Pro x64 Toshiba 32" FullHD TV Logitech FSP Hexa 550 
CaseMouse
DeLUX Logitech 
  hide details  
Reply
My Rig
(14 items)
 
Ex-wife's Rig
(15 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 4460 AsRock H81M-DG4 Sapphire Rx470 Platinum KVR 1600 16Gb 
Hard DriveHard DriveCoolingOS
2x Seagate 3Tb Samsung 850 EVO 120 Scythe Ninja 3 Rev.B Windows 10 Pro 
MonitorKeyboardPowerCase
Fujitsu Siemens A17-2A Logitech K280e SuperFlower SF-550K12XP Thermaltake Versa H25 
MouseAudio
Logitech G402 Sony MDR XD150 
CPUMotherboardGraphicsRAM
Athlon 750K 4.0Ghz AsRock FM2A75 Pro4+ Sapphire R9 270X Dual-X Kingston 2x4Gb 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 850 EVO 120  Western Digital 320Gb LiteON DVD-RW CoolerMaster Hyper Z600 
OSMonitorKeyboardPower
Windows 7 Pro x64 Toshiba 32" FullHD TV Logitech FSP Hexa 550 
CaseMouse
DeLUX Logitech 
  hide details  
Reply
post #7 of 8
Quote:
Originally Posted by ronnin426850 View Post

Ok, not sure if I'm getting this the right way, but can't you do something in the lines of
Code:
public static Complex operator *( Complex c1, Complex c2 )
        {
            return new Complex(c1.real * c2.real, c1.imaginary * c2.imaginary);
        }
? That would give you products. Can't test it now, I'm far from my dev rig.

Unfortunately since it's associative multiplication it isn't this simple, see my post above yours. This will leave him with an i^2 value in the result, which his 'Complex' struct cannot handle.
Edited by lordikon - 2/21/12 at 9:49am
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
post #8 of 8
It's difficult understanding what you are really trying to ask for but if it is indeed that you want to be able to calculate the product of two complex numbers, then Lordikon's post explains the method quite clearly.

However, there is something that you will have to do in a slightly different manner:


The product of two complex numbers say, (1+i)(2+2i), will come out to be 2 + 2i + 2i + 2(i^2) and this will of course be not in the standard form of a complex number as mentioned by Lordikon.

However, what you can do is that, knowing the fact the i = (-1)^0.5, change (i^2) to -1.

Maybe you can make a condition that can substitute the value of (i^2) as -1 when multiplying two complex numbers (both that have imaginary parts).

Obviously, this will not be as simple as summing the two numbers.

Basically what I think you'll have to do for the product is write separate code for the multiplication of a real with a real number, a real with an imaginary number, and an imaginary with an imaginary number.
Edited by {Unregistered} - 2/21/12 at 9:37am
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming