Alec Mihailovs

Dr. Aleksandrs Mihailovs

4495 Reputation

21 Badges

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

Social Networks and Content at Maplesoft.com

Maple Application Center

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 replies submitted by Alec Mihailovs

In general, multivalued functions are not defined in Maple. In particular, roots are 1-valued (discontinuous) functions. If it is desirable to have continuous roots and it is not easy to locate the branch points, the roots can be defined using RootOf with approximation given by an earlier value of the root. For example,
y:=proc(t)  
if t<=0.1 then 
sqrt(-(50*t+25*I*t-90*t^2-120*I*t^2-48*I*t^4+143*I*t^3+26*t^3+14*t^4)/2) 
else 
RootOf(2*_Z^2+50*t+25*I*t-90*t^2-120*I*t^2-48*I*t^4+143*I*t^3+26*t^3+14*t^4,
    _Z,y(t-0.1)) 
fi end: 

evalf(Int(y,0..1,method=_Dexp));

                    -0.2736137686 - 1.449603013 I
In general, multivalued functions are not defined in Maple. In particular, roots are 1-valued (discontinuous) functions. If it is desirable to have continuous roots and it is not easy to locate the branch points, the roots can be defined using RootOf with approximation given by an earlier value of the root. For example,
y:=proc(t)  
if t<=0.1 then 
sqrt(-(50*t+25*I*t-90*t^2-120*I*t^2-48*I*t^4+143*I*t^3+26*t^3+14*t^4)/2) 
else 
RootOf(2*_Z^2+50*t+25*I*t-90*t^2-120*I*t^2-48*I*t^4+143*I*t^3+26*t^3+14*t^4,
    _Z,y(t-0.1)) 
fi end: 

evalf(Int(y,0..1,method=_Dexp));

                    -0.2736137686 - 1.449603013 I
For this particular example, branches can be chosen manually. Also, specifying a method makes calculations faster,
x := -I*t + (1-t)*2:
y := sqrt((x+1/2)*(x-2)*(x+I)*(x-I)):
z:=piecewise(t<=5/16,y,-y):
evalf( Int(z,t=0..1, method = _Dexp) ); 

                    -0.2736137686 - 1.449603013 I
For this particular example, branches can be chosen manually. Also, specifying a method makes calculations faster,
x := -I*t + (1-t)*2:
y := sqrt((x+1/2)*(x-2)*(x+I)*(x-I)):
z:=piecewise(t<=5/16,y,-y):
evalf( Int(z,t=0..1, method = _Dexp) ); 

                    -0.2736137686 - 1.449603013 I
It is easier to replace y in the commented assignment with, say y1. Also, with(DEtools) is not necessary for using dsolve. The following should work OK,
deq := diff(y(x),x,x) = A*exp(y(x)/vt);
deq2 := diff(y(x),x,x) = A2*exp(y(x));

y1 := unapply(rhs(dsolve(deq,y(x))),x);
y2 := unapply(rhs(dsolve(deq2,y(x))),x);
I agree with what Joe Riel said. For me, it is mostly a matter of time. If I can copy an example into Maple, I can easily correct the errors and post the answer. If I have to retype the example manually (because it was posted in 2d-notation, or with pictures with formulas), it takes longer time and I need some additional motivation for doing that. If there are no examples and I have to invent an example myself, it also takes longer time. Such questions, without examples, usually hard to understand - it is not clear what poster wants. Also, sometimes I don't post a reply because I want somebody else to reply - replies from Maplesoft employees are especially appreciated. In some cases, I didn't post a reply just because the poster emailed his question personally to my email address in addition to posting it here - I have enough junk mail in my mailbox without that.
One seq seems to be faster than map. For 2 seqs, the situation may be different - I am not sure. For example, multiple timings of the following 2 sorting procedures didn't show a significant preference of one of them,
sort5 := L->map(attributes,
sort([seq(setattribute(Re(z)^2+Im(z)^2,z), z=L)]));

