Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

thank you for helping!! 

Hi, I'm trying to display (print / typeset) a vector of derivatives where an overdot is used instead of d/dt and the dependent variable is hidden.  For a single variable 

Suppress(x(t)):
diff(x(t),t);

Gives the desired result, but

Suppress(x(t)):
Suppress(y(t)):

<diff(x(t),t),diff(y(t),t)>;

doesn't.  I presume the vector/matrix package is doing something to the formatting?  Any help would be appreciated. Thanks.

Dears,  I have a questian about the fieldplot. 

I use the following 

with(plots):

fieldplot([x^2+y^2, 3*sin(x)-y^2], x = -1 .. 1, y = -1 .. 1, arrows = SLIM, color = x) ;

The domain is bounded from x = -1 .. 1, y = -1 .. 1.

Now, I want to use the same order to plot this function over a pentagon definde as 

with(plots):

Q11R := plottools[polygon]([[0, -1], [3/4, -1], [1, 0], [3/4, 1], [0, 1]], style = line, thickness = 3);

plots[display](Q11R, size = [.3, .5]).

I hope that I can find help.

Amr

 

I have a coupled pair of anharmonic oscillators and need to calculate the stability matrix and find the lyaupanov exponent for how the nearby trajectories diverge. In particular, I have the Hamiltonian

H = (p1^2+p2^2 + q1^4+q2^4 + 12*q1^2*q2^2 )/2

and I need to compute the matrix M given by

dM/dt = J*Hess*M

where J := Matrix(4,4,[0,0,1,0,  0,0,0,1,  -1,0,0,0,  0,-1,0,0]), and the Hessian takes the form:

Matrix(4,4, [6*q1_12(t)^2 + 12*Q2_12(t)^2, 2*12*Q1_12(t)*Q2_12(t),0,0,   2*12*Q1_12(t)*Q2_12(t), 6*Q2_12(t)^2 + 12*q1_12(t)^2,0,0,    0,0,1,0,    0,0,0,1])

The solver finds the trajectories of p1,p2,q1,q2 fine, but I don't seem to find a way to incorporate their solutions as inputs to reevaluate the Hessian at each time step. I read through https://www.maplesoft.com/support/help/Maple/view.aspx?path=DEtools%2fmatrixDE and the dsolve since I'm trying to do this numerically.

I thought I could get around this just by resolving the trajectories, but it's spitting out an error that arrays must be initialized with lists.

The actual code is here: AMO_HW4.mw

Sorry, I still need to clean it up a bit. Any help would be appreciated. I need to calculate M(t), then calculate the matrix norm and find the exponent.

 

 

 

 

Hello. I'm trying to calculate some RMS values for a school project. I've double and tripple checked that the forms and units are correctly entered, but it keeps giving me a result that is not convertable to the unit that i know it should output.
 

I've uploaded the file aswell as a picture of the project below:

Analyse.mw

Image: here
File on google drive: here

 

File is updated to include the answer from epostma 1299 , and (almost) works like charm (With exception of the possibility to convert the output unit)

Here is an image of my attempt with the piecewise functionality:

Image: here

 

 

Several years ago, acer posted a topic on how to overcome the limitation of hardware precision plotting drivers in Maple:

https://www.mapleprimes.com/posts/100884-Precision-And-Plot-Drivers

Currently, I want to plot (1-x)^(10^9) in the range of 0..10^(-15) smoothly.

plot((1-x)^(10^9), x=0..10^(-15)) does not work. Is there an updated option to this in Maple since 2011? 

 

How do I simplify the integral,  where a(u) and b(u) are T-periodic and s,t belongs to the interval [0,T]

I have been using CodeTools::Usage with Maple 17 to compare timings of a couple of matrix inversion routines against each other and against the Maple library routines LinearAlgebra::MatrixInverse and LinearAlgebra::Determinant.

The small section of code that I use to collect the cpu times for each method is:

----------------------------------------

udata := Usage(invTest(x,y,z,delta,mu), output=['cputime', 'bytesused'],
              iterations=nRepeats, quiet);
dat[1]:=udata[1]; dat[2]:=udata[2];

----------------------------------------
nRepeats has been set to 25.

In order to get the timings as accurate as possible, I only open a couple of terminal windows on my laptop so as to run the tests with as low a loaded machine as I can get. (I'm running Ubuntu 14.04 on an 8 core Intel (R) Core i7-3840QM, 2.8GHz CPU with 16Gb of memory.)

A test run consists of a sequence of test matrices each of which is run for an increasing sequence of matrix orders. I either time an implementation on its own or I time both an implementation and the Maple library routines. In the later case for each test matrix and order of matrix, I use Usage to first time the Maple routines and then the times for one of the implementations:

----------------------------------------

if compMaple then
udata := Usage(MatrixInverse(A), output=['cputime', 'bytesused'],
              iterations=nRepeats, quiet);
mdat[1]:=udata[1]; mdat[2]:=udata[2];

udata := Usage(Determinant(A), output=[cputime, bytesused],
              iterations=nRepeats, quiet);
mdat[1]:=mdat[1]+udata[1];
mdat[2]:=mdat[2]+udata[2];
else
  mdat[1..2] := 0:
end if:

udata := Usage(invTest(x,y,z,delta,mu), output=['cputime', 'bytesused'],
              iterations=nRepeats, quiet);
dat[1]:=udata[1]; dat[2]:=udata[2];

----------------------------------------

I have noticed the following:

a) If I time both Maple and an implementation, and the same implementation on its own I can get timings that vary up to a factor of 2 or more,

