Variable: FuzzyShape
@kortexya/reasoninglayer / FuzzyShape
Variable: FuzzyShape
constFuzzyShape:object
Defined in: src/builders/value.ts:162
Builder namespace for fuzzy membership function shapes.
Produces JSON using the "kind" discriminator (NOT "type"):
{"kind": "Triangular", "a": 20, "b": 22, "c": 24}.
Type Declaration
bell()
readonlybell(center,width,slope):BellShape
Create a generalized bell fuzzy membership function.
Tunable flat-top bell: μ(x) = 1 / (1 + |((x - center) / width)|^(2*slope)).
Unlike Gaussian, the slope controls how sharply the curve drops off.
Parameters
center
number
Center of the bell (membership = 1).
width
number
Half-width of the bell at the crossover point.
slope
number
Controls steepness of the sides. Higher = sharper edges.
Returns
A BellShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.bell(100, 15, 3)// {"kind": "Bell", "center": 100, "width": 15, "slope": 3}cauchy()
readonlycauchy(center,gamma):CauchyShape
Create a Cauchy (Lorentzian) fuzzy membership function.
μ(x) = 1 / (1 + ((x - center) / gamma)^2). Heavy-tailed bell whose tails never reach zero.
Parameters
center
number
Center of the Cauchy curve (membership = 1).
gamma
number
Half-width at half-maximum, controlling the spread.
Returns
A CauchyShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.cauchy(0, 1)// {"kind": "Cauchy", "center": 0, "gamma": 1}cosine()
readonlycosine(center,width):CosineShape
Create a cosine fuzzy membership function with compact support.
μ(x) = 0.5 * (1 + cos(2π/width * (x - center))) for |x - center| <= width/2,
μ(x) = 0 otherwise.
Parameters
center
number
Center of the cosine curve (membership = 1).
width
number
Full width of the support region.
Returns
A CosineShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.cosine(50, 10)// {"kind": "Cosine", "center": 50, "width": 10}cyclicGaussian()
readonlycyclicGaussian(mean,stdDev,period):CyclicGaussianShape
Create a cyclic Gaussian fuzzy membership function with periodic wrapping.
Parameters
mean
number
Center of the Gaussian curve.
stdDev
number
Standard deviation controlling width.
period
number
Period of the cyclic wrapping (e.g., 360 for degrees).
Returns
A CyclicGaussianShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.cyclicGaussian(180, 30, 360)gaussian()
readonlygaussian(mean,stdDev):GaussianShape
Create a Gaussian fuzzy membership function.
Parameters
mean
number
Center of the Gaussian curve (membership = 1).
stdDev
number
Standard deviation controlling width.
Returns
A GaussianShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.gaussian(100, 15)gaussianProduct()
readonlygaussianProduct(mean1,stdDev1,mean2,stdDev2):GaussianProductShape
Create a Gaussian product (gauss2mf) fuzzy membership function.
Asymmetric flat-top bell: left Gaussian up to mean1, flat 1.0 in [mean1, mean2], right Gaussian after mean2.
Parameters
mean1
number
Left Gaussian center.
stdDev1
number
Left Gaussian standard deviation.
mean2
number
Right Gaussian center.
stdDev2
number
Right Gaussian standard deviation.
Returns
A GaussianProductShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.gaussianProduct(36.5, 0.3, 37.5, 0.2)// {"kind": "GaussianProduct", "mean1": 36.5, "stdDev1": 0.3, "mean2": 37.5, "stdDev2": 0.2}piecewiseLinear()
readonlypiecewiseLinear(points):PiecewiseLinearShape
Create a piecewise linear fuzzy membership function.
Membership is linearly interpolated between the provided (x, mu) data points.
Parameters
points
[number, number][]
Array of [x, mu] tuples defining the membership function.
Returns
A PiecewiseLinearShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.piecewiseLinear([[0, 0], [0.5, 1], [1, 0]])// {"kind": "PiecewiseLinear", "points": [[0, 0], [0.5, 1], [1, 0]]}piShape()
readonlypiShape(a,b,c,d):PiShapeShape
Create a Pi-shaped (pimf) fuzzy membership function.
Smooth flat-top bump: μ(x) = SShape(x, a, b) * ZShape(x, c, d).
Like a smooth trapezoidal.
Parameters
a
number
Left foot (SShape start).
b
number
Left shoulder (SShape end).
c
number
Right shoulder (ZShape start).
d
number
Right foot (ZShape end).
Returns
A PiShapeShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.piShape(10, 20, 60, 80)// {"kind": "PiShape", "a": 10, "b": 20, "c": 60, "d": 80}sigmoid()
readonlysigmoid(midpoint,steepness):SigmoidShape
Create a sigmoid (logistic) fuzzy membership function.
Monotonic S-curve transition: μ(x) = 1 / (1 + exp(-steepness * (x - midpoint))).
Positive steepness = increasing, negative = decreasing.
Parameters
midpoint
number
The x-value where membership = 0.5 (inflection point).
steepness
number
Controls transition sharpness. Positive = left-to-right rise.
Returns
A SigmoidShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
// DNA match confidence: sharp transition around 95%FuzzyShape.sigmoid(0.95, 20)// {"kind": "Sigmoid", "midpoint": 0.95, "steepness": 20}sigmoidDifference()
readonlysigmoidDifference(midpoint1,steepness1,midpoint2,steepness2):SigmoidDifferenceShape
Create a sigmoid difference fuzzy membership function.
Difference of two sigmoids: creates a smooth bounded region (like a smooth trapezoidal).
μ(x) = sigmoid(x, midpoint1, steepness1) - sigmoid(x, midpoint2, steepness2).
Parameters
midpoint1
number
Left transition inflection point.
steepness1
number
Left transition sharpness (positive = rising).
midpoint2
number
Right transition inflection point.
steepness2
number
Right transition sharpness (positive = falling).
Returns
A SigmoidDifferenceShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
// Smooth region between pH 6.5 and 7.5FuzzyShape.sigmoidDifference(6.5, 10, 7.5, 10)// {"kind": "SigmoidDifference", "midpoint1": 6.5, "steepness1": 10, "midpoint2": 7.5, "steepness2": 10}sigmoidProduct()
readonlysigmoidProduct(midpoint1,steepness1,midpoint2,steepness2):SigmoidProductShape
Create a sigmoid product fuzzy membership function.
Product of two sigmoids: μ(x) = sigmoid(x, midpoint1, steepness1) * sigmoid(x, midpoint2, steepness2).
Always non-negative (unlike sigmoidDifference).
Parameters
midpoint1
number
First sigmoid inflection point.
steepness1
number
First sigmoid sharpness.
midpoint2
number
Second sigmoid inflection point.
steepness2
number
Second sigmoid sharpness.
Returns
A SigmoidProductShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.sigmoidProduct(6.5, 10, 7.5, -10)// {"kind": "SigmoidProduct", "midpoint1": 6.5, "steepness1": 10, "midpoint2": 7.5, "steepness2": -10}spike()
readonlyspike(center,width):SpikeShape
Create a spike (Laplacian/double-exponential) fuzzy membership function.
μ(x) = exp(-|x - center| / width). Sharp cusp at center with exponential tails.
Parameters
center
number
Peak of the spike (membership = 1).
width
number
Controls the rate of exponential decay.
Returns
A SpikeShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.spike(100, 5)// {"kind": "Spike", "center": 100, "width": 5}sShape()
readonlysShape(a,b):SShapeShape
Create an S-shaped (smf) fuzzy membership function.
Smooth monotonic spline from 0 to 1 using piecewise quadratic. Reaches exact 0 and 1 (unlike sigmoid).
Parameters
a
number
Foot: x-value where membership starts rising from 0.
b
number
Shoulder: x-value where membership reaches 1.
Returns
An SShapeShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.sShape(20, 80)// {"kind": "SShape", "a": 20, "b": 80}trapezoidal()
readonlytrapezoidal(a,b,c,d):TrapezoidalShape
Create a trapezoidal fuzzy membership function.
Parameters
a
number
Left foot (membership starts rising from 0).
b
number
Left shoulder (membership reaches 1).
c
number
Right shoulder (membership starts falling from 1).
d
number
Right foot (membership returns to 0).
Returns
A TrapezoidalShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.trapezoidal(18, 20, 24, 26)triangular()
readonlytriangular(a,b,c):TriangularShape
Create a triangular fuzzy membership function.
Parameters
a
number
Left foot (membership = 0).
b
number
Peak (membership = 1).
c
number
Right foot (membership = 0).
Returns
A TriangularShape: {"kind": "Triangular", "a": 20, "b": 22, "c": 24}.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.triangular(20, 22, 24)zShape()
readonlyzShape(a,b):ZShapeShape
Create a Z-shaped (zmf) fuzzy membership function.
Mirror of sShape. Smooth monotonic spline from 1 to 0 using piecewise quadratic.
Parameters
a
number
Shoulder: x-value where membership starts falling from 1.
b
number
Foot: x-value where membership reaches 0.
Returns
A ZShapeShape.
Remarks
Serialization format: Tagged by "kind" (FuzzyShapeDto).
Example
FuzzyShape.zShape(20, 80)// {"kind": "ZShape", "a": 20, "b": 80}Remarks
Discriminator field is "kind", NOT "type".
This differs from most other tagged unions in the API which use "type".
Example
import { FuzzyShape, Value } from '@kortexya/reasoninglayer';
const shape = FuzzyShape.triangular(20, 22, 24);const fuzzyAge = Value.fuzzyNumber(shape);