login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

This page is set to execute \begin{axiom}... \end{axiom} commands using FriCAS. See also FriCASIntegration.

fricas
(1) -> )version
"FriCAS 1.3.10 compiled at Wed 10 Jan 02:19:45 CET 2024"

Any comments added here use this version of FriCAS.

fricas
solve(s=v*t+a*t^2/2,t)

\label{eq1}\left[{{{2 \  t \  v}+{a \ {{t}^{2}}}-{2 \  s}}= 0}\right](1)
Type: List(Equation(Fraction(Polynomial(Integer))))

fricas
radicalSolve(s=v*t+a*t^2/2,t)

\label{eq2}\left[{t ={\frac{-{\sqrt{{{v}^{2}}+{2 \  a \  s}}}- v}{a}}}, \:{t ={\frac{{\sqrt{{{v}^{2}}+{2 \  a \  s}}}- v}{a}}}\right](2)
Type: List(Equation(Expression(Integer)))

fricas
solve(v*t+a*t^2/2-s=0,t)

\label{eq3}\left[{{{2 \  t \  v}+{a \ {{t}^{2}}}-{2 \  s}}= 0}\right](3)
Type: List(Equation(Fraction(Polynomial(Integer))))

fricas
solve(v*t+a*t/2-s=0,t)

\label{eq4}\left[{t ={\frac{2 \  s}{{2 \  v}+ a}}}\right](4)
Type: List(Equation(Fraction(Polynomial(Integer))))

fricas
solve(v*t+a*t^2/2-s=0,t)

\label{eq5}\left[{{{2 \  t \  v}+{a \ {{t}^{2}}}-{2 \  s}}= 0}\right](5)
Type: List(Equation(Fraction(Polynomial(Integer))))

fricas
radicalSolve(p^3 - p + 1/10=0,p)

