Sponsored links: Algebra eBooks
 

Related

atom

p : 5-a;

p;

atom (p);

Calculate

atom-subset

subset ({1, 2, x, x +...

subset ({1, 2, 7, 8,...

Calculate

atom-polynomialp-sqrt

polynomialp(sqrt(2*x+...

atom(a+sqrt(b));

Calculate

atom-sin

a : %pi/2;

a;

atom(a);

Calculate

atom-block-expand-false-listofvars-rat-return-true

_is_atom(expr):=block...

_is_atom(a*df_u[1,2]);

Calculate

atom-block-expand-false-listofvars-rat-return-true

_is_atom(expr):=block...

_is_atom(2*df_u[1,2]);

Calculate

atom-sin

a : '%pi/2;

a;

p : sin(a);

Calculate

atom-evenp-subset

subset ({ 1,2,3,4,5,6...

subset ({94}, evenp);

Calculate

atom-op-sin

a : '(sin(%pi/2)-p);

a;

atom(a);

Calculate

atom

Run Example
(%i1)_is_atom(expr):=block(	[lexpr,exprop],	lexpr: expand(expr),	if atom(lexpr)=true then (		return(false)	),	/* subscripted expression */	if subvarp(lexpr)=false then (		return(false)	),	exprop: op(lexpr),	if exprop#df_u or exprop#df_v then (		return(false)	),print(length(lexpr)),	/* 2 subscripts */	if length(lexpr)#2 then (		return(false)	),	/* first subscript is integer>
=0 */print(part(lexpr,1)),	if nonneginteger(part(lexpr,1))=false then (		return(false)	),	/* second subscript is integer>
=0 */	if nonneginteger(part(lexpr,2))=false then (		return(false)	),	return(true));
(%o1) _is_atom(expr) := block([lexpr, exprop], lexpr : expand(expr), 
if atom(lexpr) = true then return(false), 
if subvarp(lexpr) = false then return(false), exprop : op(lexpr), 
if (exprop # df_u) or (exprop # df_v) then return(false), 
print(length(lexpr)), if length(lexpr) # 2 then return(false), 
print(part(lexpr, 1)), if nonneginteger(part(lexpr, 1)) = false
 then return(false), if nonneginteger(part(lexpr, 2)) = false
 then return(false), return(true))
(%i2) _is_atom(a);
(%o2)                                false
(%i3) _is_atom(1);
(%o3)                                false
(%i4) _is_atom(sqrt(2));
(%o4)                                false
(%i5) _is_atom(1+sqrt(2));
(%o5)                                false
(%i6) _is_atom(a*b);
(%o6)                                false
(%i7) _is_atom(sin(a));
(%o7)                                false
(%i8) _is_atom(df_u);
(%o8)                                false
(%i9) _is_atom(df_v);
(%o9)                                false
(%i10) _is_atom(df_w);
(%o10)                               false
(%i11) _is_atom(df_u[1]);
(%o11)                               false
(%i12) _is_atom(df_u[1,2,3]);
(%o12)                               false
(%i13) _is_atom(df_u[1,0.5]);
(%o13)                               false
(%i14) _is_atom(df_u[-1,2]);
(%o14)                               false
(%i15) _is_atom(df_u[1,sin(1)]);
(%o15)                               false
(%i16) _is_atom(df_u[1,2]);
(%o16)                               false
(%i17) _is_atom(df_v[1,2]);
(%o17)                               false
(%i18) 
Run Example
1/(a*b), simp:true;
                                       1
(%o1)                                 ---
                                      a b
(%i2) 1/(a*b), simp:false;
                                       1
(%o2)                                 ---
                                      a b
(%i3) matchdeclare(a, atom);
(%o3)                                done
(%i4) matchdeclare(b, atom);
(%o4)                                done
(%i5) tellsimp(1/(a*b), simp:false, ((1/a)*(1/b)));
tellsimp: warning: putting rules on '+' or '*' is inefficient, and may not work.
(%o5)                         [*rule1, simptimes]
(%i6) tellsimpafter(1/(a*b), simp:false, ((1/a)*(1/b)));
(%o6)                     [*rule2, *rule1, simptimes]
(%i7) defrule(fraction, 1/(a*b),((1/a)*(1/b))), simp:false;
                                        1
(%o7)                       fraction : --- -> false
                                       a b
(%i8) 1/(a*b), simp:false;
                                       1
(%o8)                                 ---
                                      a b
(%i9) maxapplydepth:1;
(%o9)                                  1
(%i10) newfac;
(%o10)                              newfac
(%i11) fraction(1/(a*b));
                                    1   1
(%o11)                              - (---)
                                    1  a b
(%i12) factor(1/(a*b)), simp:false;
                                       1
(%o12)                                ---
                                      a b
(%i13) ratexpand:false;
(%o13)                               false
(%i14) expandwrt_denom:true;
(%o14)                               true
(%i15) 1/(a*b), fraction;
                                       1
(%o15)                                ---
                                      a b
(%i16) 
Run Example
A( r ) := 2 * %pi * r^2 + 2 / r;
                                            2   2
(%o1)                        A(r) := 2 %pi r  + -
                                                r
(%i2) define( A1( r ), diff( A( r ), r ) );
                                                2
(%o2)                        A1(r) := 4 %pi r - --
                                                 2
                                                r
(%i3) define( A2( r ), diff( A1( r ), r ) );
                                       4
(%o3)                         A2(r) := -- + 4 %pi
                                        3
                                       r
(%i4) result : solve( A1( r ) = 0, r );
               sqrt(3) %i - 1        sqrt(3) %i + 1           1
(%o4)     [r = --------------, r = - --------------, r = -----------]
                 4/3    1/3            4/3    1/3         1/3    1/3
                2    %pi              2    %pi           2    %pi
(%i5) atom( result[3] );
(%o5)                                false
(%i6) atom( rhs( result[3] ) );
(%o6)                                false
(%i7) /* only result [3] is a solution with a real number - NOT an imaginary */r_o : rhs( result[3] );
                                       1
(%o7)                             -----------
                                   1/3    1/3
                                  2    %pi
(%i8) atom( r_o );
(%o8)                                false
(%i9) op( r_o );
(%o9)                                  /
(%i10) A2(r_o)>
0, pred;
(%o10)                               true
(%i11) x : rhs( result[3] );
                                       1
(%o11)                            -----------
                                   1/3    1/3
                                  2    %pi
(%i12) res : A2(x);
(%o12)                              12 %pi
(%i13) res, numer;
(%o13)                         37.69911184307752
(%i14) res>
1, pred;
(%o14)                               true
(%i15) 

Related Help

Help for Atom