Skip to content

Commit d99f65b

Browse files
committed
v3.2.1
1 parent ac2b0a3 commit d99f65b

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

src/VBAexpressions.cls

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,11 @@ End Property
515515
''' <summary>
516516
''' Gets the result for latest evaluated expression.
517517
''' </summary>
518-
Public Property Get result() As String
518+
Public Property Get Result() As String
519519
If P_FORMATRESULT Then
520-
result = FormatLiteralString(CStr(P_RESULT), True)
520+
Result = FormatLiteralString(CStr(P_RESULT), True)
521521
Else
522-
result = P_RESULT
522+
Result = P_RESULT
523523
End If
524524
End Property
525525

@@ -2898,7 +2898,7 @@ Private Function EvalFunction(ByRef Argument As String, ByRef FunctionName As St
28982898
Case "Sine"
28992899
EvalFunction = Sine(Argument, FunctionName)
29002900
Case "SolveLinearSystem"
2901-
EvalFunction = solve(Argument, FunctionName)
2901+
EvalFunction = Solve(Argument, FunctionName)
29022902
Case "aSLN"
29032903
EvalFunction = SLN_(Argument, FunctionName)
29042904
Case "SquareRoot"
@@ -3411,32 +3411,18 @@ err_Handler:
34113411
d_lParenthesis & err.Description & d_rParenthesis
34123412
End Function
34133413

3414-
Private Function fZero(ByRef aFunction As String, ByVal A As Double, _
3415-
ByVal B As Double, Optional epsilon As Double = 0.0000000001, _
3416-
Optional includeVarNames As Boolean = True, _
3417-
Optional useBisectionMethod As Boolean = False, _
3418-
Optional printDebugINFO As Boolean = False) As String
3419-
If Not useBisectionMethod Then
3420-
fZero = fZeroMRF(aFunction, A, B, epsilon, includeVarNames, printDebugINFO)
3421-
Else
3422-
fZero = fZeroMBM(aFunction, A, B, epsilon, includeVarNames, printDebugINFO)
3423-
End If
3424-
End Function
3425-
34263414
''' <summary>
34273415
''' Finds a zero of a univariate function ussing a modified bisection method.
34283416
''' aFunction must be a continuous function f(x) for the interval a <= x <= b.
34293417
''' </summary>
34303418
''' <param name="aFunction">Inline function.</param>
34313419
''' <param name="a">Leftmost interval value.</param>
34323420
''' <param name="b">Rightmost interval value.</param>
3433-
''' <param name="epsilon">Tolerance (relative error limit).</param>
34343421
''' <param name="IncludeVarNames">Include variable name in result.</param>
3435-
''' <param name="printDebugINFO">Print information like iteraction count.</param>
3422+
''' <param name="epsilon">Tolerance (relative error limit).</param>
34363423
Private Function fZeroMBM(ByRef aFunction As String, ByVal A As Double, _
3437-
ByVal B As Double, Optional epsilon As Double = 0.0000000001, _
3438-
Optional includeVarNames As Boolean = True, _
3439-
Optional printDebugINFO As Boolean = False) As String
3424+
ByVal B As Double, Optional includeVarNames As Boolean = True, _
3425+
Optional epsilon As Double = 0.0000000001) As String
34403426
Dim absFC As Double, absFD As Double
34413427
Dim aZero As Double
34423428
Dim c As Double, d As Double 'Intermediate points |a---:c:----:d:---b|
@@ -3528,7 +3514,7 @@ Private Function fZeroMBM(ByRef aFunction As String, ByVal A As Double, _
35283514
.VarValue(tmpVar(varIdx)) = tmpResult
35293515
If Round(tmpFzeroEval, Len(CStr(1 / aZero)) - 1) = 0 Then
35303516
If includeVarNames Then
3531-
fZeroMBM = .CurrentVarValues
3517+
fZeroMBM = ToLiteralString(.CurrentVarValues)
35323518
Else
35333519
fZeroMBM = tmpResult
35343520
End If
@@ -3538,9 +3524,6 @@ Private Function fZeroMBM(ByRef aFunction As String, ByVal A As Double, _
35383524
End With
35393525
fZeroMBM_terminate:
35403526
Set fEvalHelper = Nothing
3541-
If printDebugINFO Then
3542-
Debug.Print "fZeroMBM: " & vbCrLf & vbTab & vbTab & "Evaluations:"; evalCounter; "; Iteractions:"; k
3543-
End If
35443527
Exit Function
35453528
fZeroMBM_errHandler:
35463529
fZeroMBM = e_ValueError
@@ -4819,7 +4802,7 @@ Private Function GoodnessOfFit_(ByRef Polynomial As String, ByRef ObserArray() A
48194802
averageY = ColumnAvg(ObserArray, 1) 'Mean
48204803
For i = 0 To n - 1
48214804
.Eval "x=" & CStr(ObserArray(i, 0))
4822-
seSquare = seSquare + (ObserArray(i, 1) - CDbl(.result)) ^ 2 'Partial sum squared regression
4805+
seSquare = seSquare + (ObserArray(i, 1) - CDbl(.Result)) ^ 2 'Partial sum squared regression
48234806
stSquare = stSquare + (averageY - ObserArray(i, 1)) ^ 2 'Partial total sum of squares
48244807
Next i
48254808
Rsquared = Round(1 - seSquare / stSquare, 4)
@@ -8037,7 +8020,7 @@ End Function
80378020
''' The program will iterate until the solution is approximated to 9
80388021
''' significant digits or until 500 iterations are completed, whichever comes first.
80398022
''' </summary>
8040-
Private Function solve(ByRef expression As String, ByRef fName As String) As String
8023+
Private Function Solve(ByRef expression As String, ByRef fName As String) As String
80418024
Dim argsCount As Long
80428025
Dim tmpData() As String
80438026
Dim tmpEval As String
@@ -8097,10 +8080,10 @@ Private Function solve(ByRef expression As String, ByRef fName As String) As Str
80978080
tmpEval = e_ValueError
80988081
BuildErrMessage errMissingArgsOrTooManyArgs, d_lCurly & fName & d_rCurly
80998082
End Select
8100-
solve = tmpEval: Erase tmpData
8083+
Solve = tmpEval: Erase tmpData
81018084
Exit Function
81028085
err_Handler:
8103-
solve = e_ValueError
8086+
Solve = e_ValueError
81048087
BuildErrMessage errEvalError, d_lCurly & fName & d_rCurly & " | Error#: " & err.Number & d_Space & _
81058088
d_lParenthesis & err.Description & d_rParenthesis
81068089
End Function
@@ -9088,7 +9071,7 @@ Private Function Zero(ByRef expression As String, ByRef fName As String) As Stri
90889071
Dim LB As Long, UB As Long
90899072

90909073
On Error GoTo err_Handler
9091-
tmpData() = Split(expression, P_SEPARATORCHAR)
9074+
tmpData() = SplitArgs(expression)
90929075
LB = LBound(tmpData)
90939076
UB = UBound(tmpData)
90949077
argsCount = UB - LB + 1

0 commit comments

Comments
 (0)