Skip to content

Commit

Permalink
Fix Linq.FormatComplexLambda - mathnet#68
Browse files Browse the repository at this point in the history
  • Loading branch information
diluculo committed Jan 8, 2019
1 parent 15b800a commit ed1dca5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Symbolics.Tests/Compilation/Compilation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ let tests =

let expr9' = x + 1
(Compile.compileComplexExpression1OrThrow expr9' symX).Invoke(System.Numerics.Complex.One) --> toComplex 2.0

let expr10' = y * y + Expression.I * y + (besselk x (Expression.I * y)) / (besselk (negate x) (Expression.I * y))
(Compile.compileComplexExpression2OrThrow expr10' symX symY).Invoke(toComplex 0.5, System.Numerics.Complex.One) --> complex 2.0 1.0 // 1*1 + I + 1 = 2 + I
}
]
2 changes: 1 addition & 1 deletion src/Symbolics/Typed/Linq.fs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ module Linq =
let constant = function
| E -> Some (Expression.Constant (complex Constants.E 0.0) :> Expression)
| Pi -> Some (Expression.Constant (complex Constants.Pi 0.0) :> Expression)
| _ -> None
| I -> Some (Expression.Constant (complex 0.0 1.0) :> Expression)
let valueType = typeof<complex>
let mathType = typeof<complex>
let mathCall1 (name : string) (a : Expression) = Expression.Call(mathType.GetMethod(name, [| valueType |]), a) :> Expression
Expand Down

0 comments on commit ed1dca5

Please sign in to comment.