mmcdara

640 Reputation

10 Badges

3 years, 44 days

MaplePrimes Activity


These are answers submitted by mmcdara

Hi, 

If you don't want to use a 'procedurelist' output and keep using an Array, you can buid a piecewise approximation of the second derivative where each "piece" is a 3rd order polynomial in x.
MaybeThis.mw

Nevertheless, as tomleslie said elsewhere in this thread (Rouben Rostamian too), you can easily isolate this second derivative from the original ode... then I'm not sure my answer is of any help ?

A simpler way:

E1 := x*y^3+5*x^2*y+3*a^2+4*x*y+z^2+3*x-y+z+2:
_order := 2:           # truncation order
vars   := [x, y, z]:   # truncation variables
mtaylor(E1, vars, _order+1);

Simpler.mw

 

Hi, 

 

Question 1:
There exits a package RootFindind with a procedure NextZero you could use In the same package. In the same package the procedure Isolate is also very useful.

Question 2: the content of the attached file could help you to get started

fsolve.mw 

Kitonum is right when he says "I think first you need to specify the values of the parameters  lambda  and  ."

You will find in the attached file a workaround:

  1. solve
  2. once the roots known, select the regions where 

A lot of work is to be done "by hand".

I would be interested to recieve the critics from Kitonum.

inequalitysolve.mw

Use of RunWorksheet:

  1. Load the file Run.mw
  2. Put it in some directory "/..../Run.mw"
  3. Open Maple In a new worksheet type the command 
    DocumentTools[RunWorksheet]( "/..../Run.mw", [r = .1, c = 1, mu = 1, Lambda = .1, fe = 20, fg = 5] )


Be careful: from my own experience RunWorksheet is very touchy to use.
Here are some constraints to respect (at least with Maple <= 2016):

  1. Build your worsheet with its 2 sections "Inputs" and "calculation" BEFORE adding the attributes "InputSectionTitle" and "Calculation" (InputSectionTitle must have "Inputs" as  a value; Calculation has value "default").
     
  2. Write each input in the "Inputs" section on separate lines.
     
  3. For RunWorksheet either works and returns a result, eirther doesn't work and remains silent, use "writeto(SometextFile)" at the beginning of the "Calculation" section (have a look to the attached file).
    Pay attention to the ending ";" or ":" which are easily omitted for the last command of a block.

Lastly, RunWorksheet has some limitations: 

  • you can't run a same worksheet on different processors/nodes by using the Grid package,
  • some graphical functions are not supported (if my meory serves: dualaxisplot, plotdevice(SomeFormat, ...), ...


 

 

Run.mw

 

 

 

Unless for polynomial systems for which you can specify the "maxsols" number of solutions to find, fsolve returns only one.
And of course the solution you get depends on your starting point (see fsolve[details] help page) or on the search interval you set (same help page).

An alternative is to use the function "Isolate" from package RootFinding.

You will find a few results in the attached file.

RootFinding.mw

 

Not knowing all the subtitlies of the way Maple works, my first reflex when the arrow operator doesn't return the expected result is to use "unapply".
It goes well here:

for i from 1 to 3 do
   f[i]:=unapply(P(i,1,1,x), x);
end do;


To Carl, vv and others: what are the pros and cons of all the solutions proposed here ?

 

Answer "by hand"

product(1-1/k, k = 2 .. infinity)     
= limit(product(1-1/k, k = 2 .. N), N=+infinity)    
= limit((1-1/2)*(1-1/3)*...*(1-1/N)), N=+infinity) 
= limit((1/2)*(2/3)*(3/4)*...*(1-1/N)), N=+infinity)   # the denominator of the term n is the numerator of term n+1
= limit(1/N, N=+infinity) 
=0

Simpler than expanding (1-1/2)*(1-1/3)*.... = 1 - 1/2 - 1/3 - 1/4 - ... + 1/2*1/3 + 1/2*1/4 + ... + 1/3*1/4 + ... + triple products + quadruple products + and so forth...



                 

Before receiving a more astute answer here is a solution

Matrix.mw


I'm not sure to understand what you mean by "there is a spur at node 5"?