b) Changes in timings for the same test run and as close to the same environment as I can get (i.e., just the two user terminal windows open) can generate timing differences of up to 50%.

c) Sometimes `chaotic' timings are generated, for example,

    n = 150, t = 3 (secs)
    n = 200, t = 24 (secs)
    n = 250, t = 18 (secs)

which cannot be reflecting the times required to perform the calculations. This type of behaviour always seems to occur when the reported memory bytecount is increasing from ~0.25* 10^9 to over 10^9.

Is there anything I can be doing here to get more consistent timings?

I want to use the timings from these tests in a journal article so it would be good to have the same test run under very similar conditions to return timings within a few percent difference of one another. I certainly get this sort of tolerances (<10%) if I use the Fortran cpu_time intrinsic to time Fortran code.

Any advice would be gratefully received.

Hi, 

As an example, I have these 3 equations below and I need to balance them similar to balancing a chemical equation.

Equation 1: E1=A+B+C+D
Equation 2: E2=A-B+C-D
Equation 3: E3=C

So, I am wondering if there are any functions or algorithms that allow me to input such that they will give me a result of 

xE1 ± yE2 ± zE3 = wA

where w,x,y &z are integers and x,y & z can be zero. 

Thanks.

Ho do I print this?

A - lambdaI = some matrix

On the left of the equation I have the letter "A" a minus sign, the Greek letter "lambda" and the letter "I" right next to it.
The rest. from "=" on, is math.

Thank you!

mapleatha

I'm trying to create the set of monomials in n variables (given as a list var), up to a given degree d. Her eis my code. Any comments to make it better?

mondeg:=proc(var::list,d)
local n, mon, moni, i, j, m1, m;

   n:=nops(var);
   mon:={1};
   moni:={1};
   for i to d do
        for m1 in moni do
             #print(m1);
             moni:=moni minus {m1};
             #print(moni);
             for j to n do
                #print(var[j]);
                 m:=m1*var[j];
                 moni:=moni union {m};
                #print("moni=",moni);
             od;
        od;
        mon:=mon union moni;
        #print(mon);
   od;

mon;
end:

Often after using collect(expression,x) the prefactors of x are within a bracket but typically contain factors in each term of the bracket that are equal and not pulled out of the bracket. Is there a way to ask maple to automatically factor out these after collecting?

I hope it is clear what I mean...

Hi,
Triing to solve some 2 differential equations system (plan mechanical movement), using "output=" as last option, I am interrested by the values of the second derivatives of the coordinates. The "output" runs fine to get t, x(t), y(t), dx/dt(t) and dy/dt(t). To get d^2x/dt^2 and d^2y/dt^2, I thought it would work to write something like (A is the times array) this :

dsol := dsolve(dsys, type = numeric,  {diff(x(t),t,t), diff(y(t),t,t},output = A),

But if I do this, I get next error message :

Error, (in dsolve/numeric/process_input) dependent variables must be functions of a single unknown, the independent variable. Got [diff(diff(x(t), t), t), diff(diff(y(t), t), t)]


Could you please help me ?
Thanks

 

I generated a few plots using the plot command. When I try to animate them using the display command, only the first plot appears and not the rest. I can't figure out what the problem is. Any help is appreciated. I have attached below the commands I am using to generate the plots and animate them:

restart;
with(plots):
with(OrthogonalExpansions):

f := x -> x;
L := 1:
fexplt:=plot(f(x),x=-L..L):
fs := n->FourierSeries(f(x),x=-L..L,n,'Coefficients');
fs(n);
                  n                            
                -----                          
                 \          (1 + i)            
                  )   2 (-1)        sin(Pi i x)
                 /    -------------------------
                -----           Pi i           
                i = 1                          

nmax := 25:

display([seq(plot([f(x),fs(m)],x=-L..L),m=1..5)],insequence=true);
 

If I just use

seq(plot([f(x),fs(m)],x=-L..L),m=1..5);
 

I get all the five plots output to the screen.  So, I know the plots are there. It's the animation part that doesn't seem to work. I am using Maple 2015 on a linux mint desktop.

 

Thanks.

Hello all,

I am looking for a maple command to do the following

#outline of idea, is a user would pre-define a number of rows and a single Matrix command would automatically generate a Matrix based on the data the user provides.

numRows:= ;#user would enter a number here

row1:=[1,2,3];  #user enters data for each row

row2:=[4,5,6,7];

row4:=['red','blue',7];

#user will enter a few more rows to match numRows, specified above

Matrix([[row1],[row2],[row3],....,[rown]]);#this matrix command would be generated based on the above entered data

 

I was thinking some form of counter could do this?  Any suggestions would be appreciated.

First 893 894 895 896 897 898 899 Last Page 895 of 2215