Package org.djutils.math.functions
Class Sine
java.lang.Object
org.djutils.math.functions.Sine
- All Implemented Interfaces:
 Comparable<MathFunction>,Function<Double,,Double> MathFunction
Sine function.
 
Copyright (c) 2023-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
 - Alexander Verbraeck
 
- 
Nested Class Summary
Nested classes/interfaces inherited from interface org.djutils.math.functions.MathFunction
MathFunction.TupleSt - 
Constructor Summary
ConstructorsConstructorDescriptionSine(double amplitude, double omega, double shift) Construct a new Sine functionfactor * sin(omega * x + shift).Sine(MathFunction chain, double amplitude, double omega, double shift) Construct a new Sine functionfactor * sin(omega * x + shift). - 
Method Summary
Modifier and TypeMethodDescriptionintcompareWithinSubType(MathFunction other) Determine sorting order among instances of a particular sub type ofMathFunction.static Sinecosine(double amplitude, double omega, double shift) Construct a cosine functionfactor * cos(omega * x + shift).booleanReturns the derivative of the data with respect to fractional length.getKnotReport(Interval<?> interval) Report what is known about knots of thisMathFunctionin someInterval.Report all knots of thisMathFunctionin someInterval.doublegetScale()Get the scale factor of this MathFunction.inthashCode()mergeAdd(MathFunction other) This MathFunction is added to another; try to replace both by a combinedMathFunction.mergeMultiply(MathFunction other) This MathFunction is multiplied by another; try to replace both by a combined MathFunction.scaleBy(double scaleFactor) Incorporate a multiplication factor to this MathFunction.simplify()Attempts to find a simplified version of this MathFunction (e.g. replace1 - 5by-4).intSorting priority of this type of MathFunction (low values shall sort before higher).toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.math.functions.MathFunction
compareChains, compareTo, mergeDivide, printValue 
- 
Constructor Details
- 
Sine
Construct a new Sine functionfactor * sin(omega * x + shift).- Parameters:
 chain- the MathFunction that yields thexfor this power functionamplitude- multiplication factor for the outputomega- radial frequency; multiplication factor for the inputshift- time shift for the input (applied after theomegafactor)
 - 
Sine
public Sine(double amplitude, double omega, double shift) Construct a new Sine functionfactor * sin(omega * x + shift).- Parameters:
 amplitude- multiplication factor for the outputomega- radial frequency; multiplication factor for the inputshift- time shift for the input (applied after theomegafactor)
 
 - 
 - 
Method Details
- 
cosine
Construct a cosine functionfactor * cos(omega * x + shift). The result is actually a Sine with the correctly adjustedshift.- Parameters:
 amplitude- multiplication factor for the outputomega- radial frequency; multiplication factor for the inputshift- time shift for the input (applied after theomegafactor)- Returns:
 - Sine with the requested 
amplitude,omegaand adjustedshift 
 - 
apply
 - 
getDerivative
Description copied from interface:MathFunctionReturns the derivative of the data with respect to fractional length.- Specified by:
 getDerivativein interfaceMathFunction- Returns:
 - derivative of this MathFunction
 
 - 
simplify
Description copied from interface:MathFunctionAttempts to find a simplified version of this MathFunction (e.g. replace1 - 5by-4).- Specified by:
 simplifyin interfaceMathFunction- Returns:
 this, or a simplified version thereof
 - 
getScale
public double getScale()Description copied from interface:MathFunctionGet the scale factor of this MathFunction.- Specified by:
 getScalein interfaceMathFunction- Returns:
 - the scale factor of this MathFunction
 
 - 
scaleBy
Description copied from interface:MathFunctionIncorporate a multiplication factor to this MathFunction.- Specified by:
 scaleByin interfaceMathFunction- Parameters:
 scaleFactor- the factor to incorporate- Returns:
 - a new MathFunction that yields the same result as the original function multiplied by the 
factor 
 - 
sortPriority
public int sortPriority()Description copied from interface:MathFunctionSorting priority of this type of MathFunction (low values shall sort before higher).- Specified by:
 sortPriorityin interfaceMathFunction- Returns:
 - sorting priority of this type of MathFunction
 
 - 
compareWithinSubType
Description copied from interface:MathFunctionDetermine sorting order among instances of a particular sub type ofMathFunction. The sorting order should sortMathFunctions that may be combined next to one another. BecauseMathFunctions are also used inSortedSets, this comparator may return 0 if and only if this and other are entirely equal!- Specified by:
 compareWithinSubTypein interfaceMathFunction- Parameters:
 other- the otherMathFunctionthat must be of the same type- Returns:
 - int; < 0 when this sorts before other; > 0 when this sorts after other; 0 when this and other are identical
 
 - 
mergeAdd
Description copied from interface:MathFunctionThis MathFunction is added to another; try to replace both by a combinedMathFunction.- Specified by:
 mergeAddin interfaceMathFunction- Parameters:
 other- the otherMathFunction- Returns:
 - combined MathFunction, or null when the two could not be combined
 
 - 
mergeMultiply
Description copied from interface:MathFunctionThis MathFunction is multiplied by another; try to replace both by a combined MathFunction.- Specified by:
 mergeMultiplyin interfaceMathFunction- Parameters:
 other- the other MathFunction- Returns:
 - combined MathFunction, or null when the two could not be combined
 
 - 
getKnotReport
Description copied from interface:MathFunctionReport what is known about knots of thisMathFunctionin someInterval. The report does not take chained functions into account.- Specified by:
 getKnotReportin interfaceMathFunction- Parameters:
 interval- theIntervalon which knowledge of knots is requested- Returns:
 - summary of what is known about knots in the Interval
 
 - 
getKnots
Description copied from interface:MathFunctionReport all knots of thisMathFunctionin someInterval. ThrowsIllegalStateExceptionwhen the number of knots in theIntervalis not known, or infinite.- Specified by:
 getKnotsin interfaceMathFunction- Parameters:
 interval- theIntervalover which the knots must be reported- Returns:
 - all the knots of this 
MathFunctionin the requestedInterval 
 - 
toString
 - 
hashCode
public int hashCode() - 
equals
 
 -