Mor of this, with your  [[14, 16, 1], [1, 2, 2], [2, 3, 7], [3, 4, 1], [4, 5, 3], [5, 6, 6], [6, 7, 4], [7, 1, 3], [8, 9, 7], [9, 10, 3], [10, 11, 3], [11, 12, 1], [12, 13, 6], [13, 14, 3], [14, 8, 3], [5, 10, 3], [7, 8, 3]] definition there are 15 vertices and 17 edges, not 14 and 16 (if I'm not mistaken, unless you count vertex 16 as a particular "source node" ?).

Besides, when you write [1, 2, 2], for instance, does it mean "there exist an arc from 1 to 2 of cost 2" or "there exist on arc from 1 to 2 and one arc from 2 to 1, both of cost 2"?

I guess you already know that GraphTheory contains a DijkstrasAlgorithm procedure (maybe it doen't suit you because of this 
" spur at node 5" you mentioned). 
Just in case I send you this little worksheet

Dijsktras.mw 

Maybe writedata could be useful (it depends on the formats uou use)

Here is an example (to write in a file just change "terminal" by the name if the file)
N := 5:
A := Vector[row](N, i->i);
writedata(terminal, [convert(A, list)], [seq(float, n=1..N)]);
1    2    3    4    5


fd := fopen(MyFile):
writedata(fd, [convert(A, list)], [seq(float, n=1..N)]):
close(fd):

Hint: The product will be complicated algebraically and you will need to apply first expand, then simplify to reduce the product of the eigenvalues to an integer. First try to do for a single matrix , then make a loop to do it 8 times.] 

If this is the hint your teacher has given you, maybe it's not necessary to mention it here: let the people think they do not do you homework.
However this is a feeble hint: if you use RandomMatrix the resulting matrix contains only numbers (integers or floats depending on the  way you describe the generator [see the RandomMatriwx help page]).
Then Eigenvalues will return 3 numbers and their product trivial (no need to expand anything).
restart:
with(LinearAlgebra):
A := RandomMatrix(3, 3, generator=0..1.0):
EigA := Eigenvalues(A);
EigProduct := mul(Re~(convert(EigA, list)));
Determinant(A)

PS: if you want to verify that the product of the eigenvalues equals the determinant, it would be beter to generate a symbolic matrix :
A := Matrix(3, 3, symbol=a):

Question 1:Are you looking for a solution for this specific polynomial or for a solution metho for more general polynomials ?
Question 2: Whjat is for you the shortest monomial coefficient among these two: p+q+r and p*q*r ?
Question 3: what about if two monomoal coefficients have the same "length" according to your definition ?

 

For your specific case tou will find an answer in the attached file

ShortestMonomialCoefficient.mw

Just replace 
( Vector[row]
([seq

by
(Matrix(
(3, 2, [seq

I have no solution to propose, only an experience to share.

From my experience cmaple (Windows) and maple (unix/mac OS) have some limitations.
The use of ExcelTools seems effectively to be one of them. 

Some features contained in "recent" packages are not handled too :

  • Using functions from Grid package generate errors (Maple 2015, Maple 2016 with Windows)
  • Some functions from DocumentTools are not supported: this is rather normal when they refer to displays and plots, but RunWorksheet doesn't work.
  • If I'm not mistaken plotdevice  doesn't work too (at least in the situations I used it).


It's rather difficult to find a list of functions (if it even exists) that do not give the expected result when used with cmaple/maple, so, unfortunately, you eventually discover that by yourself when cmaple fails.

I did my grieving of all this: my opinion is that cmaple/maple are historical commands the evolution of which doesn't follow the evolution of xmaple. So I have adopted this pragmatic strategy: replace all the functions that are "not supported" by others which are.

For instance, when I faced a problem with ExcelTools:-Export, I replaced this command by a writedata/write.ImporttMatrix one (depending on the data to export).
Maybe you can do the same for ExcelTools:-Import: open you file with Excel, save it as a text file, and read it with a read/readdata ... command.

I hope someone here will give you better advices than I did
 

4 5 6 7 8 9 Page 6 of 9