Maple 2015 Questions and Posts

These are Posts and Questions associated with the product, Maple 2015

Hi, i'm working with some spectral acceleration data and i'm having troubles with a 'local' command on a Newmark method code i found on the internet. I'm not a maple expert so i wish someone could help me. i'm ussing maple 2015. Greetings

Newmark=proc(z0,u0,F0);  local beta,  dt, c, kg,a,b, N, i, dF, dz, du, dw, T, m, k ;        dt:=0.01;    T:=4;    N:=T/(dt);    gam:=0.5;    beta:=0.25;      m:=0.320;    k:=435;    c:=2;   z(0):=z0;   u(0):=u0;   F(0):=F0;   w(0):=(1/(m))*(F0-k*z0-c*u0);        t=vector(i,1);    t[1,1]=0;      for i from 2 to N do :  t(i,1)=t(i-1,1)+dt:  end do:           kg:=k+(gam*c)/(beta*dt)+m/(beta*dt*dt);    a:=m/(beta*dt)+(gam*c)/(beta);    b:=  (0.5*m)/(beta)+dt*((0.5*gam)/(beta)-1)*c;       for i from 2 to N do  dF(i):=diff(F,t)+a*u(i)+b*w(i);    dz(i):=(dF(i))/(kg);    du(i):=((gam*dz(i))/(beta*dt))-((gam*u(i-1))/(beta))+dt*(1-gam/(2*beta))*w(i-1);    dw(i):=((du(i))/(beta*dt*dt))-((u(i-1))/(beta*dt))-((w(i-1))/(2*beta));     z(i+1)=dz(i)+z(i);    u(i+1):=du(i)+u(i);    w(i+1):=dw(i)+w(i);     od;       plot([z(i), u(i), w(i)],x=0..50,y=-50..50);       end;

I have the following Polynomial F. Computing the genus shows that this curve has negative genus and thus is reducible. But using AFactor doesn't produce a factorization. Any ideas?

with(algcurves):
F := z^9+(-3/2+(3/2*I)*sqrt(3))*y^3*z^6+(-3/2-(3/2*I)*sqrt(3))*x^3*z^6+(-3/2-(3/2*I)*sqrt(3))*y^6*z^3+(-3/2+(3/2*I)*sqrt(3))*x^6*z^3+y^9+(-3/2-(3/2*I)*sqrt(3))*x^3*y^6+(-3/2+(3/2*I)*sqrt(3))*x^6*y^3+x^9-3*(x*y*z)^3:
z:=1:
genus(F, x, y);
evala(AFactors(F));

Hello,

I have two simple module's:

1) ------------------------------------------------------------------------

Point := proc(xx::float,yy::float)
    return module()
        local x := xx,y := yy;
        export ShowPoint,GetX,GetY;
        
        ShowPoint := proc()
            printf("Point X,Y -> [%f,%f]",x,y);
        end proc;

        GetX := proc()
            return x;
        end proc;        
        GetY := proc()
            return y;
        end proc;    
    end module:
end proc:

2) ------------------------------------------------------------------------

PointMath := module()
    option package;  
    export `+`;
    
    `+` := proc(a::Point(float,float),b::Point(float,float))
        option overload;
        Point(a:-GetX()+b:-GetX(),a:-GetY()+b:-GetY());
    end proc;
end module:

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

Next I use first module:

p1:=Point(1.2,1.4);

p2:=Point(1.0,2.0);

Finally I want to add above two points:

with(PointMath)

p2:=p1+p2

The results is:

p2:=p1+p2

Why is not called operator '+' and two points are not added?

Best,

Rariusz

 

 

 

I want to use maple2015 to perform a Monte-Carlo simulation of a one dimensional Harmonic Oscillator.

Consider a particle having displacements, x=na where n is an integer, i.e 0 plus minus one, etc.

The potential energy of the particle is given by U(x)= 1/2 kx^2 = 1/2 ka^2 n^2.

