MaplePrimes Questions

This problem has real world applicability: Three vampires and three maidens are at the foot of a tall building and wish to get to the bar on the top floor.  The lift only holds two people (for convenience I am classing vampires as people), and needs one person to operate it.  If ever the vampires outnumber the maidens at any place, they will do something unspeakable.  How can the vampires and maidens all safety get to the top in the minimum of moves?  http://tonysmaths.blogspot.com.au/2012/05/vampires-and-maidens-problem.html

can this be solved procedurally or using optimization package?

possible manual soln:

No. m>= No. v

3m+3v, 0   [0]

2m+2v,m+v [1]

3m+2v,v  [2]

     3m, 3v [3]

3m+v , 2v  [4]

m+v  , 2m+2v [5]

#then reverse the steps

2m+2v, m+v [6]

       2v, 3m+v [7]

       3v, 3m  [8]

        v , 3m+2v [9]

    m+v, 2m+2v [10]

        0, 3m+3v [11]

 

I'm looking at Maple as a possible alternative to Mathcad (which I've been using for years, but is now very jaded compared to other options like Maple and Mathematica).  I'm a civil engineer and for what I do, one of the better features of Mathcad is the way it handles units.  For example, if I specify an angle in degrees (say phi=30 degrees) and then ask for sin(phi), I get 0.5.  At face value, I though Maple would do the same kind of thing.  However, this doesn't appear to be the case (see attached worksheet).  The only workaround that I can see is to specify the angle in degrees (but without assigning ) and then multiply the specified value by pi/180 (to convert to radians) before passing it to the sin function.  Which is all a bit messy and not at all an attractive solution.

Am I misunderstanding the way units work in Maple and is there a clean way of specifying angles in degrees (which is what engineers work with) and using these values directy in trig functions?

Thanks in anticipation,

Ian

If a dosage Q units of a certain drug is administrated to an individual, then the amount remaining in the bloodstream at the end of t minutes is given by Q*exp^-ct, where c>0. Suppose this same dosage is given at successive T-minute intervals.

 

a) Show that the amount A(k) of the drug is given by A(k) = ∑n=0k-1 Q*exp(^-ncT).

b) Find an upper bound for the amount of the drug in the bloodsteam after any number of doses.

c) Find the smallest time between doses that will ensure that A(k) does not exceed a certain level M for M>Q.

What is the right syntax to solve :