\label{eq6}\begin{array}{@{}l}
\displaystyle
\left[{
\begin{array}{@{}l}
\displaystyle
p = 
\
\
\displaystyle
{\frac{{{\left(-{3 \ {\sqrt{- 3}}}+ 3 \right)}\ {{\root{3}\of{\frac{{\sqrt{-{\frac{373}{3}}}}- 3}{60}}}^{2}}}- 2}{{\left({3 \ {\sqrt{- 3}}}+ 3 \right)}\ {\root{3}\of{\frac{{\sqrt{-{\frac{373}{3}}}}- 3}{6
0}}}}}
(6)
Type: List(Equation(Expression(Integer)))

fricas
R1 ==> Record(foo1: String, remLexs: List Integer)
Type: Void
fricas
R2 ==> Record(foo2: String, remLexs: List Integer)
Type: Void
fricas
r1: R1 := ["a", [1,2,3]]

\label{eq7}\left[{foo 1 = \verb#"a"#}, \:{remLexs ={\left[ 1, \: 2, \: 3 \right]}}\right](7)
Type: Record(foo1: String,remLexs: List(Integer))
fricas
r2: R2 := ["b", [5]]

\label{eq8}\left[{foo 2 = \verb#"b"#}, \:{remLexs ={\left[ 5 \right]}}\right](8)
Type: Record(foo2: String,remLexs: List(Integer))
fricas
r1.remLexs

\label{eq9}\left[ 1, \: 2, \: 3 \right](9)
Type: List(Integer)
fricas
r2.remLexs

\label{eq10}\left[ 5 \right](10)
Type: List(Integer)

fricas
)set output tex off
 
fricas
)set output algebra on
guessPRec [1, 0, 1, 1, 4, 10, 35, 120, 455, 1792, 7413, 31780, 140833, 641928, 3000361, 14338702, 69902535, 346939792, 1750071307, 8958993507, 46484716684, 244187539270, 1297395375129, 6965930587924]
(13) [ [ f(n): 2 2 (- n - 17 n - 72)f(n + 3) + (4 n + 30 n + 44)f(n + 2) + 2 2 (19 n + 113 n + 150)f(n + 1) + (14 n + 42 n + 28)f(n) = 0 , f(0) = 1, f(1) = 0, f(2) = 1] ]
Type: List(Expression(Integer))

fricas
guessRec([1,1,0,1,- 1,2,- 1,5,- 4,29,- 13,854,- 685])
2 (14) [[f(n): f(n + 2) + f(n + 1) - f(n) = 0, f(0) = 1, f(1) = 1]]
Type: List(Expression(Integer))

integrate(exp(x-x^2), x) --mariuszi28cg, Mon, 25 Sep 2017 20:14:29 +0000 reply
fricas
integrate(exp(x-x^2), x)
1 - 4 2 x - 1 +---+ %e erf(-------)\|%pi 2 (15) --------------------- 2
Type: Union(Expression(Integer),...)

fricas
1+1
(16) 2
Type: PositiveInteger?

2^3-2**3

2^3

fricas
2^3
(17) 8
Type: PositiveInteger?

fricas
2**3
There are no library operations named ** Use HyperDoc Browse or issue )what op ** to learn if there is any operation containing " ** " in its name.
Cannot find a definition or applicable library operation named ** with argument type(s) PositiveInteger PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

fricas
sqrt(2)^2-2
(18) 0
Type: AlgebraicNumber?

fricas
a:=sqrt(2)
+-+ (19) \|2
Type: AlgebraicNumber?
fricas
b:=sqrt(a)
+----+ | +-+ (20) \|\|2
Type: AlgebraicNumber?
fricas
b^2-a
(21) 0
Type: AlgebraicNumber?

fricas
f(a) == { local b=sqrt(a); b^2-a}
Line 1: f(a) == { local b=sqrt(a); b^2-a} ........A........B Error A: Missing mate. Error B: syntax error at top level Error B: Possibly missing a } 3 error(s) parsing

local needs to be on separate statement:

fricas
f(a) == { local b; b :=sqrt(a); b^2-a}
Type: Void
fricas
f(2)
fricas
Compiling function f with type PositiveInteger -> AlgebraicNumber 
(23) 0
Type: AlgebraicNumber?
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
(24) 0
Type: AlgebraicNumber?

fricas
[q,r]
(25) [q, r]
Type: List(OrderedVariableList([q,r]))

fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(2)
fricas
Compiling function f with type PositiveInteger -> AlgebraicNumber 
(27) 0
Type: AlgebraicNumber?
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
(28) 0
Type: AlgebraicNumber?

fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(2)
fricas
Compiling function f with type PositiveInteger -> AlgebraicNumber 
(30) 0
Type: AlgebraicNumber?
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
(31) 0
Type: AlgebraicNumber?
fricas
f(z)
fricas
Compiling function f with type Variable(z) -> Expression(Integer) 
(32) 0
Type: Expression(Integer)
fricas
f(%i)
fricas
Compiling function f with type Complex(Integer) -> Expression(
      Complex(Integer)) 
(33) 0
Type: Expression(Complex(Integer))

)display properties --aUser, Thu, 01 Feb 2018 15:08:53 +0000 reply
fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(2)
fricas
Compiling function f with type PositiveInteger -> AlgebraicNumber 
(35) 0
Type: AlgebraicNumber?
fricas
c:=f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
(36) 0
Type: AlgebraicNumber?
fricas
)display properties c
Properties of c : Value (has type AlgebraicNumber): 0

