You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
overridedefvisit(env:Option[Environment]=None) = (begin.visit(env), end.visit(env), incr.visit(env)) match {
56
-
case (Number(b),Number(e),Number(i)) =>DenseMatrix( List( ( b to e by i ).map( n =>Number( n ) ).to[List] ) )
56
+
case (Number(b),Number(e),Number(i)) =>DenseMatrix( List( ( BigDecimal( b ) to BigDecimal( e ) by BigDecimal( i ) ).map( n =>Number( n.toDouble ) ).to(List) ) )
57
57
case (b,e,i) =>RowVector(b,e,i)
58
58
}
59
59
definfo(env:Option[Environment]=None) ="RowVector("+ begin +","+ end +","+ incr +")"
@@ -277,11 +277,11 @@ case class LowerTriangularMatrix( cols:List[List[Expr]] ) extends Expr with Matr
overridedefeval() =Product( factors.map( factor => factor.eval() ):_* ).visit() // eval will replace all vars and constants, the rest is just turning it into numbers
99
99
@@ -168,7 +168,7 @@ case class Product( factors:Expr*) extends Expr with FunMany {
168
168
169
169
found match {
170
170
// Found one - splice factors and re-insert
171
-
caseSome((Some(e),i:Int)) =>Some( expressify( factors.toList.updated( i, e ) ) )
171
+
caseSome((Some(e),i:Int)) =>Some( expressify( factors.to(List).updated( i, e ) ) )
172
172
caseSome(_) =>None
173
173
caseNone=>None
174
174
}
@@ -199,7 +199,7 @@ case class Product( factors:Expr*) extends Expr with FunMany {
199
199
// This replaces the product with a sum
200
200
// a * (b +c ) * d -> a * b * d + a * c * d
201
201
caseSome((s:Sum,i:Int)) => {
202
-
Sum( s.flatTerms.toList.map( term =>Product( flatFactors.toList.updated(i,term ) ) ) ).expand.visit()
202
+
Sum( s.flatTerms.to(List).map( term =>Product( flatFactors.to(List).updated(i,term ) ) ) ).expand.visit()
203
203
}
204
204
case _ =>this
205
205
}
@@ -215,5 +215,5 @@ case class Product( factors:Expr*) extends Expr with FunMany {
//case (Number( a ), Sum( Number( b ), c ) ) if ( b == a ) => rv = rv :+ Rule( "Removal of common term " + a, Equality( Number( 0 ), c ) )
154
154
//case (Number( a ), Sum( Number( b ), c ) ) if ( a > b ) => rv = rv :+ Rule( "Subtract " + Number( b ) + "from both sides", Equality( Number( a - b ), c ) )
155
155
//case (Number( a ), Sum( Number( b ), c ) ) if ( a < b ) => rv = rv :+ Rule( "Subtract " + Number( a ) + "from both sides", Equality( Number( 0 ), Sum( Number( b - a ), c ) ) )
0 commit comments