Doug Meade

 

Doug

---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.edu

MaplePrimes Activity


These are replies submitted by Doug Meade

If you are taking a Laplace transform, that's what you should letting Maple do for you. For example:
with( inttrans ):
ode := (1/R1+1/R2)*(diff(V2(t), t))
       -(diff(V1(t),t))/R1
       +(V2(t)-V1(t))/L
       +C*(diff(V2(t), t$2)) = 0:
eq := laplace( ode, t, s );

     s*laplace(V2(t), t, s)/R1-V2(0)/R1
     +s*laplace(V2(t), t, s)/R2-V2(0)/R2
     -s*laplace(V1(t), t, s)/R1+V1(0)/R1
     +laplace(V2(t), t, s)/L
     -laplace(V1(t), t, s)/L
     +C*s^2*laplace(V2(t), t, s)
     -C*(D(V2))(0)-C*s*V2(0) = 0

alias( v1=laplace(V1(t),t,s), v2=laplace(V2(t),t,s) ):
eq;

     s*v2/R1-V2(0)/R1+s*v2/R2-V2(0)/R2-s*v1/R1
     +V1(0)/R1+v2/L-v1/L+C*s^2*v2-C*(D(V2))(0)-C*s*V2(0) = 0

ic := [ V1(0)=A, V2(0)=B, D(V2)(0)=E ]:
eval( eq, ic );

     s*v2/R1-B/R1+s*v2/R2-B/R2-s*v1/R1
     +A/R1+v2/L-v1/L+C*s^2*v2-C*E-C*s*B = 0
Now, if you have another ODE (and IC) to complete the system, you should be able to solve for v1 and v2 in terms of the parameters and s. If you have numerical values for all of the parameters, the solution will depend only on s. It's possible this could be transformed back to the time domain (see ?invlaplace). Or, you could plot the transformed solutions in terms of s.
soln := solve( {eq,eq2}, {v1,v2} );
solnV1 := eval( soln, v1 );   # extract v1 from the solution
solnV2 := eval( soln, v2 );   # extract v2 from the solution
plot( [solnV1,solnV2], s=0..10 );
I hope this is helpful, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
As I read this exchange, I get the feeling that you are looking for what has been suggested:
f := X -> X[1]+X[2];
but you keep talking about a function of two variables. This would be
F := (X1,X2) -> X1+X2;
In the latter, note that the variable names are just placeholders. There is no reason to use an indexed name here. In fact, Maple does not like this:
f := (x[1],x[2])->x[1]+x[2];
Error, symbol or symbol::type or symbol:=expression expected in parameter list
Just be careful about how you want to use your function, and do not try to get too concerned about appearance in the definition of the function. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
As I read this exchange, I get the feeling that you are looking for what has been suggested:
f := X -> X[1]+X[2];
but you keep talking about a function of two variables. This would be
F := (X1,X2) -> X1+X2;
In the latter, note that the variable names are just placeholders. There is no reason to use an indexed name here. In fact, Maple does not like this:
f := (x[1],x[2])->x[1]+x[2];
Error, symbol or symbol::type or symbol:=expression expected in parameter list
Just be careful about how you want to use your function, and do not try to get too concerned about appearance in the definition of the function. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
The original question was:

How do I use newtons method tutor to find the fixed points of a function? The responses have all been correct, but have not recognized that Newton's Method applies to root-finding problems, solving F(x)=0. The original post asks about fixed points: solutions to f(x)=x. So, to use Newton's Method (in any of its forms) to find fixed points you have to use F(x)=f(x)-x. Doug

---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
The original question was:

How do I use newtons method tutor to find the fixed points of a function? The responses have all been correct, but have not recognized that Newton's Method applies to root-finding problems, solving F(x)=0. The original post asks about fixed points: solutions to f(x)=x. So, to use Newton's Method (in any of its forms) to find fixed points you have to use F(x)=f(x)-x. Doug

---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
As I said, even the regulars get caught by < Scott, you need to do the same update to your own post! Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Welcome to MaplePrimes. I'm sure you will find an answer to your question, once we can see all of it. You need to replace each < with &lt; (don't forget the semi-colon). This one catches almost everyone - even the regular posters to MaplePrimes. Another option is to post your worksheet in the files section and let us download the actual code that you are using. One thing you need to be aware of with if statements is that sometimes you have to force Maple to evaluate a constant such as Pi as a floating-point number. For example:
> if 2<Pi then 1 else 2 end if;
Error, cannot determine if this expression is true or false: 2 < Pi

> if evalf(2<Pi) then 1 else 2 end if;
                                      1
