Post Reply 
All decimal digits of reals in CAS
04-11-2015, 02:43 AM (This post was last modified: 04-11-2015 03:42 AM by compsystems.)
Post: #5
RE: "dec": All decimal digits of reals in CAS
thanks Han Wink

versión 1 in tibasic ti68k
Code:
 
define dec(x)=floor(log(abs(x)))

version 2 in tibasic ti68k
Code:
 
define dec(x)=int(log(abs(x)))

version3 in tibasic ti68k with solve cmd
Code:
 
define dec(x)=floor(right(solve(10^expo=abs(x),expo)))

another samples
dec(e) => "2.7182818284590410939927096478641033172607421875"
dec(√(2)) "1.4142135623730922588947578333318233489990234375"
always returns ~50 digits

Joe Horn, please add at the beginning of your code, check flag should be in exact mode, otherwise always returns until 50 digits

in tibasic is
Code:
setMode("exact/approx","exact")

Another possible improvement is to support complex numbers, operating in the imaginary part and real part separately

in tibasic some commands are extended to the field of complex

sample

fpart(1.234+5.6789*i) => 0.234+0.6789*i
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: "dec": All decimal digits of reals in CAS - compsystems - 04-11-2015 02:43 AM



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