Post Reply 
QPI: convert decimal to p/q, ln(p/q), p/q*pi, e^(p/q), or sqrt(p/q)
02-12-2017, 04:30 AM (This post was last modified: 02-12-2017 02:40 PM by Han.)
Post: #12
RE: QPI: convert decimal to p/q, ln(p/q), p/q*pi, e^(p/q), or sqrt(p/q)
For symbolic expressions you can use this:

Code:
#cas
qpif(f):=
begin
  local j,n,g,r;
  if (type(f) <> DOM_SYMBOLIC) then return(f); end;

  n:=dim(f)+1;

  for j from 2 to n do

    g:=f[j];
    if (type(g) == DOM_FLOAT) then
      r:=QPI(g);
      f[j]:=r;
    end;
    if (type(g) == DOM_SYMBOLIC) then
      r:=qpif(g);
      f[j]:=r;
    end;
  end;
  return(f);
end;
#end

When I have more time I may write a version that handles all known object types. But right now I am focusing on other projects.

   

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: QPI: convert decimal to p/q, ln(p/q), p/q*pi, e^(p/q), or sqrt(p/q) - Han - 02-12-2017 04:30 AM



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