Alec Mihailovs

Dr. Aleksandrs Mihailovs

4455 Reputation

21 Badges

20 years, 311 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

As usual, no example - no answer (I don't mean - from me, I mean - any answer). Just a comment. __________ Alec Mihailovs http://mihailovs.com/Alec/
I think, the function can be specified as the first argument in the plot3d command. I didn't check that because you didn't provide an example. _________ Alec Mihailovs http://mihailovs.com/Alec/
While that can be done with readline, parse, fscanf, and fprintf, that also can be done quite conveniently using FileTools:-Text. For example,
with(FileTools:-Text):
a:=RandomTools:-Generate(integer(range=10^1000000..10^1000001)):
WriteInteger("test.txt",a);

                               1000001

Close("test.txt");
b:=ReadInteger("test.txt"):
evalb(a=b);

                                 true

WriteInteger("test3.txt",b^3);

                               3000003

Close("test3.txt");
c:=ReadInteger("test3.txt"):
evalb(c=b^3);

                                 true

Close("test3.txt");
Close("test.txt");
__________ Alec Mihailovs http://mihailovs.com/Alec/
Obviously, it is infinity, with Maple, or without,
int(u^d*coth(u/2), u=0..infinity) assuming d>0;

                               infinity
__________ Alec Mihailovs http://mihailovs.com/Alec/
The idea is to have two Windows in a Maplet. The first window asking how many TextFields needed, and the second window displaying the TextFields. That can be done by making the second Window with a lot of TextFields, and then making some of them invisible. For example,
NumberOfTF:=proc() local i,n; 
uses Maplets:-Tools;
n:=parse(Get('TF'));
for i from n+1 to 20 do Set(tf||i('visible')=false) od 
end:

with(Maplets:-Elements):

m:=Maplet('onstartup'=RunWindow('First'),
  Window['First'](["Enter the number of textfields",
    TextField[TF]('value'=3,10),
    Button("OK",
      Action(Evaluate('function'="NumberOfTF"),
        RunWindow('Main'),CloseWindow('First')))]),
Window['Main']([seq(TextField[tf||i](10),i=1..20)])):

Maplets:-Display(m);
__________ Alec Mihailovs http://mihailovs.com/Alec/
That can be done using Spread package,
s:={t3=4.6976,t2=4.42238}:
with(Spread):
CreateSpreadsheet(S1):
SetCellFormula(S1,A1,eval(t3,s)),
SetCellFormula(S1,B2,eval(t2,s));
__________ Alec Mihailovs http://mihailovs.com/Alec/
You could use either point from plottools, or pointplot3d from plots. If you typed ?point, you would find them. Here is an example (not typical - usually people use pointplot)
Point:=point([1.3,0.5,3.3],symbolsize=25,symbol=circle):

display(PoincareSphere, Point, scaling = constrained);
_________ Alec Mihailovs http://mihailovs.com/Alec/
This happens because inlined = isn't always parsed as an operator. For example,
seq(i^2,`=`(i,1..5));

Error, invalid input: seq received =(i,1 .. 5), 
which is not valid for its 2nd argument, i
gives an error without overloading. It seems as if after overloading all instances of = get parsed as if it was an operator. That gives that error. To avoid that, you could use verify in your procedure instead of =. There is no need to overload verify - a new verification procedure can be added to it as in my blog post about Nested Verification. By the way, the following is not related to that, but it is also interesting,
seq(i^2,``=``(1,a,8,b,c));

                           2   2   2   2   2
                          i , i , i , i , i
__________ Alec Mihailovs http://mihailovs.com/Alec/
If you can use output to a string, then WrapText can be used from the StringTools package. For example,
StringTools:-WrapText(CodeGeneration:-C(
add(i*x^i,i=1..5),output=string),40);

  "cg = x + 2 * x * x + 3 * (int)
        pow((double) x, (double) 3) + 4 * (int)
        pow((double) x, (double) 4) + 5 * (int)
        pow((double) x, (double) 5);
        "
Also, codegen has the split command that can be used in addition to optimize in some cases. By the way, optimize may also work better if it is used as codegen[optimize] before doing CodeGeneration rather than an option in CodeGeneration, because various options in it can be used which are not available from CodeGeneration. _________ Alec Mihailovs http://mihailovs.com/Alec/
It can be fixed by using Intellipoint mouse (with the driver version 4.12 or higher). When you rotate the mouse wheel, the WM_MOUSEWHEEL message is sent to the Focus window. Because the Classic Maple does not have built-in support for that, it ignores the WM_MOUSEWHEEL message. IntelliPoint driver converts the WM_MOUSEWHEEL message to WM_SCROLL, so it works as expected. __________ Alec Mihailovs http://mihailovs.com/Alec/
Eigenvectors are (or at least are supposed to be) in the same order as eigenvalues. For example,
with(LinearAlgebra):
interface(displayprecision=3):
A:=RandomMatrix(3,outputoptions=[shape=symmetric,datatype=float[8]]);

                      [67.000     -31.000    92.000]
                      [                            ]
                 A := [-31.000    44.000     29.000]
                      [                            ]
                      [92.000     29.000     99.000]

v,C:=Eigenvectors(A);

                    [-33.558]  [0.668     0.379     0.640]
                    [       ]  [                         ]
            v, C := [67.136 ], [0.480     -0.877    0.018]
                    [       ]  [                         ]
                    [176.422]  [-0.569    -0.295    0.768]

C.DiagonalMatrix(v).C^(-1);

                    [67.000     -31.000    92.000]
                    [                            ]
                    [-31.000    44.000     29.000]
                    [                            ]
                    [92.000     29.000     99.000]
__________ Alec Mihailovs http://mihailovs.com/Alec/
Some simple calculations can be converted to Java, see ?CodeGeneration,TranslationDetails, but Maplets - no. __________ Alec Mihailovs http://mihailovs.com/Alec/
You have to draw them manually. See an example. __________ Alec Mihailovs http://mihailovs.com/Alec/
For example,
t := `Find the derivative of`*sin( 5*`·`*10^x ):
with(Maplets:-Elements):
maplet := Maplet([
   [MathMLViewer('value' = MathML:-Export(t))],
   [Button("OK", Shutdown())]
]):
Maplets:-Display(maplet);

            
__________ Alec Mihailovs http://mihailovs.com/Alec/
It looks as if you should assign values at the beginning and not at the end, use diff instead of D and dsolve instead of solve that also requires entering functions as x1(t), for example, instead of x1. Instead of leastsquare you could probably use faster commands from Statistics package, see ?Statistics,Regression (if it is necessary at all). At present form the worksheet is too messy to look into details. A good idea is to try to do a similar thing with one or two variables first, without that many constants, and double check the description and correct syntax of commands, such as (d)solve or leastsqure. __________ Alec Mihailovs http://mihailovs.com/Alec/
First 64 65 66 67 68 69 70 Last Page 66 of 76