Alec Mihailovs

Dr. Aleksandrs Mihailovs

4455 Reputation

21 Badges

20 years, 310 days
Mihailovs, Inc.
Owner, President, and CEO
Tyngsboro, Massachusetts, United States

Social Networks and Content at Maplesoft.com

I received my Ph.D. from the University of Pennsylvania in 1998 and I have been teaching since then at SUNY Oneonta for 1 year, at Shepherd University for 5 years, at Tennessee Tech for 2 years, at Lane College for 1 year, and this year I taught at the University of Massachusetts Lowell. My research interests include Representation Theory and Combinatorics.

MaplePrimes Activity


These are answers submitted by Alec Mihailovs

1 - add(binomial(50,n)*.1^n*.9^(50-n), n=0..10);
                             0.0093546016

In this particular example, the Statistics package can be used directly,

with(Statistics):
X:=RandomVariable(Binomial(50,.1)):
1-CDF(X,10);
                             0.0093546016
or

SurvivalFunction(X,10);
                             0.0093546016
Alec

First, multiplication sign in g0 is missing.

Second, in this case, for plots of 3 functions with the same intervals of x and y, the display command is not necessary. It could be done as

plot([g0,g1,g2]);

Or similar, with adding the intervals, such as

plot([g0,g1,g2], x=0..3);

The advantage is that the graphs of different functions are colored in different colors, without even mentioning that in the plotting commands.

Third, the definition of g0 that was given, won't work correctly (in real algebra sense) in Maple for negative x. If one wants x^(2/3) be defined for negative x as (x^2)^(1/3), it should be defined exactly like that. There are other ways of doing that, such as using surd(x^2, 3) or typing with(RealDomain); before the definition of g0, but they would give some weird looking formulas for g1 and g2. In the last case, with using RealDomain, even signum(x)^2 would not get simplified to 1.

Alec

Or, since your original equation is a proportion, you could use the crossproduct rule for proportions.

Also, the final answer should be not x = (3/5)y, but

x = (3/5)y with y not equal to 5.

Alec

I'm not saying that it is better, but the following sequences might be closer to what the OP expected:

seq(2*i-irem(i,2), i=0..30);

seq(2*(i+1)-irem(i,2), i=0..30);

or with i+i instead of 2*i if it's faster. Not tested for the obvious reason. Also, I don't remember exactly, but it might be another command for mod 2 that is faster than irem(i,2).

Alec

It also could be, probably, done, using Array and Alias.

Alec