For this simulation will choose ka^2 = 0.01 k_B T where k_B is Boltzmann's constant, and T is the temprature in Kelvin.

So we should perform a Monte-Carlo simulation starting from x(0)=20a, and perfroming individual steps by selecting an attmept to move x=+-a ,with equal probability, and choose whether to make the actual step according to energy change expected in that step.

I need to draw particle's position and x(t), and particle's energy E(t).

After that I need to calculate and draw the autocorrelation functions \phi_x(t) and \phi_E(t).

I found some code that might help me, but I am nor sure how to implement the above two lines on maple; your help is appreciated.

http://pubs.acs.org/doi/suppl/10.1021/ed100414p/suppl_file/ed100414p_si_001.pdf

 

Each day
a:=a+5% of a -(0.1% of a+b)-10

b:=b+5%of b -(0.1% of a+b)-10
In how many days i have a+b=0?

All the 3d plot in my maple are upside down.....the tickmarks..the numbering even the lebeling are also upside down...how do i solve it....plz help

Hello,

On a plot, how do I change the size of the probe info text box ? I cannot read the very small text displayed when the probe info is active. My laptop screen size is only 13 inches.

Thank you

I have a piecewise that exists on a large intervals, say [-5..15], however, I know need the function to represent [1..9].

There are two approaches I know of: using convert(f,pwlist) or using op(n,f), see attachments. PiecewiseTruncate.mw    and  PiecewiseTruncate.pdf

However, these two methods are not elegant enough, I have to reassemble the pieces in the new function.

How to make the solution neat?

Thanks,

I really want to use if condition inside of eval and sum, example as below:

sum(eval(y=x^(j),(if j=1 then x=2 else x=3 fi)),j=1..2)

The reason is: the value of x to be evaluated depends on the value of j which differs inside of the sum (in the context of B-spline functions).

Any lights? Thanks,

I have many integrals which I would like to calculate the value. The one in attachment is the simpliest example.

It shows 'too many level of recursion',

I know that it has something to do with the piecewise, however, it shouldn't, right? Any insights?

evalfandintPerformance.mw

evalfandintPerformance.pdf

When using maximize on a relatively complicated function (see attached Maple file and PDF), it runs extremely slow. No return after 3 minutes.

My hardward: i7 2.3G, 8G DDR3 MEM, 500G SSD.

Maybe someone is interested to try the Maple code if your workstation is more powerful? :)

MaximizePerformance.mw

MaximizePerformance.pdf

I hope to dynamically generate the function name via for loop, see enclosed Maple file and PDF file.

Any lights are appreciated.

CatOrCombineFunctionName.mw

CatOrCombineFunctionName.pdf

I am trying to do fsolve in a range (-7..14), however, it gives no solution.

But when I solve the same equations with solve (after removing all the Imaginary solutions), I get two results, one of them is in the range (-7..14). 

I even expanded the range of fsolve, say (-10..20), but still got no solution...

This is just getting weirder and weirder. Attached kindly find the Maple file, note that the first solve takes about 1 minute (on my laptop: CPU i7 + MEM 8G + SSD).

fsolve_In_Range.mw

I have a program:

Running abb(1,3) gives error: Error, (in abb) illegal use of a formal parameter

Might be a silly question: Is it not allowed? Do I have to define a local variable for b in order to change it?

Dears,

I have a question and I hope someone will be able to answer it.

I would like to create a matrix of functions depending on the number of the line or the arrow. I think the best is to show with a very basic example:

I have the following program

n:=4:

R:=Matrix(1,n):

for i from 1 to n do: R(1,i):=x->i*x:end do:

So, I have a matrix, one row, n columns. At the ith column, I want to have the function f(x)=i*x.

Unfortutanely, with my program, I obtain for example for the first column the function f(x)=11*x. At the second column, I get the same result. It seems that I can define matrices of functions but it is impossible in the definition of the function to use the number of the column. Do you have any idea about how to write a program?

Any help would be very appreciated. 

 

 

1 2 3 4 5 6 7 Last Page 3 of 45