sort6 := L->[seq(attributes(i),
i=sort([seq(setattribute(Re(z)^2+Im(z)^2,z), z=L)]))];
Joe, It is a great idea to use attributes. Replacing abs(x) with op(1,x)^2+op(2,x)^2 seems to give some time improvement in all examples. It can't be applied to real x though.
Here is one way of doing that. I slightly changed your assignments,
Am := 1;
ka := 0.8;
fm := 4e3;
Ac := 10;
fc := 1500e3;
phi:= 0;
m := Am*cos(2*Pi*fm*t);
c := Ac*cos(2*Pi*fc*t + phi);
s := (1+ka*m)*c;
plot([s,0], t=0..3000/fc, title="AM Waveform (fm = 4kHz)", 
titlefont=[HELVETICA,16], font=[HELVETICA,12], 
labels=["Time (s)", "Amplitude"], labeldirections=[HORIZONTAL,VERTICAL], 
color=[red,black], axes=framed, numpoints=500);
S := inttrans[fourier](s,t,f);

F:=S->map(x->plottools[line]([-op([2,1,2],x),0],[-op([2,1,2],x),op(1,x)]),[op(S)]);

plots[display](F(S),color=blue);
Here is one way of doing that. I slightly changed your assignments,
Am := 1;
ka := 0.8;
fm := 4e3;
Ac := 10;
fc := 1500e3;
phi:= 0;
m := Am*cos(2*Pi*fm*t);
c := Ac*cos(2*Pi*fc*t + phi);
s := (1+ka*m)*c;
plot([s,0], t=0..3000/fc, title="AM Waveform (fm = 4kHz)", 
titlefont=[HELVETICA,16], font=[HELVETICA,12], 
labels=["Time (s)", "Amplitude"], labeldirections=[HORIZONTAL,VERTICAL], 
color=[red,black], axes=framed, numpoints=500);
S := inttrans[fourier](s,t,f);

F:=S->map(x->plottools[line]([-op([2,1,2],x),0],[-op([2,1,2],x),op(1,x)]),[op(S)]);

plots[display](F(S),color=blue);
The Dirac function can be considered as a limit of functions approaching infinity at one single point and not 1. For example, look at the graph of a Heaviside function. The Dirac function is its derivative, graphically it means slope. The slope is always 0 except one point where it is infinity. If you want to plot lines of height 1, that can be done, but it is not a plot of a linear combination of Dirac functions.
The Dirac function can be considered as a limit of functions approaching infinity at one single point and not 1. For example, look at the graph of a Heaviside function. The Dirac function is its derivative, graphically it means slope. The slope is always 0 except one point where it is infinity. If you want to plot lines of height 1, that can be done, but it is not a plot of a linear combination of Dirac functions.
The problem is caused by a typo in line 33 of `evalf/Elliptic/Ell_E`. It should be
return `evalf/Elliptic/E_0`(R,k)+...
instead of
return `evalf/Elliptic/F_0`(R,k)+...
Meanwhile, before the next maintenance release, to use EllipticE, the `evalf/Elliptic/Ell_E` should be patched. For example, it can be done as follows:
`evalf/Elliptic/Ell_E`:=parse(StringTools:-Substitute(
sprintf("%a",eval(`evalf/Elliptic/Ell_E`)),"F_0","E_0")):
After that, plot gives a normal picture,
plot(EllipticE(JacobiSN(u,.9843059133),.9843059133),
u=-3.137679789..3.137679789,scaling=constrained);
The problem seems to be caused by small number of iterations for some points - even after 30 iterations they are far from the roots. Changing 30 to larger number of iterations, such as 1000, for example, produces similar colors in all examples. The NF procedure doesn't have this problem because I chose the colors explicitely - independently of Im(z).
I like examples/BasicHowTo.mws worksheet in Maple 9.5. It seems as if Maple 10 doesn't have it though.
First 166 167 168 169 170 171 172 Last Page 168 of 180