Post Reply 
Existing CAS commands --> Prime discussion
09-08-2017, 03:38 PM (This post was last modified: 08-03-2018 10:35 PM by compsystems.)
Post: #21
RE: Existing CAS commands --> Prime discussion
So what solution is feasible?
improve the operating system, create another type of library?
or best a new hardware with a bigger screen, more memory, a better processor
Find all posts by this user
Quote this message in a reply
09-08-2017, 03:47 PM
Post: #22
RE: Existing CAS commands --> Prime discussion
(09-08-2017 03:38 PM)compsystems Wrote:  So what solution is feasible?

We'll just need to talk to the GNU people and get them to re-license it as closed...

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
10-30-2017, 02:19 PM (This post was last modified: 10-30-2017 05:40 PM by salvomic.)
Post: #23
RE: Existing CAS commands --> Prime discussion
(08-02-2017 01:57 PM)Eddie W. Shore Wrote:  Would the Fresnel functions S(x) and C(x) be a problem to implement? What about the elliptical integrals?

...

after some months... I vote also for Fresnel and Elliptical integrals, hoping their inclusion inside the CAS by default Smile

Waiting for them (please!), in the meantime, I would help proposing something, still rough, however...

Please, for Elliptical integrals, help me to developing a control detection for the program here in the Software section (my try for Fresnel is here, also help me for that one, thank you).

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-21-2018, 03:49 PM (This post was last modified: 07-28-2018 07:17 PM by compsystems.)
Post: #24
RE: Existing xCAS commands --> Prime discussion
nodisp cmd, although this is not a symbolic engine command, it would fall into the category of system command.

Example:
nodisp(A:=ranm(50,50))

Benefit for the current user:

1: Quick history exploration by not placing the object in the history, especially when working with large arrays.

----

A=B is converted into the list [A,B]

equal2list(x=3) returns {x,3}
Find all posts by this user
Quote this message in a reply
01-21-2018, 07:46 PM
Post: #25
RE: Existing CAS commands --> Prime discussion
My Dad was an engineer and one of his adages, which I think was an engineering philosophy, was that the better is the enemy of the good. We can tinker forever but the longer you tinker the more apt you are to increase complexity and problems. In other words, at some point you say 'good enough' and implement.
Find all posts by this user
Quote this message in a reply
08-03-2018, 10:29 PM
Post: #26
RE: Existing CAS commands --> Prime discussion
Please include the autosimplify(#) xcas command to set or not the simplification

In the following code the line,

autosimplify(2); // nop=none, 1=regroup, 2=simplify

is not yet interpreted on hp-prime

When changing the flag autosimplify(#), change the output please check the following code in xcas, varying the autosimplify(#) argument

PHP Code:
#cas
        
test_simplify_flag():=
    
BEGIN
        
        local  list0
,expr0;
        
local xy;
        
assumexsymbol ); // purge(x);
        
assumeysymbol ); // purge(y);
        
        
autosimplify(2); // nop=none, 1=regroup, 2=simplify

        
print;
        print(
"Solving a system of two equations.  
Solve the  following system  [ y=x², y=2x+3 ]"
);

        
list0 := [ x^22*]; print(list0);

        print(
""); print("> substitute y = x² in y = 2·x + 3");
        
expr0 := subst(list0(2),list0(1)); print(expr0);

        print(
""); print("> substract 2·x + 3");
        
expr0 := expr0-(2*3); print(expr0);
        Return 
expr0;
    
END;
#end 
Find all posts by this user
Quote this message in a reply
09-23-2018, 01:24 AM (This post was last modified: 09-23-2018 02:03 AM by compsystems.)
Post: #27
RE: Existing CAS commands --> Prime discussion
Hello, to control the CAS modes, it is necessary cas_setup( ) cmd

cas_setup(arguments) Is the command for initialized the cas,

arguments:
1: Approximate mode, // int 1/0, exact (dft) or approx mode.

2: Complex var, // int 1/0, variables are complex or real (dft).