min {sum(i=1 to 10) sum(j=1..10) (a_i_j)*(x_i)*(x_j) 

s.t sum(i=1..n) (b_i)*x_i=p and sum(i=1..n)x_i=1 

if a_i_j is a constant, b_i is a constant, p is a constant and x_i, x+j are the decision variables?

I understand that this is a quadratic programming problem and an application of Markowitz optimization. I've tried to use the in-built minimize function but haven't got the right output.

I am very new to Maple and am wondering how i would install a package. The package I am trying to install is located at

http://math.rutgers.edu/~russell2/papers/IdentityFinder 

I am using Maple 2015 on windows 8. Any advice would be useful

Good day everyone,

please how can one solve this pde in terms of Bessel function or any other analytic solution with the plot.

See the file ID.mw

Thanks.

I am currently learning about nonlinear waves and and am having problems with my maple coding where I am plotting the characteristics of the initial value problem

$u_[t] + uu_[x] = 0$ where $u(x,t) = a$ if $x < -1$

                                               = $b$ if $ -1 < x < 1$

                                               = $c$ if $ x > 1$

where $a$, $b$ and $c$ are unequal constants. Also, there are 6 cases to this, $a > b > c$, $a > c > b$, $b > a >c$, $b > c > a$, $c > a > b$ and $c > b > a$. In each case I need to plot the characteristics (and where possible plot the rarefaction waves, but this bit is not necessary right now). My problem is that I am highly certain that my code is incorrect as I am unsure where/how to implement the fact that $a$, $b$ and $c$ vary since there are different cases. My current code is down below

 

 

restart: with(plots): with(plottools): with(PDEtools):
ploti:= implicitplot({seq(t*((k/2))+k/2-x,k=-10..-1)},x=-10..10,t=0..10,view=[-5..5,0..5],color=blue,thickness=2):
ploti2:= implicitplot({seq(t*(k/2)+k/2-x,k=-1..1)},x=-10..10,t=0..10,view=[-5..5,0..5],color=red,thickness=2):
ploti3:= implicitplot({seq(t*((k/2))+k/2-x,k=1..10)},x=-10..10,t=0..10,view=[-5..5,0..5],color=yellow,thickness=2):
display(ploti,ploti2,ploti3);

Any help would be much appreciated

 


 \int_{a}^{b} f(x) \, dx \approx \tfrac{3h}{8}\left[f(x_0) + 3f(x_1) + 3f(x_2) 
+ 2f(x_3) + 3f(x_4) + 3f(x_5) + 2f(x_6) + ... + f(x_n)\right] .


A Fantastic Good morning Ladies and Gentelmen,

You have the mission to find the problem in that code/ give a better code?
I want to write a procedure for the simpson 3/8 rule using the above formula I took from wikipedia :
(I don't want to use any super maple command that estimate the simpson 3/8, but just using this formula and starting from scratch, I am a beginner so feel free to laugh at my code hehehe)
here is the code I managed to write after 365 hours :D

restart:
simp38:=proc(f,x0,xn,n)                 
     local h,summ,i,x,Integral:                                              
     h=evalf((xn-x0)/n);               #h is the distance between 2 points
     summ:=f(x0)+f(xn);              #initialise the summ
    
      for i from 1 to n-1 by 3 do             
          x[i]:=x0+i*h:
          summ:=evalf(summ+3*f(x[i])):
      od:
      for i from 2 to n-1 by 3 do              
          x[i]:=x0+i*h:
          summ:=evalf(summ+3*f(x[i])):
      od:
      for i from 3 to n-1 by 3 do                  
          x[i]:=x0+i*h:
          summ:=evalf(summ+2*f(x[i])):  
      od:
    
      Integral:=3*h/8*summ;                  
 end:

simp38(x->(x^5-5.15*x^2+8.55*x-4.05045),1,5,6);   #testing it      --->2481.087090
evalf(int(x^5-5.15*x^2+8.55*x-4.05045,x=1..5));      #comparing it --->2477.531533


Your help will be apreciated.


Hi

Do the following equation solve by method of line(MOL) with this software?

du/dt=0.01 d^2u/dx^2

conditions:

u(x,0)=10

u(0,t)=0

u(1,t)=0

t=1,delta t=0.1,x=1,Nx=10

thank you

hello everyone, I have problem in my project written by matlab to solving my equations with rang-kuta 4 order method. I send my project file.  please help me to run it correctly. thank you.

input Q_j n j V Z F_ve a_1 a_2 p_1 p_2 L A f m k c h t i;

for jj=1:n;

            s=Q_j(jj);

end

b=(-V)*Z;

o=(F_ve*A)*(((a_1^2)*p_1)-((a_2^2)*p_2))/L;

% RK4 method;

% md2z/dt2+cdz/dt+kz=f;

% dz_1/dt=z_2;

% mdz_2/dt+cdz_1/dt+z_1k=f;

% dz_2/dt=1/m(f-cz_2-kz_1);

f=0;

m=1;

k=s+b+o;

c=0;

h=0.5;

t=0:0.5:t;

z1=zeros (1,n);

z2=zeros (1,n);

z1 (1)=0;

z2 (1)=1;

% N=length (t);

f1=@(t,z1,z2)z2;

f2=@(t,z1,z2)f-(c*z2)-(k*z1);

for i=1:n-1;

    k1=f1 (t (i),z1 (i),z2 (i));

    m1=f2 (t (i),z1 (i),z2 (i));

    k2=f1 (t (i)+h/2,z1 (i)+0.5*k1*h,z2 (i)+0.5*m1*h);

    m2=f2 (t (i)+h/2,z1 (i)+0.5*k1*h,z2 (i)+0.5*m1*h);

    k3=f1 (t (i)+h/2,z1 (i)+0.5*k2*h,z2 (i)+0.5*m2*h);

    m3=f2 (t (i)+h/2,z1 (i)+0.5*k2*h,z2 (i)+0.5*m2*h);

    k4=f1 (t (i)+h,z1 (i)*k3*h,z2 (i)*m3*h);

    m4=f2 (t (i)+h,z1 (i)*k3*h,z2 (i)*m3*h);

    z1 (i+1)=z1 (i)+(h/6)*(k1+(2*k2)+(2*k3)+k4);

    z2 (i+1)=z2 (i)+(h/6)*(m1+(2*m2)+(2*m3)+m4);

end

plot (t,z1)

plot (t,z2)

plot (z,t)

 

 

 

 


can anybody help me..? why my graph not come out? Is that any mistake in my coding?

restart

y := x^2-x*(exp(I*k*`&Delta;x`)+exp(-I*k*`&Delta;x`)-m^2+m^2*((4*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3))*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3)*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3))*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3)/(epsilon*((((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3)*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3))*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3+((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3))+(((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3)*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3))*((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3+((1^2-2)*cosh(1+1)-4*sinh(1+1)+1^6*cosh(1+1)^3)))))+1;

