and modify the code to work me with complex roots
thank you
- Code: Select all
Define LibPub f1_4_met_gen(expr1,var)=
Func
:Local mat1,mat2
:mat1:=f1_3_met_gen(expr1,var)
:Local ii,tam
:tam:=dim(mat1)[1]
:mat2:=0
:If mat1[1,1]="*" Then
: For ii,1,tam
: If mat1[ii,1]="*" Then
: If string(mat2)="0" Then
: mat2:={part(mat1,ii)}
: ElseIf string(mat2)≠"0" Then
: mat2:=a_r_m(mat2,{part(mat1,ii)})
: EndIf
: EndIf
: EndFor
: tam:=dim(mat2)[1]
: mat1:=0
: For ii,1,tam
: If buscar_var(mat2[ii,2],var)>0 Then
: If string(mat1)="0" Then
: mat1:={part(mat2,ii)}
: ElseIf string(mat1)≠"0" Then
: mat1:=a_r_m(mat1,{part(mat2,ii)})
: EndIf
: EndIf
: EndFor
: tam:=dim(mat1)[1]
: mat2:=0
: For ii,1,tam
: If buscar_var(mat1[ii,2],var)>0 Then
: If string(mat2)="0" Then
: mat2:={part(mat1,ii)}
: ElseIf string(mat2)≠"0" Then
: mat2:=a_r_m(mat2,{part(mat1,ii)})
: EndIf
: EndIf
: EndFor
: tam:=dim(mat2)[1]
: Local list1
: list1:={mat2[tam,2]}
: For ii,1,tam
: list1[ii+1]:=mat2[ii,3]
: EndFor
: Return list1
:Else
: Return {expr1}
:EndIf
:EndFunc