C_R

3207 Reputation

21 Badges

5 years, 212 days

MaplePrimes Activity


These are questions asked by C_R

If a type is not known, an error is thrown

type([],foo)
Error, type `foo` does not exist

Since no error is thrown, these types are known

type({},'{}');# why that output?
                             false

type([],'[]')
                              true

I would have expceted {} and [] to be listed as subtypes of set and list since their counterparts (nonemptylist and nonemptyset) exist. Technically the types {} and [] are not needed since negating

not(type([],nonemptylist));
not(type({},nonemptyset));
                              true

                              true

works.  However, the types exist, hence my question

This is for my understanding (and the proper use of Maple terms)

?simplify refers to them (sqrt in this case) as procedures

simplify[sqrt](16^(3/2));
                               64

`simplify/sqrt`(16^(3/2));
                               64

simplify(16^(3/2), sqrt);
                               64

?combine calls them (this time exp and trig) names of options

combine(exp(sin(a)*cos(b))*exp(cos(a)*sin(b)),[trig,exp]);#why the list?
                        exp(sin(a + b))

combine(exp(sin(a)*cos(b))*exp(cos(a)*sin(b)),trig,exp);#no list
                        exp(sin(a + b))

combine[trig](exp(sin(a)*cos(b))*exp(cos(a)*sin(b)));#no exp required?!?
                        exp(sin(a + b))

(`combine/exp`@`combine/trig`)(exp(sin(a)*cos(b))*exp(cos(a)*sin(b)));
                        exp(sin(a + b))

If the terms command options and command procedures can be used interchangeably, how does evalf[4](...) fit into this scheme? 

Is there a special Maple term for the construct "proc[n]" where proc is a procedure/command name and n is not a name but of type numeric?

I want to make from a procedure call a single argument function that can be used in function composition.

To illustrate this with a simple example, below the function pow[3] performs a cube operation

pow[3]:=x-> `^`(x,3):
(evalf[4]@pow[3]@sin)(Pi/6)
                             0.1250

To make the use of pow a bit more generic, I though about doing definitions for other powers in a loop with an inline assignement

for i from -1/2 to 5 by 1/2 do (power[i]:=x-> `^`(x,i)) end do;

This does not work because the i in the rigthhand side of power[i]:=x-> `^`(x,i) does not evaluate to the acutal value of the loop counter. I tried eval and evaln without success. How do I get full evaluation of the inline assignement?

Both uses of evalf

evalf(Pi, 20);
evalf[20](Pi);

work, but only the latter is documented. Is there a reason behind (maybe historical)? Any reason not to use evalf(...,n) any more? I am also reluctant to update old worksheets if there is no need for the indexed version.

Only for my understanding. In the following I need to use expand to apply division to list elements when the divisor is a name:

[a, b]*(1/2)

[(1/2)*a, (1/2)*b]

(1)

[a, b]/c

[a, b]/c

(2)

expand([a, b]/c)

[a/c, b/c]

(3)

NULL

Does in this case automatic simplification make a difference between numbers and names? (Probably this is explained somewhere.)

Download div_of_list.mw

First 15 16 17 18 19 20 21 Last Page 17 of 41