3: Complex, // int 1/0, complex mode (dft 0).

4: Angle, // int 1/0, Randian (dft) or Degree angle mode.

5: Float format //
Standard: 160 (dft)
Scientific: 161
Engineer: 162

6: [Epsilon, probability]// [Real, Real],

6.1: Epsilon, Number with absolute value less than epsilon can be coerced to 0

6.2 maximal probability of a wrong answer for non-deterministic algorithms. Set to 0 for deterministic algorithms only.

7: Digitis, // int, Digits (12 dft)

8: [Threads/Eval/Prog/recurs] //[Int, Int, Int] //

8.1 Threads // Maximal number of threads in parallel

8.2 Recurs: Number of embedded function calls allowed (100 dft)

8.3 Prog: Number of embedded variable names replacement in program evaluation (1 or 0 for default eval level)

8.4 Eval: Number of embedded variable names replacement in interactive evaluation (25 dft)

9: increasing power flag // int 1/0, Show polynomials In increasin or decreasing order (0 dft)

10: Sqrt // int 1/0, Factor 2nd order poly using sqrt (1 dft)

11: All trig sol. // int 1/0, Solver: principal solution vs all solutions (0 dft)

12: ?

for example when executing cas_setup() returns
=>
[0,
0,
0,
1,
160,
[1e-12,1e-15],
12,
[1,100,0,25],
0,
1,
0,
1]
Find all posts by this user
Quote this message in a reply
09-24-2018, 12:08 AM (This post was last modified: 09-24-2018 12:09 AM by CyberAngel.)
Post: #28
RE: Existing CAS commands --> Prime discussion
(09-08-2017 03:38 PM)compsystems Wrote:  So what solution is feasible?
improve the operating system, create another type of library?
or best a new hardware with a bigger screen, more memory, a better processor
Emphasis mine

I'm hoping for a new hardware:
HP Mersenne
but
I also understand what TW is saying about the GPL.
VPN <silently weeping>
Find all posts by this user
Quote this message in a reply
09-25-2018, 12:27 AM
Post: #29
RE: Existing CAS commands --> Prime discussion
(08-07-2017 08:28 PM)Wes Loewer Wrote:  
(06-26-2017 06:40 PM)Tim Wessman Wrote:  Finally, items that fail to pass the "only Joe is interested in it" test: :-P

Joe really likes him some continued fractions. Yessireee that man do like them. Smile

Me too! I would love to have this available on a calculator if for nothing else than have students experiment with it. I would certainly use it more than a lot of other commands. (What do the letters dfc stand for anyway?)

[I feel like Lot arguing with God: "What if there are only 10 righteous people who want this command?" "For the sake of 10 I will not destroy the command." Wink ]

Just a few days ago, a former student sent me a problem that involves a continued fraction of sorts and I haven't been able to figure it out.

I would like to see the continued fraction functions included also.
Find all posts by this user
Quote this message in a reply
09-25-2018, 03:34 AM
Post: #30
RE: Existing CAS commands --> Prime discussion
(09-25-2018 12:27 AM)bobager Wrote:  I would like to see the continued fraction functions included also.

You'll be happy to know that they have been implemented for a while now. Try them in CAS:

dfc(225/157) --> [1 2 3 4 5]
dfc2f(1,2,3,4,5) --> 225/157

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
10-27-2018, 01:05 AM
Post: #31
RE: Existing CAS commands --> Prime discussion
Is the analytic function Lambert W fully implemented?
(Laplace, etc)
Find all posts by this user
Quote this message in a reply
10-27-2018, 01:36 AM
Post: #32
RE: Existing CAS commands --> Prime discussion
hello in the following article shows some screenshots, where the history is used as a document file, the PC version of Xcas can incorporate comments in the history / * ... * /, I think this is very important to show contained in the classroom.

Using ClassPad-technology in the education of students of electrical
engineering (Fourier- and Laplace-Transformation)
Source: http://math.unipa.it/~grim/21_project/Paditz469-474.pdf

