# Interface StringShape

Defines initial conditions of a string used in the StringSim PDE simulation by specifying the initial displacement and velocity at each point of the string.

### How to find the correct velocity for a traveling wave:

The d'Alembert equation for a left-moving traveling wave is `f(x + ct)`, where `f()` is a general single-variable waveform, think of it as `f(x)` moving to the left as `t` increases. The velocity (partial derivative with respect to time) is then `c f'(x + ct)` which at time `t=0` is `c f'(x)`. So take the first derivative of the waveform, and multiply by `c` where `c` is the wave speed `= sqrt(tension/density)`. Right-moving wave is `f(x - ct)` with derivative `-c f'(x)`

interface StringShape {
getClassName(): string;
getLength(): number;
getName(opt_localized?): string;
position(x): number;
velocity(x): number;
}

## Methods

• Returns name of class of this object.

#### Returns string

name of class of this object.

• Returns the length of the string.

#### Returns number

length of the string

• Name of this StringShape, either a the language-independent name for scripting purposes or the localized name for display to user.

#### Parameters

• ##### `Optional`opt_localized: boolean

`true` means return the localized version of the name; default is `false` which means return the language independent name.

#### Returns string

name of this StringShape

• Returns the initial displacement at a point on the string.

#### Parameters

• ##### x: number

the location of the point of the string

#### Returns number

the displacement at that point of the string

• Returns the initial velocity at a point of the string.

#### Parameters

• ##### x: number

the location of the point of the string

#### Returns number

the velocity at that point of the string

Generated using TypeDoc