Also, both sequences can be obtained simultaneously using selectremove. I hope Joe will help me with the formula (I don't have Maple to test it.) First sequence (select) can be described as 0 or 1 mod 4.

Alec

 

 I just wonder why you are using Maple 11. The brochure says:

Once again, Maplesoft delivers an outstanding product. With Maple 12, a simple click of the mouse allows you to solve problems, demonstrate your work, create presentations, and produce live math documents. For me, it is a great teaching support and a wonderful tool for students who want to solve everything from simple to highly complex problems, and to explore the solutions in many ways. I hghly recommend Maple 12!”

Mario Lemelin, Science Teacher

It seems as if you should have Maple 12.

Alec

 

Also, map looks more interesting written in a different form,
a,b,c:=2,3,4;

                          a, b, c := 2, 3, 4

a,b,c:=map(`*`,[a,b,c],2)[];

                          a, b, c := 4, 6, 8
And this works with non-numeric or 0 scalar factors as well,
a,b,c:=map(`*`,[a,b,c],x)[];

                       a, b, c := 4 x, 6 x, 8 x
__________ Alec Mihailovs http://mihailovs.com/Alec/
If a,b, and c were assigned earlier, one can assign them to twice their previous values without mapping, as
a,b,c:=2,3,4;
                          a, b, c := 2, 3, 4
a,b,c:=2*(a,b,c);

                          a, b, c := 4, 6, 8
__________ Alec Mihailovs http://mihailovs.com/Alec/
Karel, It also can be done as
VerifyTools:-AddVerification('equivalent'=proc(x,y) 
if [x,y]::[relation,relation] then
(is(x) assuming y) and (is(y) assuming x) else false fi end);
For example,
verify(x=1,2*x-1=1,equivalent);

                                 true

verify(sin(x+y)=0, 2*sin(x)*cos(y)+2*cos(x)*sin(y)=0,equivalent);

                                 FAIL
verify(expand(sin(x+y)=0),
2*sin(x)*cos(y)+2*cos(x)*sin(y)=0,equivalent);

                                 true
To use it together with nested verification, relation should be removed from the nested verification procedure,
VerifyTools:-AddVerification('nested'=proc(x,y,ver:=NULL) 
local t,f;
f:=t->verify(x,y,'t'('nested'(ver)));
for t in [Vector,Matrix,Array,array,set,list,range,record]
do if x::t then break fi od;
if y::t then f(t) else verify(x,y,ver) fi
end);
For example,
verify([x=1,{3*x=5}],[2*x=2,{21*x=35}],nested(equivalent));

                                 true
It looks as if you didn't replace < signs in your post with &lt; so a part of your code has disappeared. __________ Alec Mihailovs http://mihailovs.com/Alec/
For Vectors and Matrices (but not for Arrays), the tensor product can be defined as
TensorProduct:=module()
export `*`;
option package;
`*`:=overload([proc(A::rtable,B::rtable) option overload; 
rtable(<seq(seq(`*`(A[i,[rtable_dims(A)][2..-1][]],
B[j,[rtable_dims(B)][2..-1][]]),
j=[rtable_dims(B)][1]),i=[rtable_dims(A)][1])>, 
select(has,{rtable_options(A)} intersect {rtable_options(B)},
{datatype,subtype,order,rectangular,sparse})[]) end,
:-`*`]) end:

with(TensorProduct):
For example,
A:=<<1 | 2> , <3 | 4>>;
                            Matrix([[1,2],[3,4]])
     
B:=<<1 | 2 | 3> , <4 | 5 | 6> , <7 | 8 | 9>>;

                         Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

A*B;

                 Matrix([[1, 2, 3, 2, 4, 6], [4, 5, 6, 8, 10, 12], [7, 8, 9, 14, 16, 18], [3, 6, 9, 4, 8, 12], [12, 15, 18, 16, 20, 24], [21, 24, 27, 28, 32, 36]])
I didn't test it with all possible options, and it might give wrong results for some of them, but it seems to work OK with dense matrices with rectangular storage. If there is a need of using other options, the procedure should be correspondingly adjusted. In particular, it is not optimized for sparse matrices (but neither do many other procedures in LinearAlgebra package). __________ Alec Mihailovs http://mihailovs.com/Alec/
For example,
phi:=Vector(6,i->(x/l)^(i+1));

M:=map(int,phi.phi^%T*p,x=0..l);

         Matrix([[1/5*l*p, 1/6*l*p, 1/7*l*p, 1/8*l*p, 1/9*l*p, 1/10*l*p], [1/6*l*p, 1/7*l*p, 1/8*l*p, 1/9*l*p, 1/10*l*p, 1/11*l*p], [1/7*l*p, 1/8*l*p, 1/9*l*p, 1/10*l*p, 1/11*l*p, 1/12*l*p], [1/8*l*p, 1/9*l*p, 1/10*l*p, 1/11*l*p, 1/12*l*p, 1/13*l*p], [1/9*l*p, 1/10*l*p, 1/11*l*p, 1/12*l*p, 1/13*l*p, 1/14*l*p], [1/10*l*p, 1/11*l*p, 1/12*l*p, 1/13*l*p, 1/14*l*p, 1/15*l*p]]
)
Certainly, nested loops are supported. Before using 2d-math input you might try a regular 1-d Maple input. Some problems could occur if you used Enter key to start typing on a new line in the middle of a loop. One should use Shift+Enter for that. Also, you omitted do a few times. __________ Alec Mihailovs http://mihailovs.com/Alec/
with(Student:-VectorCalculus):
BasisFormat(false):
c:=t-><t^3,3*t,t^4>:
P:=c(1):
T,N,B:=TNBFrame(c)(1):
R:=RadiusOfCurvature(c)(1):
C:=P+R*N:
cp:=TNBFrame(c,output=plot,range=0.5..1.5,frames=1):
with(plots):
oc:=spacecurve(C-R*N*cos(theta)+R*T*sin(theta),theta=-Pi/2..Pi/2,
  color=red,thickness=2):
pc:=pointplot3d([P,C],symbol=circle):
display(cp,oc,pc,orientation=[-15,60],scaling=constrained);
      
eq:=Norm(<x,y,z>-C)^2=R^2,simplify(B.(<x,y,z>-P)=0);
eq:=eq[1]*441-7129,eq[2]*7-3;

441*x^2-984*x+441*y^2+720*y+441*z^2-3330*z = 2697

            6*x-2*y-3*z = -3
__________ Alec Mihailovs http://mihailovs.com/Alec/
Here is an example,
f:=(x-1)*(x-2)*(x-3):
g:=unapply(f,x):

solve(diff(f,x));

                          2+sqrt(3)/3, 2-sqrt(3)/3     

solve(D(g)(x));

                          2+sqrt(3)/3, 2-sqrt(3)/3

solve(diff(f,x,x));

                                  2

solve(D(D(g))(x));

                                  2

Student:-Calculus1:-ExtremePoints(f);

                         [2+sqrt(3)/3,2-sqrt(3)/3]

Student:-Calculus1:-InflectionPoints(f);

                                 [2]
__________ Alec Mihailovs http://mihailovs.com/Alec/
For example,
<<1 | 2> , <3 | 4>>;

                               Matrix([[1, 2], [3, 4]])

convert(%,listlist);

                           [[1, 2], [3, 4]]
__________ Alec Mihailovs http://mihailovs.com/Alec/
First 61 62 63 64 65 66 67 Last Page 63 of 76