un sample on xcas

PHP Code:
/* File: Xcas Text */
/* Abstract: This document explains how to run efficiently CAS on HP Prime calculators. 
HP Prime CAS is an adapted version of the Giac/Xcas Computer Algebra System (CAS) for this calculator: */
/* Source: https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasioen.html */

/* 3. Common CAS commands */
/* [Tools] [CAS] [1: Algebra] */
/* 3.1 Expand and factor */
/* factor menu: [Tools] [CAS] [1] [4: Factor] */
/* ** factor: factorization. Shortcut cmd =>* (> key menu, then *), for example */
factor(x^4-1
x^4-1=>*
/* run cfactor to factor over Complex */
cfactor(x^4-1)
/* partfrac menu: [Tools] [CAS] [1] [7:Partial Fraction] */
/* ** partfrac: expands a polynomial or performs partial fraction expansion over a fraction. Shortcut =>+ (> key menu, then + key), for example */
partfrac((x+1)^4)
(
x+1)^4=>+ 
autosimplify(0):;partfrac(1/(x^4-1)) //(1/4)/(x-1) - (1/4)/(x+1) - (1/2)/(x²-1)
autosimplify(0):;1/(x^4-1)=>+
/* simplify menu: [Tools] [CAS] [1] [1: Simplify] */
/* ** simplify: tries to simplify an expression. Shortcut =>/ (> key menu, then /), for example */
simplify(sin(3x)/sin(x))
sin(3x)/sin(x)=>/ // Error syntax hp-prime when entry: textBook (pretty print or 2D)
/* ** ratnormal: rewrite as an irreducible fraction */
ratnormal((x^2-1)/(x^3-1))

/* 3.2 Calculus */
/* [Tools] [CAS] [2: Calculus] */
/* diff menu: [Tools] [CAS] [2] [1: Differentiate ] */
/* ** derivative. Shortcut ' (Shift [9] ') for derivative with respect to x, example */
angle_radian(1):;diff(sin(x),x
sin(x)'
/* For n th-derivative, add n, for example 3rd derivative */
diff(sin(x^2),x,3)
diff(sin(x²),x,3)
diff(sin(x³),x,3)

/* integrate menu: [Tools] [CAS] [2] [2: Integrate] */
/* ** integrate: antiderivative (1 or 2 arguments) for example */
integrate(sin(x)) 
integrate(1/(t^4-1),t) 
integrate(sin(x)^4,x,0,pi) 
/* For an approximate computation, enter one boundary as an approx number, for example */
integrate(sin(x)^4,x,0.0,pi) 

/* limit menu: [Tools] [CAS] [2] [3: Limit] */
/* ** limit of an expression. Example */
limit((cos(x)-1)/x^2,x=0) 

/* ** tabvar : table of variations of an expression. for example */
tabvar(x^3-7x+5) 
ClrIO:; plotfunc(x^3-7x+5,x,-4,4):;
DispG

/* taylor and series menu: [Tools] [CAS] [2] [8: Limits] [2: Taylor] */
/* ** taylor: Taylor expansion or asymptotic serie expansion, for example */
taylor(sin(x),x=0,5)
/* Add polynomial if you do not want to have the remainder term */
taylor(sin(x),x=0,5,polynom)

/* sum menu: [Tools] [CAS] [2] [5: Summation] */
/* ** sum: discrete summation, for example */
sum(k^2,k,1,n) 
/* computes the sum and rewrites it factored. */
sum(k^2,k,1,n)=>* 

/* 3.3 Solvers */
/* solve menu: [Tools] [CAS] [3: Solve] */
/* ** solve: solve solves an equation exactly. Takes the variable to solve for as second argument, unless it is x, for example */
solve(t^2-1=0,t) 
solve(t^2-1=0,t,'
=') 
/* If exact solving fails, run fsolve for approx solving, either with an iterative method starting with a guess */
fsolve(cos(x)=x,x=0.0) 
/* or by dichotomy */
fsolve(cos(x)=x,x=0..1) 
/* For complex solutions, run csolve */
csolve(x^4-1=0,x,'
=') 

/* It is possible to restrict solutions using assumptions on the variable, for example */
assume(m>1) // then
solve(m^2-4=0,m) 
purge(m):; 
solve(m^2-4=0,m) 
/* ** solve can also solve (simple) polynomial systems, enter a list of equations as 1st argument and a list of variables as 2nd argument, for example intersection of a circle and a line: */
solve([x^2+y^2+2y=3,x+y=1],[x,y])
solve([x^2+y^2+2y=3,x+y=1],[x,y],'
=')
/* ** Run linsolve to solve linear systems. enter a list of equations as 1st argument and a list of variables as 2nd argument, example: */
linsolve([x+2y=3,x-y=7],[x,y])
/* ** Run desolve to solve exactly a differential equation. for example, to solve y'
=2y */
desolve(y'=2y)
/* Another example with an initial condition: */
desolve([y'
=2*y,y(0)=1],x,y// bug desolve([y'=2*y,y[0]=1],x,y)
/* ** Run odesolve for approx solving or plotode for a graphic representation of the approx. solution. */
/* ** rsolve solves some recurrence relations u(n+1)=f(un,..), for example to solve the arithmetico-geometric recurrence */
rsolve(u(n+1)=2*u(n)+3,u(n),u(0)=1)

/* 3.4 Arithmetic */
/* When required, the distinction between integer arithmetic and polynomial arithmetic is done by a prefix i for integer commands. For example ifactor for integer factorization and factor for polynomial factorization */
/* (or cfactor for polynomial factorization over Complex). Some commands work for integers and polynomials, like gcd and lcm */
/* 3.4.1 IInteger */
/* quotient menu: [Tools] [CAS][5: Integer][7: Division][1: Quotient] */
/* ** iquo(a,b), irem(a,b) quotient and remainder of euclidean division of two integers. */
iquo(23,13),irem(23,13)
/* ** isprime(n) checks whether n is prime. This is a probabilisitic test for large values of n */
isprime(2^64+1
/* ** ifactor(n) factorizes an integer (not too large, since algorithms used are trial division and Pollard-ρ, there is no space left in memory for quadratic sieve), for example */
ifactor(2^64+1
2^64+1
approx
(ifactor(2^64+1))
/* ** gcd(a,b), lcm(a,b) GCD and LCM of two integers or polynomials. */
gcd(25,15),lcm(25,15
gcd(x^3-1,x^2-1),lcm(x^3-1,x^2-1)
/* ** iegcd(a,b) returns 3 integers u,v,d such that a·u+b·v=d where d is the GCD of a and b, |u| and |v|<|a|. */
u,v,d:=iegcd(23,13); 23u+13v 
purge
(u,v,d):;
/* ** ichinrem([a,m],[b,n]) returns (if possible) c such that c=a (mod m) and c=b (mod n) (if m are n coprime, c exists). */
c,n:=ichinrem([1,23],[2,13]);irem(c,23); irem(c,13
purge(c,n):;
/* ** powmod(a,n,m) returns a^n(mod m) computed by the fast modular powering algorithm */
powmod(7,22,23
/* ** asc converts a string to a list of ASCII code, char converts back a list to a string. These commands may be used to easily write cryptographic algorithms with string messages. */
asc("A"), asc("123+4")

/* 3.4.2 Polynomials */
/* From catalog, select Polynomials. The default variable is x, otherwise you can specify it as last optional argument. For example degree(x²·y) or degree(x²·y,x) return 2, degree(x²·y,y) returns 1. */
/* ** coeff(P,n) coefficient of x^n in P, lcoeff(P) leading coefficient of P, for example */
P_:=x^3+3xcoeff(P_,1); lcoeff(P_)
purge(P_):;
/* ** degre(P) degree of polynomial P */
degree(x^3)
/* ** quo(P,Q), rem(P,Q) quotient and remainder of euclidean division of P by Q */
P_:=x^3+7x-5Q_:=x^2+xquo(P_,Q_); rem(P_,Q_

purge(P_,Q_):;
/* ** proot(P): approx. roots of P (all roots, real and complex) */
proot(x^5+x+1)

/* Graphic representation */
ClrIOpoint(proot(x^5+x+1)):;
DispG
/* ** interp(X,Y): for two lists of the same size, returns the interpolating polynomial P such that P(X_i)=Y_i. */
X_,Y_:=[0,1,2,3],[1,-3,-2,0];P_:=interp(X_,Y_)=>+
/* Graphic representation */
ClrIO:; scatterplot(X_,Y_); plotfunc(P_,x,-1,4):;
/* ** resultant(P,Q) : resultant of polynomials P and Q */
purge(X_,Y_):; P_:=x^3+7x-5Q_:=x^2+xresultant(P_,Q_)
purge(P_,Q_):;
/* ** hermite(x,n): n-th Hermite polynomial (orthogonal for the density e^(−x²)dx on R) */
hermite(3)
/* ** laguerre(x,n,a): n-th Laguerre polynomial */
laguerre(4)
/* ** legendre(x,n) */
legendre(4)
/* ** tchebyshev1(n) and tchebyshev2(n) */
tchebyshev1(3)
tchebyshev2(3)

/* 3.5 Linear algebra, vectors, matrices */
/* Xcas does not make distinction between vectors and lists. For example, */
v:=[1,2]; w:=[3,4// defines 2 vectors v and w, then dot will compute the scalar product of v and w
dot(v,w)

/* .A matrix is a list of lists of the same size. You can enter a matrix element by element using the matrix editor (shift-4 or 2D template [c/units] key). 
Enter a new variable name to create a new matrix or the name of an existing variable to edit a matrix. 
For small matrices, it is also convenient to enter them directly in the commandline, for example to define */
A_:=[[1,2],[3,4]]
/* or */
[[1,2],[3,4]]=>A_
index
:=0
/* If a matrix is defined by a formula, then it’s better to use the matrix command, for example: */
matrix(2,2,(j,k)->1/(j+k+1)) 
/* returns the matrix where coefficient line j and column k is 1/(j+k+1) (beware, indices begin at 0). */
/* Run idn(n) to get the identity matrix of order n and ranm(n,m,law,[parameter]) to get a matrix with random coefficients with dimensions n,m. for example */
/* Line 1
Line 2
Line 3 */
U_:=ranm(4,4,uniformd,0,1
N_:=ranm(4,4,normald,0,1
purge(U_,N_):;

/* For basic arithmetic on matrices, use keyboard operators (+ - *, inverse). Otherwise, open catalog and select [Tools] [Math][7: Matrix] */
/* eigenvalues and eigenvectors of matrix A. */
A_:=[[1,2],[3,4]]; eigenvals(A// [Tools] [Math][7: Matrix][6: Advenced][1: Eigenvalues]
eigenvects(A_// [Tools] [Math][7: Matrix][6: Advenced][1: Eigenvectors]
/* finds the Jordan normal form of matrix A, returns matrices P and D such that P^−1·A·P=D, with D upper triangular (diagonal if A is diagonalizable) */
P_,D_:=jordan(A_
purge(P_,D_):;
/* computes matrix A to the k-th power, where k is symbolic. */
Ak:=matpow(A_,k
/* ** rref: row reduction to echelon form */
rref(A_)
/* ** lu: LU factorization of matrix A, returns a permutation P and two matrices L (lower) and U (upper) such that P·A=L·U. The result of */
P_,L_,U_:=lu(A_)
linsolve(P_,L_,U_,v)

/* to solve a system A·x=b by solving two triangular systems (in O(n²) instead of O(n³)). */
/* ** qr Q·R factorization of matrix A, Q is orthogonal and R upper triangular, A=Q·R */
/* ** svd(A) singular value decomposition of matrix A returns U orthogonal, S vector of singular values, Q orthogonal such that A=U·diag(S)·tran(Q). 
The ratio of the largest and the smallest singular value of S is the condition number of A relative to the Euclidean norm */
svd(A_)
purge(A_,P_,L_,U_,v,w):;
/* 4 Probabilities and statistics
4.1 Random numbers */
/* [Tools] [Math][5: Probability][4: Random][1: Number] */
rand() // (real in [0,1])
n:=6:; randint(n)
ranv(10,normald,0,1)
purge(n):;
/* 5 Graphics */
/* [Tools] [CAS][7: Plot][1: Function] */
/* ** plot(f(x),x=a..b) plot expression f(x) for x [a,b]. Discretization option: xstep=, for example */
ClrIOplotfunc(x^2,x=-4..4,xstep=1):;
DispG
/* Default is 384 evaluations per plot (one per horizontal pixel). */
/* ** plotseq(f(x),x=[u0,a,b]) webplot for a recurrent sequence u_(n+1)=f(u_n) of first term u_0, for example if u(n+1)=√(2+u_n),u_0=6, with a plot on [0,7] */
ClrIOplotseq(sqrt(2+x),x=[6,0,7]):; // color ?
DispG
/* ** plotparam([x(t),y(t)],t=tm..tM) parametric plot (x(t),y(t)) for t © [tm,tM]. Discretization option: tstep=. Example */
ClrIOplotparam([sin(2t),cos(3t)],t,0,2*pi):;
DispG

/* plotpolar(r(theta),theta=a..b) polar plot of r(θ) for θ © [a,b], for example */

ClrIOplotpolar(sin(3*theta),theta,0,2*pi):;
DispG
ClrIO
l:=ranv(500,normald,0,1); histogram(l,-4,0.25):; plotfunc(normald(x),x,-4,4):;

purge(l):;
ClrIOplotfield(sin(t*y),[t=-3..3,y=-3..3],plotode=[0,1]):;

ClrIOplotfunc(sin(x),x,display=red):;
ClrIOplotfunc(cos(x),x,color=green):;
/* 6 Programs */
/* Example : function defined by an algebraic expression nom_fonction(parametres):=expression for example simple confidence interval for a frequency p in a sample of size N */
F1_(P_,N_):=[P_-1/sqrt(N_), P_+1/sqrt(N_)]:;
/* test */
F1_(0.4,30)
/* Second example : more precise confidence interval for a frequency p in a sample of size N: */
f(P_,N_):=[P_-1.96*sqrt(P*(1-P_)/N_),P_+1.96*sqrt(P_*(1-P_)/N_)]:;

function 
f1(P,Nlocal DD:=1.96*sqrt(P*(1-P)/N); return [P-D,P+D]; ffunction

Source:https://www-fourier.ujf-grenoble.fr/~parisse/casio/khicasioen.html
Find all posts by this user
Quote this message in a reply
10-27-2018, 03:25 PM
Post: #33
RE: Existing CAS commands --> Prime discussion
(10-27-2018 01:05 AM)CyberAngel Wrote:  Is the analytic function Lambert W fully implemented?
(Laplace, etc)

No. Patiently waiting...
Find all posts by this user
Quote this message in a reply
11-27-2018, 06:01 PM
Post: #34
RE: Existing CAS commands --> Prime discussion
Hello the float2rational giac command is not included on the hpPrime CAS

exact(0.324532453245) ↵1100186656/3390066679
float2rational(0.324532453245) ↵ 295/909
Find all posts by this user
Quote this message in a reply
11-27-2018, 06:43 PM
Post: #35
RE: Existing CAS commands --> Prime discussion
(11-27-2018 06:01 PM)compsystems Wrote:  Hello the float2rational giac command is not included on the hpPrime CAS

exact(0.324532453245) ↵1100186656/3390066679
float2rational(0.324532453245) ↵ 295/909

According to the XCAS documentation, the float2rational() function is the same as the exact() function. The problem here is that you have to set their precision yourself by adjusting the value of epsilon. To simulate Home's fraction button in CAS:

epsilon:=5E-12
exact(0.324532453245) --> 295/909

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
11-28-2018, 10:28 PM
Post: #36
RE: Existing CAS commands --> Prime discussion
(01-21-2018 07:46 PM)harryp Wrote:  My Dad was an engineer and one of his adages, which I think was an engineering philosophy, was that the better is the enemy of the good. We can tinker forever but the longer you tinker the more apt you are to increase complexity and problems. In other words, at some point you say 'good enough' and implement.

LOL! My dad used to say that "good enough" is the enemy of the excellent!

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
11-28-2018, 11:35 PM (This post was last modified: 11-28-2018 11:47 PM by compsystems.)
Post: #37
RE: Existing CAS commands --> Prime discussion
(11-28-2018 10:28 PM)toml_12953 Wrote:  
(01-21-2018 07:46 PM)harryp Wrote:  My Dad was an engineer and one of his adages, which I think was an engineering philosophy, was that the better is the enemy of the good. We can tinker forever but the longer you tinker the more apt you are to increase complexity and problems. In other words, at some point you say 'good enough' and implement.

LOL! My dad used to say that "good enough" is the enemy of the excellent!
+1

//

in GIAC
The output value seems to vary according to the value of epsilon, but do not always yield the same value, therefore it is concluded that exact() and float2rational() are different and not synonymous commands

epsilon:=1E-12:; exact(0.324532453245); float2rational(0.324532453245) ↵ returns
"Done", 1094980201/3374023738, 295/909
Find all posts by this user
Quote this message in a reply
11-29-2018, 01:47 AM
Post: #38
RE: Existing CAS commands --> Prime discussion
(11-28-2018 11:35 PM)compsystems Wrote:  The output value seems to vary according to the value of epsilon, but do not always yield the same value, therefore it is concluded that exact() and float2rational() are different and not synonymous commands

epsilon:=1E-12:; exact(0.324532453245); float2rational(0.324532453245) ↵ returns
"Done", 1094980201/3374023738, 295/909

But if you use epsilon:=5E-12, as suggested by Joe to get the same results as Home's fraction button, exact() provides the same result as float2rational(). The magnitude of epsilon controls how far the reduction is continued.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-29-2018, 12:30 PM (This post was last modified: 11-29-2018 12:31 PM by compsystems.)
Post: #39
RE: Existing CAS commands --> Prime discussion
(11-29-2018 01:47 AM)rprosperi Wrote:  But if you use epsilon:=5E-12, as suggested by Joe to get the same results as Home's fraction button, exact() provides the same result as float2rational(). The magnitude of epsilon controls how far the reduction is continued.

It is true, but I think that this command was not included (hpp cas) because apparently it is mentioned as "synonymous" and with an example that is not fulfilled implies that they are not identical commands, therefore, this important command must be included.

by ejp I wish to show step by step the conversion of a periodic fractional number to a rational number
PHP Code:
'f=0.324532453245' // eq1
// eq1 * 10000
10000*(f=0.324532453245)
10000*3245.32453245 // eq2
// eq2 - eq1
(10000*3245.32453245) - (f=0.324532453245)
(
9999*f) = 3245
f
=3245/9999
solve
((9999*f) = 3245,f,'='↵ set[295/909

now with exact & float2rational

epsilon:=1E-12:;
exact(0.324532453245) ↵1100186656/3390066679
float2rational(0.324532453245) ↵ 295/909
Find all posts by this user
Quote this message in a reply
11-29-2018, 05:18 PM (This post was last modified: 11-29-2018 05:26 PM by ijabbott.)
Post: #40
RE: Existing CAS commands --> Prime discussion
Looking at the Giac/Xcas source code for exact and float2rational, they follow different code paths, but do similar things. The main functional difference seems to be that exact imposes a minimum epsilon value of 1e-14, whereas float2rational imposes a minimum epsilon value of 1e-11.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 




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