Post Reply 
The new dfc and dfc2f functions in action
01-10-2018, 02:07 PM (This post was last modified: 01-10-2018 02:09 PM by DrD.)
Post: #3
RE: The new dfc and dfc2f functions in action
I tried this:

Code:

#cas
edfc(nbr1:=e,nbr2:=sqrt(7.389)):=
begin  
  LOCAL n;
  M0:=dfc(nbr1);
  M1:=dfc(nbr2);
  M2:=MAX(M0,M1)-MIN(M0,M1);

  n:=POS(mat2list(map(M2,(x)->x>0)),1);  // Probably a better way to find a non-zero element in vector?

  L1:=sub(M0,1,n);
  L2:=sub(M1,1,n); 

  IF L1(n)<=L2(n) THEN
    L1(n):=L1(n)+1;
    n:=dfc2f(L1);
  ELSE
    L2(n):=L2(n)+1;
    n:=dfc2f(L2); 
  END;

  return n;
end;
#end

edfc(); // uses defaults: [ e,sqrt(7.389) ) ==> 1071/394 = 2.71827411168

edfc(0.7965, 0.7975); // From first example: ==> 47/59 = 0.796610169492


This is just a quick program push out, not completely tested!!

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: The new dfc and dfc2f functions in action - DrD - 01-10-2018 02:07 PM



User(s) browsing this thread: 1 Guest(s)