1您可以linspace
在微风包对象中找到规范,linalg
并且plot
在包对象中plog
:
http://www.scalanlp.org/api/index.html#breeze.linalg.package
https://github.com/scalanlp/breeze/blob/master/math/src/main/scala/breeze/linalg/package .scala#L127
/**
* Generates a vector of linearly spaced values between a and b (inclusive).
* The returned vector will have length elements, defaulting to 100.
*/
def linspace(a : Double, b : Double, length : Int = 100) : DenseVector[Double] = {
val increment = (b - a) / (length - 1)
DenseVector.tabulate(length)(i => a + increment * i)
}
http://www.scalanlp.org/api/index.html#breeze.plot.package
https://github.com/scalanlp/breeze/blob/master/viz/src/main/scala/breeze/plot/package .scala#L24
/**
* Plots the given y versus the given x with the given style.
*
* @param x X-coordinates, co-indexed with y (and indexed by keys of type K).
* @param y Y-coordinates, co-indexed with x (and indexed by keys of type K).
* @param style Matlab-like style spec of the series to plot.
* @param name Name of the series to show in the legend.
* @param labels Optional in-graph labels for some points.
* @param tips Optional mouse-over tooltips for some points.
*/
def plot[X,Y,V](x: X, y: Y, style : Char = '-', colorcode : String = null, name : String = null,
lines : Boolean = true, shapes : Boolean = false,
labels : (Int) => String = null.asInstanceOf[Int=>String],
tips : (Int) => String = null.asInstanceOf[Int=>String] )
(implicit xv: DomainFunction[X,Int,V],
yv: DomainFunction[Y, Int, V], vv: V=>Double):Series = new Series {
...
2这是逐元素取幂。因此x :^ 3.0
将 x 与每个元素一起返回到三次方。在给出的示例中,x 是DenseVector
介于 0 和 1 之间的 100 个值中的一个。因此x :^ 3.0
会给您另一个DenseVector
介于 0 和 1 之间的 100 个值,但它们被取为三次方,这是一个很好的图表。