Looking forward to your full question, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
I second Robert's suggestion to use LinearAlgebra. My approach is a little different. Get the x-coordinates in a Vector and the y-coordinates in another vector, then you can construct A as follows:
Xv := convert( X, Vector );   # if X is a list
Yv := convert( Y, Vector );
ones := Vector( 3, 1 );
A := < Xv | Yv | ones >;
Other ways to create the vector of x-coordinates include:
Xv := Vector( x );
Xv := < x >;
Xv := < 1, 2, 3 >;
Note that each is a column vector. Similar constructs work for the y-coordinates. Then, the implementation of F from Robert's response could be:
F := (i,j) -> LinearAlgebra[Determinant]( < <X,x[i],x[j]> | <Y,y[i],y[j]> | <1,1,1> > );
Another approach would be to convert the separate x and y lists into a combined list of ordered pairs. In fact, while we're at it, why not attach the third column as well. Here's how this, and F, would then appear:
XY1 := zip( (a,b)-><a|b|1>, x, y );
F := (i,j) -> LinearAlgebra[Determinant]( < , XY1[i], XY1[j] > );
Converting to LinearAlgebra might be a little bit of a nuisance, but there are many benefits once you commit to using it. I hope this has been helpful, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
I second Robert's suggestion to use LinearAlgebra. My approach is a little different. Get the x-coordinates in a Vector and the y-coordinates in another vector, then you can construct A as follows:
Xv := convert( X, Vector );   # if X is a list
Yv := convert( Y, Vector );
ones := Vector( 3, 1 );
A := < Xv | Yv | ones >;
Other ways to create the vector of x-coordinates include:
Xv := Vector( x );
Xv := < x >;
Xv := < 1, 2, 3 >;
Note that each is a column vector. Similar constructs work for the y-coordinates. Then, the implementation of F from Robert's response could be:
F := (i,j) -> LinearAlgebra[Determinant]( < <X,x[i],x[j]> | <Y,y[i],y[j]> | <1,1,1> > );
Another approach would be to convert the separate x and y lists into a combined list of ordered pairs. In fact, while we're at it, why not attach the third column as well. Here's how this, and F, would then appear:
XY1 := zip( (a,b)-><a|b|1>, x, y );
F := (i,j) -> LinearAlgebra[Determinant]( < , XY1[i], XY1[j] > );
Converting to LinearAlgebra might be a little bit of a nuisance, but there are many benefits once you commit to using it. I hope this has been helpful, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
A ZIP archive containing the Maple worksheet used to create the .mla file referenced in my blog post is now available on MaplePrimes. Download 178_MakeMLA.zip
View file details This archive contains 3 files. The files folder contains the image (PrimesBack.jpg) and a worksheet (Simple.mw) containing an earlier version of the maplet. The path to the image is not going to be correct for most users. The third file (MakeMLA.mw) is the one that is most interesting. The code in this worksheet creates the archive, puts the image in the archive, and defines a procedure to be executed whenever the archive is opened. The last part is the really cool contribution (due to acer). I have attempted to write this for cross-platform usage, but have tested it only under Windows. Some adjustments for directories and file structures might be necessary. Corrections and suggestions are welcomed. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Now that I have taken a little time to better understand libraries and archives I finally understand acer's post. There were a couple of typos and I believe I have made some (minor) improvements. Here is my current code:
restart;
if StringTools[Search]( "Linux", interface(version) )>0 then
  DOT := ".//";
else
  DOT := cat(currentdir(),"/");
end if:

try
  FileTools[Remove](cat(DOT,"/SimpleTest.mla"));
catch:
#  WARNING( "There was no previous MLA to remove. Proceeding." );
end try:

LibraryTools:-Create("SimpleTest.mla");
march('addfile', DOT, cat(DOT,"files/PrimesBack.jpg"), "PrimesBack.jpg");

initproc:=proc()
local found, maplet, x, IMAGELOC, TEMPDIR, IsValidDirectory;
    TEMPDIR := getenv(TEMP);
    IsValidDirectory := d -> evalb( d<>"" and FileTools[Exists](d) and FileTools[IsDirectory](d) );
    if not IsValidDirectory(TEMPDIR) then
        TEMPDIR:=cat(kernelopts(homedir),"/Temp/");
        if not IsValidDirectory(TEMPDIR) then
           error "unable to find directory for temp files";
        end if;
    end if;
    IMAGELOC := cat(TEMPDIR,"PrimesBack.jpg");
    found:=false;
    for x in libname while not found do
       try
          march('extractfile', x, "PrimesBack.jpg", IMAGELOC);
          found := true;
        catch:
       end try;
    end do;
    if not found then
        error "a problem occurred while attempting to extract the temp files."
    end if;
    use Maplets[Elements] in
    maplet := Maplet(
     [
       Label(Image(IMAGELOC)),
       "Did this maplet show an image stolen from the MaplePrimes website?",
       [
         HorizontalGlue(),
         Button("Yes", Shutdown("Image was shown")),
         Button("No ", Shutdown("Image was not shown")),
         HorizontalGlue()
       ]
     ] ):
    Maplets[Display](maplet);
    end use;
    try
        FileTools:-Remove(IMAGELOC);
    catch:
        error "a problem occurred while attempting to delete the temp files."
    end try;
