Post Reply 
CAS precision
10-12-2015, 07:19 PM
Post: #1
CAS precision
Does a CAS program behave like built-in CAS commands in the way it handles floating point numbers and intermediate results?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-13-2015, 06:44 AM
Post: #2
RE: CAS precision
Yes, it should.
Find all posts by this user
Quote this message in a reply
10-16-2015, 03:16 PM (This post was last modified: 10-16-2015 03:21 PM by Han.)
Post: #3
RE: CAS precision
Does using return(param) within a subroutine truncate any digits? One of the issues I have found is that matrix multiplication (row vector times column vector) gives me a slightly different result than calling a subroutine that does the multiplication and returns the inner product (the former is more accurate than the latter it seems). That is, t:=b*v; seems more accurate in the long run (which I use later on to for something else) than t:=inprod(b,v); where inprod(); is a cas routine whose code is:

Code:
inprod(b,v):=
BEGIN
  local d,k;
  local s;

  d:=dim(v);
  s:=0;
  d:=d[1];

  for k from 1 to d do
    s:=s + b[1,k]*v[k,1];
  end;
  return(s);
END;

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-17-2015, 04:05 PM
Post: #4
RE: CAS precision
This might happen because the intermediate conversions double <-> giac::gen are not exactly the same in both processes. Every time a double is stored in a giac::gen, the 5 less significant bits are replaced by the type field, and in the other direction the 5 less significant bits are set to 0.
Find all posts by this user
Quote this message in a reply
Post Reply 




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