fricas
f(a) == ( local b; b:=sqrt(a); b^2 = a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void

fricas
f(a) == ( local b; b:=sqrt(a); b^2 = a)
1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(2)
fricas
Compiling function f with type PositiveInteger -> Equation(
      AlgebraicNumber) 
(39) 2 = 2
Type: Equation(AlgebraicNumber?)
fricas
f(%i)
fricas
Compiling function f with type Complex(Integer) -> Equation(
      Expression(Complex(Integer))) 
(40) %i = %i
Type: Equation(Expression(Complex(Integer)))
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> Equation(
      AlgebraicNumber) 
+-+ +-+ (41) \|2 = \|2
Type: Equation(AlgebraicNumber?)
fricas
f(2^(1/2))
+-+ +-+ (42) \|2 = \|2
Type: Equation(AlgebraicNumber?)
fricas
f(2^(1/3))
3+-+ 3+-+ (43) \|2 = \|2
Type: Equation(AlgebraicNumber?)

fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
(45) 0
Type: AlgebraicNumber?
fricas
)set output fortran
--------------------------- The fortran Option ----------------------------
Description: create output in FORTRAN format
)set output fortran is used to tell FriCAS to turn FORTRAN-style output printing on and off, and where to place the output. By default, the destination for the output is the screen but printing is turned off.
Syntax: )set output fortran <arg> where arg can be one of on turn FORTRAN printing on off turn FORTRAN printing off (default state) console send FORTRAN output to screen (default state) fp<.fe> send FORTRAN output to file with file prefix fp and file extension .fe. If not given, .fe defaults to .sfort.
If you wish to send the output to a file, you may need to issue this command twice: once with on and once with the file name. For example, to send FORTRAN output to the file polymer.sfort, issue the two commands
)set output fortran on )set output fortran polymer
The output is placed in the directory from which you invoked FriCAS or the one you set with the )cd system command. The current setting is: Off:CONSOLE f(sqrt(2))
(46) 0
Type: AlgebraicNumber?
fricas
)set output tex
----------------------------- The tex Option ------------------------------
Description: create output in TeX style
)set output tex is used to tell FriCAS to turn TeX-style output printing on and off, and where to place the output. By default, the destination for the output is the screen but printing is turned off.
Syntax: )set output tex <arg> where arg can be one of on turn TeX printing on off turn TeX printing off (default state) console send TeX output to screen (default state) fp<.fe> send TeX output to file with file prefix fp and file extension .fe. If not given, .fe defaults to .stex.
If you wish to send the output to a file, you may need to issue this command twice: once with on and once with the file name. For example, to send TeX output to the file polymer.stex, issue the two commands
)set output tex on )set output tex polymer
The output is placed in the directory from which you invoked FriCAS or the one you set with the )cd system command. The current setting is: Off:CONSOLE f(sqrt(2))
(47) 0
Type: AlgebraicNumber?
fricas
)set output script
--------------------------- The scripts Option ----------------------------
Description: show subscripts,... linearly
The scripts option may be followed by any one of the following:
yes no
The current setting is indicated within the list.
f(sqrt(2))
(48) 0
Type: AlgebraicNumber?

fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
(50) 0
Type: AlgebraicNumber?
fricas
)set output fortran on
f(sqrt(2))
R51=0
(51) 0
Type: AlgebraicNumber?
fricas
)set output tex on 
f(sqrt(2))
R52=0
(52) 0

\label{eq11}0(11)
Type: AlgebraicNumber?
fricas
)set output script on
--------------------------- The scripts Option ----------------------------
Description: show subscripts,... linearly
The scripts option may be followed by any one of the following:
yes no
The current setting is indicated within the list.
Your value on is not among the valid choices.
f(sqrt(2))
R53=0
(53) 0

\label{eq12}0(12)
Type: AlgebraicNumber?

fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
R55=0
(55) 0

\label{eq13}0(13)
Type: AlgebraicNumber?
fricas
)set output fortran console
f(sqrt(2))
R56=0
(56) 0

\label{eq14}0(14)
Type: AlgebraicNumber?
fricas
)set output tex console
f(sqrt(2))
R57=0
(57) 0

\label{eq15}0(15)
Type: AlgebraicNumber?
fricas
)set output script console
--------------------------- The scripts Option ----------------------------
Description: show subscripts,... linearly
The scripts option may be followed by any one of the following:
yes no
The current setting is indicated within the list.
Your value console is not among the valid choices.
f(sqrt(2))
R58=0
(58) 0

\label{eq16}0(16)
Type: AlgebraicNumber?

fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
R60=0
(60) 0

\label{eq17}0(17)
Type: AlgebraicNumber?
fricas
)set output fortran on
 
fricas
)set output fortran console
f(sqrt(2))
R61=0
(61) 0

\label{eq18}0(18)
Type: AlgebraicNumber?
fricas
)set output tex on 
 
fricas
)set output tex console
f(sqrt(2))
R62=0
(62) 0

\label{eq19}0(19)
Type: AlgebraicNumber?
fricas
)set output script on
--------------------------- The scripts Option ----------------------------
Description: show subscripts,... linearly
The scripts option may be followed by any one of the following:
yes no
The current setting is indicated within the list.
Your value on is not among the valid choices.
fricas
)set output script console
--------------------------- The scripts Option ----------------------------
Description: show subscripts,... linearly
The scripts option may be followed by any one of the following:
yes no
The current setting is indicated within the list.
Your value console is not among the valid choices.
f(sqrt(2))
R63=0
(63) 0

\label{eq20}0(20)
Type: AlgebraicNumber?

fricas
f(a) == ( local b; b:=sqrt(a); b^2-a)
Compiled code for f has been cleared. 1 old definition(s) deleted for function or rule f
Type: Void
fricas
f(sqrt(2))
fricas
Compiling function f with type AlgebraicNumber -> AlgebraicNumber 
R65=0
(65) 0