end proc:
LibraryTools:-ActivationModule(cat(DOT,"SimpleTest.mla"),initproc);
The main changes I made were:
  1. began to provide cross-platform support (not thoroughly tested)
  2. fixed spelling of FileTools in Remove
  3. add the image with an indexname that is related to the image
  4. created local proc to clean up checking for a valid directory
This library archive is now posted on my personal website. It can be accessed at the URL http://www.math.sc.edu/~meade/TEST/SimpleTest.mla. Compare this to the original MLA created with InstallerBuilder. Not only is the installation cleaner, but the new MLA file is less than half the size of the original one. (It is still almost twice the size of the two files needed to run the maplet locally.) I do have one more desire. I would like to have the maplet open without any visual interference from the Maple interface. FAST FORWARD ONE HOUR A way to achieve this occurred to me while I was teaching. This is interesting enough that I will post it in a separate blog entry. It will appear as soon as it is composed. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Let's take this discussion in a slightly different direction. The distribution of Maple 11.01 included a new application, the Maple Reader. Very little documentation exists for this. I was successful in getting a sample file to use with the Maple Reader. I find it interesting that the file I received from Maplesoft was a .mla file. I do not know how they created it, and I have not tried to extract any information from it. I just thought it was interesting that it does appear Maplesoft has some plans to use MLAs in a way similar to what we are discussing here. I will add that the Maple Reader interface was pretty nice. I table of contents in the left column, and a worksheet displayed in the main window on the right. In my case, there wasn't much to display, but my maplet was launched once it was selected from the list on the left panel. Does anyone have more information about the Maple Reader? Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
I assume you wrote this for Linux. My initial attempts to use this in Windows were not successful. The initproc procedure raised an exception because found<>true ("a problem occurred while attempting to extract the temp files"). I have not had time to debug initproc to see if something needs to be different in the construction of TEMPDIR. Is it correct to put "files//PrimeBack.jpg" in the archive and to extract cat(TEMPDIR,"PrimeBack.jpg")? Once this is made more robust, I can see that it would be very easy to pass the maplet filename as an argument so that this could be used to automate the creation of the MLA files for an entire collection of maplets. Thanks for all of your efforts. I'll get back in touch when I have more time to look at this again. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Thanks for replying, but i tried to do the matrix by hand and the last row give me 0 0 0 0/ -744a - 8580b - 91d - 1374e and i concluded that if this matrix should give me a unique solution then -744a - 8580 b - 91d - 1374e = 0 I have not done the calculations, but this sounds correct to me. but the real question giving by the teacher is to find something like this and the i could discribe that the subset of E (for exemple ): (Discription): E {(a,b,c,d,e)∈R5∣ -744a -8580b - 91d - 1374e = 0} Again, this looks reasonable. a plan resembles to ax +by+cz = d but this (ax+by+cz+dw+ev=0) i don't know While ax+by+cz=d is a plane in 3-space, ax+by+cz+dw+ev=0 is a hyperplane in 5-space. With a right-hand side of 0, this hyperplane includes the origin. A normal vector to this hyperplane is <a,b,c,d,e>. All of the vectors in this plane form a subspace of R^5. If you can help me please) I hope this has been helpful, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Thanks for replying, but i tried to do the matrix by hand and the last row give me 0 0 0 0/ -744a - 8580b - 91d - 1374e and i concluded that if this matrix should give me a unique solution then -744a - 8580 b - 91d - 1374e = 0 I have not done the calculations, but this sounds correct to me. but the real question giving by the teacher is to find something like this and the i could discribe that the subset of E (for exemple ): (Discription): E {(a,b,c,d,e)∈R5∣ -744a -8580b - 91d - 1374e = 0} Again, this looks reasonable. a plan resembles to ax +by+cz = d but this (ax+by+cz+dw+ev=0) i don't know While ax+by+cz=d is a plane in 3-space, ax+by+cz+dw+ev=0 is a hyperplane in 5-space. With a right-hand side of 0, this hyperplane includes the origin. A normal vector to this hyperplane is <a,b,c,d,e>. All of the vectors in this plane form a subspace of R^5. If you can help me please) I hope this has been helpful, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
First 58 59 60 61 62 63 64 Last Page 60 of 76