Example CpxVector send 028

Description

This example uses the added method Conjugate to the Complex Vector type. This new method simply conjugates each complex number in the vector by negating the imaginary part of each number. The method is invoked by the send command from the CpxVector Methods Dictionary.

Details

Define a method Conjugate which negates the imaginary part of the number.

Define a CpxVector that contains some complex numbers.

 (setq X (new Vector: complex: 2 1.0 2.0 2.5 1.5)) Returns: #

Send the message Conjugate to all the values in the CpxVector.

 (setq Y (send Conjugate: X)) Returns: #

Displays the new CpxVector with the conjugated values.

 (display #) Returns: #(cpx| #c1.0-2.0i #c2.5-1.5i )

To be determined.

 (setq Y (IncAll: V)) Returns: To be determined.

Notes and Hints

To view the entry in the methods Dictionary created by the addMethod function, you can use the method name to access the directory entry by

#<Dictionary 123456>[methodName:] or

To determine the number of assigned methods:

(length (methodsOf CpxVector: ))

To access the nth method name:

(methodsOf CpxVector: )[n 0]

Related Examples

Here are examples of the send function at work.

 BitVector send 018 Character send 011 CpxVector send 028 Date send 013 Dictionary send 004 Directory send 005 FltVector send 015 Function send 014 IntVector send 016 Lambda send 008 Lambda send 009 Matrix send 008 NumMatrix send 027 NumVector send 017 Number send 012 Pair send 019 ShortVector send 017 String send 001 Structure send 003 Symbol send 002 Vector send 006 Void send 009

Here is the link to the current function used in this example.

send

Here are a number of links to other related functions.

Argument Types

Here are the links to the data types of the arguments used in this example.

 CpxVector Symbol Dictionary

Here are a number of links to examples having similar argument types.