\label{eq21}0(21)
Type: AlgebraicNumber?
fricas
)set output fortran on
f(sqrt(2))
R66=0
(66) 0

\label{eq22}0(22)
Type: AlgebraicNumber?
fricas
)set output fortran off
 
fricas
)set output tex on 
f(sqrt(2))
(67) 0

\label{eq23}0(23)
Type: AlgebraicNumber?
fricas
)set output tex off
 
fricas
)set output script on
--------------------------- The scripts Option ----------------------------
Description: show subscripts,... linearly
The scripts option may be followed by any one of the following:
yes no
The current setting is indicated within the list.
Your value on is not among the valid choices.
f(sqrt(2))
(68) 0
Type: AlgebraicNumber?
fricas
)set output script off
--------------------------- The scripts Option ----------------------------
Description: show subscripts,... linearly
The scripts option may be followed by any one of the following:
yes no
The current setting is indicated within the list.
Your value off is not among the valid choices.

((1+2)/3)::SquareMatrix?(3,Integer)

fricas
((1+2)/3)::SquareMatrix(3,Integer)
+1 0 0+ | | (69) |0 1 0| | | +0 0 1+
Type: SquareMatrix?(3,Integer)

fricas
((1+2)/3)::SquareMatrix(3,Integer)
+1 0 0+ | | (70) |0 1 0| | | +0 0 1+
Type: SquareMatrix?(3,Integer)

integrate(exp(x-x^2), x) --test int, Sun, 10 Jun 2018 12:51:40 +0000 reply
fricas
integrate((x+sin(x))^(1/2), x)
>> Error detected within library code: integrate: implementation incomplete (has polynomial part)

integrate(exp(x-x^2), x) --test int, Sun, 10 Jun 2018 12:52:12 +0000 reply
fricas
integrate((x+sin(x))^(1/2), x)
>> Error detected within library code: integrate: implementation incomplete (has polynomial part)

trying something difficult; see comments --h-x, Sat, 09 Nov 2019 02:31:34 +0000 reply
fricas
"";
  "Notice how the CAS computes the second (displayed) integral, while saying 'proved non-elementary' about the first one,";
  "despite the fact that the two are equal for any x in [-1..-1/sqrt(2)].";
  "My guess is that the system does not apply transformations that force additional restrictions on the function domain...";
  "Notice also how transforming the integrand into a form that the CAS can find an elementary antiderivative for requires";
  "quite some discipline in keeping track of the integrand domain, as well as using some not-so-obvious transfromations...";
  t:=sqrt(1-x*x);
  nume:=(acos(x)*t)^(-1);
  deno:=log(2*acos(x)/%pi);
  transformedDeno:=log(2+asin(2*x*t)/%pi);
  failedIntegral:=integrate(nume/transformedDeno,x);
  integrate(nume/deno, x)
2 acos(x) (71) - log(log(---------)) %pi
Type: Union(Expression(Integer),...)

Still no CAS knows if this one is elementary... Probably it is not, but a fun fact... --h-x, Sat, 09 Nov 2019 02:35:01 +0000 reply
fricas
integrate((x+sin(x))^(1/3),x)
>> Error detected within library code: integrate: implementation incomplete (has polynomial part)

Axiom is lying here, the example comes from Bronstein's tutorial, pp. 29-31 --h-x, Sun, 10 Nov 2019 09:26:19 +0000 reply
fricas
t:=x+log(x);
 nume:=(x^2+x+1)*sqrt(t)+(3*x+1)*log(x)+3*x*x+x;
 deno:=x*t*sqrt(t)+x*x*t;
 check:=integrate(nume/deno,x);
 differentiate(2*sqrt(t)+2*log(x+sqrt(t)), x)
2 +----------+ 2 (x + 2 x + 1)\|log(x) + x + (3 x + 1)log(x) + 3 x + x (72) -------------------------------------------------------- 2 +----------+ 2 3 (x log(x) + x )\|log(x) + x + x log(x) + x
Type: Expression(Integer)

No lie, compare:

fricas
nume - numer(differentiate(2*sqrt(t)+2*log(x+sqrt(t)), x))
+----------+ (73) - x\|log(x) + x
Type: Expression(Integer)

Still, shame that FriCAS can not do corrected example...