x^2-x*(exp(I*k*`&Delta;x`)+exp(-I*k*`&Delta;x`)-m^2+2*m^2*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(epsilon*(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3)))+1

(1)

subs(m = 1-exp(-m), %);

x^2-x*(exp(I*k*`&Delta;x`)+exp(-I*k*`&Delta;x`)-(1-exp(-m))^2+2*(1-exp(-m))^2*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(epsilon*(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3)))+1

(2)

subs(epsilon = .17882484, %);

x^2-x*(exp(I*k*`&Delta;x`)+exp(-I*k*`&Delta;x`)-(1-exp(-m))^2+11.18412856*(1-exp(-m))^2*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3))+1

(3)

subs(k = n*Pi, %);

x^2-x*(exp(I*n*Pi*`&Delta;x`)+exp(-I*n*Pi*`&Delta;x`)-(1-exp(-m))^2+11.18412856*(1-exp(-m))^2*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3))+1

(4)

subs(`&Delta;x` = m, %);

x^2-x*(exp(I*n*Pi*m)+exp(-I*n*Pi*m)-(1-exp(-m))^2+11.18412856*(1-exp(-m))^2*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3))+1

(5)

subs(m = 0.1e-2, %);

x^2-x*(exp((0.1e-2*I)*n*Pi)+exp(-(0.1e-2*I)*n*Pi)-(1-exp(-0.1e-2))^2+11.18412856*(1-exp(-0.1e-2))^2*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3))+1

(6)

j := subs(n = 1, %);

x^2-x*(exp((0.1e-2*I)*Pi)+exp(-(0.1e-2*I)*Pi)-0.9990006498e-6+0.1117295170e-4*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3))+1

(7)

complexplot3d(x*j, x = -2-I .. 2+I);````

complexplot3d(x*(x^2-x*(exp((0.1e-2*I)*Pi)+exp(-(0.1e-2*I)*Pi)-0.9990006498e-6+0.1117295170e-4*(-cosh(2)-4*sinh(2)+cosh(2)^3)^2/(-2*cosh(2)-8*sinh(2)+2*cosh(2)^3))+1), x = -2-I .. 2+I)

(8)

a := fsolve(x*j, x);

0., .9865070072, 1.013677544

(9)

b := fsolve(x*j, x = 1);

0., .9865070072, 1.013677544

(10)

with(plots):

complexplot({a, b}, numpoints = 100, color = green, filled = true, title = "Stability Region");

 

``

``

``


Download Stability_1.mw

Hi everyone!

I use two "ArrayTools:-Copy" commands to copy elements from Vector A to Vector B.

restart;
A := LinearAlgebra:-RandomVector(10); A := convert(A, Vector[row]);
B := Vector[row](10); ArrayTools:-Copy(2, A, 1, B, 1); ArrayTools:-Copy(2, A, 7, B, 7); B;

My question is: Could I obtain the same result using only one command?

P.S. I tried to use "ArrayTools:-BlockCopy", but didn't get correct result.

 

I want to retrieve all the commands input by user in a maple document saved on disk. How this can be done? DocumentTools:-Retrieve permits to receive only the labeled expressions but not the input commands.

The following error occurred when I simulate a build-in model, anyone could help me to solve this problem? Thanks first

Hi
how can we write a same result n-times near each other


x:=3:
for i from 1 to 4 do       # here the 4 can be a variable and can change...
    x;
    od;
                                  3
                                  3
                                  3
                                  3

I need the result to come in that form  :    3  ,  3  ,  3  ,  3
and because the number of times can change i can't just easily write x,x,x,x;

thanks in advance

First 1278 1279 1280 1281 1282 1283 1284 Last Page 1280 of 2430