用变量解R中的联立方程

时间:2018-12-13 20:27:14

标签: r solver differential-equations equation-solving simultaneous

我需要求解一个包含四个方程的系统,并求解(Alg,Blg,C,D)..其他仅仅是变量。

Sub UsingCollection()
    Dim cUnique As Collection
    Dim Rng As Range, r As Long
    Dim Cell As Range
    Dim sh As Worksheet
    Dim vNum As Variant

    Set sh = ThisWorkbook.Sheets("Sheet1")
    Set ws = Sheets("Sheet2")
    Set Rng = ws.Range("C2:C" & ws.Cells(ws.Rows.Count, "C").End(xlUp).Row)
    Set cUnique = New Collection

    On Error Resume Next
    For Each Cell In Rng.Cells
        cUnique.Add Cell.Value, CStr(Cell.Value)
    Next Cell
    On Error GoTo 0

    For Each vNum In cUnique
        r = Cells(Rows.Count, "A").End(xlUp).Row + 1
        Range(Cells(r, 1), Cells(r + 1, 1)).Value = vNum

    Next vNum

End Sub

所以我想求解{dAlg = 0,dBlg = 0,dC = 0,dD = 0},然后找出所有可能的解决方案组合。

我不确定如何使用Solve程序包在R上执行此操作(因为我发现examples似乎适用于更平凡的方程式)。但是当我使用另一个程序包时,我得到以下答案。我想在R中达到同样的效果

dAlg = (ab*D + a1*f1*D*Alg*Blg + a2*f2*D*Alg*C)/e1 - m1*Alg;
dBlg = (f11*D*Blg)/eB - f1*Alg*Blg - mp*Blg;
dC = (f22*D*C)/eC - f2*Alg*C - mp*C;
dD = (f*R/(h + R)) - r*D - ab*D - a1*f1*D*Alg*Blg - f11*D*Blg - 
   a2*f2*D*Alg*C-f22*D*C;

0 个答案:

没有答案