Axiom fails again, see Bronstein's Tutorial pp. 32-33 for details on this example --h-x, Sun, 10 Nov 2019 13:21:41 +0000 reply
fricas
nume:= 3*(x+exp(x))^(1/3)+(2*x*x+3*x)*exp(x)+5*x*x;
 deno:= x*(x+exp(x))^(1/3);
 "integrate(nume/deno, x)"
 (q:=nume/deno,  differentiate(3*x*(x+exp(x))^(2/3)+3*log(x), x))
(74) +-------+ 3| x 2 x 2 3 \|%e + x + (2 x + 3 x)%e + 5 x [-------------------------------------, +-------+ 3| x x\|%e + x +-------+ 3| x 2 x 2 3 \|%e + x + (2 x + 3 x)%e + 5 x -------------------------------------] +-------+ 3| x x\|%e + x
Type: Tuple(Expression(Integer))

fricas
)clear value t
integrate(sqrt(A-2*t*t/((1-t*t)^2))*2/(1+t*t), t)
(75) [ +---------+ \|- 4 A - 2 * log +------------------------+ | 4 2 3 +---------+ |A t + (- 2 A - 2)t + A 4 (2 t - 2 t)\|- 4 A - 2 |------------------------ + A t | 4 2 \| t - 2 t + 1 + 2 (- 6 A - 4)t + A / 4 2 t + 2 t + 1 + +-+ +-+ t\|2 2 \|2 atan(-----------------------------------) +------------------------+ | 4 2 2 |A t + (- 2 A - 2)t + A (t - 1) |------------------------ | 4 2 \| t - 2 t + 1 / 4 ,
+-------+ +-------+ t\|4 A + 2 - \|4 A + 2 atan(-----------------------------------) +------------------------+ | 4 2 2 |A t + (- 2 A - 2)t + A (t - 1) |------------------------ | 4 2 \| t - 2 t + 1 + +-+ +-+ t\|2 \|2 atan(-----------------------------------) +------------------------+ | 4 2 2 |A t + (- 2 A - 2)t + A (t - 1) |------------------------ | 4 2 \| t - 2 t + 1 / 2 ]
Type: Union(List(Expression(Integer)),...)

fricas
integrate(x/sqrt(2*%pi)*exp(-1/2*log(x)^2),x=0..%plusInfinity)
2 +-+ +---+ %e \|2 \|%pi (76) ------------- +-----+ \|2 %pi
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

fricas
guess([3,6,9,12,15,18,21,24,27,30])
(77) [3 n + 3]
Type: List(Expression(Integer))

Another Risch test, props to Umberto Zannier and David Masser --alex, Thu, 14 Jul 2022 16:05:15 +0000 reply
fricas
integrate(5*x^2/sqrt(x^6+x),x)
+------+ 2 | 6 5 (78) log(2 x \|x + x + 2 x + 1)
Type: Union(Expression(Integer),...)

2nd test, also from U. Zannier and D. Masser --alex, Thu, 14 Jul 2022 16:49:14 +0000 reply
fricas
integrate(x/((x^2+1)*sqrt(x^3-x)),x)
(79) +------+ 2 | 3 4 3 2 (4 x + 8 x - 4)\|x - x + x + 8 x + 2 x - 8 x + 1 log(------------------------------------------------------) 4 2 x + 2 x + 1 + +------+ 2 | 3 4 2 (2 x - 4 x - 2)\|x - x + x - 6 x + 1 2 atan(-----------------------------------------) +------+ 2 | 3 3 (2 x + 4 x - 2)\|x - x + 4 x - 4 x / 8
Type: Union(Expression(Integer),...)

This surprisingly gives a real-valued elementary answer
compared to complex one in Z&M's article!

Integral for calculating the Length of a catenary --annahall, Sun, 29 Jan 2023 04:01:15 +0000 reply
fricas
integrate((100*e^(2*x)+100*e^(-2*x)-199)^(1/2), x)
(80) - 600 * weierstrassZeta 9601 ---- 7500 , 1074401 - ------- 3375000 , 2 x log(e) 9601 1074401 300 %e - 199 weierstrassPInverse(----,- -------,----------------------) 7500 3375000 300 + 2 x log(e) 9601 1074401 300 %e - 199 - 199 weierstrassPInverse(----,- -------,----------------------) 7500 3375000 300 + +--------------------------------------------+ | 2 x log(e) 2 2 x log(e) |100 (%e ) - 199 %e + 100 - 30 |-------------------------------------------- | 2 x log(e) \| %e / 30 log(e)
Type: Union(Expression(Integer),...)




  Subject: (replying)   Be Bold !!
  ( 14 subscribers )  
Please rate this page: