Maple Questions and Posts

These are Posts and Questions associated with the product, Maple


 

with(LinearAlgebra)

A := Matrix(4, 4, {(1, 1) = 1, (1, 3) = -1, (1, 4) = 3, (2, 2) = 2, (2, 3) = 1, (3, 1) = -1, (3, 2) = 1, (3, 3) = 6, (3, 4) = -1, (4, 1) = 3, (4, 3) = -1, (4, 4) = 10}, fill = 0)

Matrix(%id = 18446746512315154430)

(1)

b := Matrix(4, 1, {(1, 1) = 0, (2, 1) = -2, (3, 1) = -1, (4, 1) = -1})

Matrix(%id = 18446746512315153574)

(2)

x := Matrix([[x1], [x2], [x3], [x4]])

Matrix(%id = 18446746512315146838)

(3)

f := proc (x) options operator, arrow; (1/2)*Transpose(x).A.x+Transpose(b).x end proc

proc (x) options operator, arrow; Typesetting:-delayDotProduct(Typesetting:-delayDotProduct((1/2)*LinearAlgebra:-Transpose(x), A), x)+Typesetting:-delayDotProduct(LinearAlgebra:-Transpose(b), x) end proc

(4)

(1/2)*Transpose(x).A.x+Transpose(b).x

Matrix(%id = 18446746512315132494)

(5)

while g(vk) < 10^(-6) do k end do

Error, cannot determine if this expression is true or false: (Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = -1, (1, 4) = 3, (2, 1) = 0, (2, 2) = 2, (2, 3) = 1, (2, 4) = 0, (3, 1) = -1, (3, 2) = 1, (3, 3) = 6, (3, 4) = -1, (4, 1) = 3, (4, 2) = 0, (4, 3) = -1, (4, 4) = 10})) . vk+(Matrix(4, 1, {(1, 1) = 0, (2, 1) = -2, (3, 1) = -1, (4, 1) = -1})) < 1/1000000

 

v0 := Matrix([[0], [1], [0], [0]])

Matrix(%id = 18446746512315172734)

(6)

g := proc (x) options operator, arrow; A.x+b end proc

proc (x) options operator, arrow; Typesetting:-delayDotProduct(A, x)+b end proc

(7)

alpha0 := solve(diff(f(v0-g(v0)*alpha)[1, 1], alpha) = 0)

1/10

(8)

v1 := v0-alpha0*g(v0)

Matrix(%id = 18446746512315163582)

(9)

v(k+1) := vk-`&alpha;k`*g(vk)

vk-`&alpha;k`*(Matrix(%id = 18446746512315154430).vk+Matrix(%id = 18446746512315153574))

(10)

`&alpha;k` := solve(diff(f(vk-g(vk)*alpha)[1, 1], alpha) = 0)

Hi, 
Essentially i am trying to programe an iterative loop where v(K+1) can be found fro v(K), I'm not sure how to programe a loop but I know this is not a hard thing to do so I am struggling, any help would be appreciated! Thanks. 
Edit: Also alpha K must be found at each stage by optimising f(v(k+1))
 

Download Optimisation_coursework.mw

Hello everyone!

I'm having some problem with this equation:

solve(0.1 = 23.714*(-0.93205)^2/(20.3+61.4*.884^x), x)

I'm trying to solve for x, but i keeps saying "Warning, solutions may have been lost."

Any ideas?
 

Hello,

What is the minimum period of the following equation.


 

d := evalf(expand((100+100*cos(6*t)+200*cos(12*sqrt(2)*t))^2))

40000.-2580480000.*cos(t)^2*cos(1.414213562*t)^6+604800000.*cos(t)^2*cos(1.414213562*t)^4-51840000.*cos(t)^2*cos(1.414213562*t)^2+2621440000.*cos(t)^6*cos(1.414213562*t)^12-7864320000.*cos(t)^6*cos(1.414213562*t)^10+8847360000.*cos(t)^6*cos(1.414213562*t)^8-4587520000.*cos(t)^6*cos(1.414213562*t)^6+1075200000.*cos(t)^6*cos(1.414213562*t)^4-92160000.*cos(t)^6*cos(1.414213562*t)^2-3932160000.*cos(t)^4*cos(1.414213562*t)^12+0.1179648000e11*cos(t)^4*cos(1.414213562*t)^10-0.1327104000e11*cos(t)^4*cos(1.414213562*t)^8+6881280000.*cos(t)^4*cos(1.414213562*t)^6-1612800000.*cos(t)^4*cos(1.414213562*t)^4+138240000.*cos(t)^4*cos(1.414213562*t)^2+1474560000.*cos(t)^2*cos(1.414213562*t)^12-4423680000.*cos(t)^2*cos(1.414213562*t)^10+4976640000.*cos(t)^2*cos(1.414213562*t)^8+720000.*cos(t)^2+274560000.*cos(1.414213562*t)^4-5125120000.*cos(1.414213562*t)^6+0.4942080000e11*cos(1.414213562*t)^8-0.2811494400e12*cos(1.414213562*t)^10+0.1013841920e13*cos(1.414213562*t)^12+0.1677721600e12*cos(1.414213562*t)^24-0.1006632960e13*cos(1.414213562*t)^22+0.2642411520e13*cos(1.414213562*t)^20-0.3984588800e13*cos(1.414213562*t)^18+0.3810263040e13*cos(1.414213562*t)^16-0.2406481920e13*cos(1.414213562*t)^14-5760000.*cos(1.414213562*t)^2+10240000.*cos(t)^12-30720000.*cos(t)^10+34560000.*cos(t)^8+1320000.*cos(t)^4-16000000.*cos(t)^6

(1)

``


 

Download period

 

 

When typing 

z:=exp(I*2*Pi/3);
convert(z,'sincos')

Maple evaluates the intermediate result which is cos(2*Pi/3)+I*sin(2*Pi/3) and  gives

Is there a way to tell it not to do this? I'd like to see the result as when typing

'cos(2*Pi/3)+I*sin(2*Pi/3)'

Is there an option or method to tell Maple not to immediate evaluation in the above? it can do evaluate next time the expression is used.

 


How to solve a system of partial equations with boundary conditions.I used this formula

restart;
sys_Pde := diff(V(x, t), x, x) = 0, diff(T(x, t), x, x) = 0;
          
BC := eval(diff(V(x, t), x), x = 1) = 0, eval(V(x, t), x = 0) = 1+cos(w*t), eval(T(x, t), x = 0) = 0, eval(T(x, t), x = 1) = 1;
pdsolve({sys_Pde});
   {T(x, t) = _F1(t) x + _F2(t), V(x, t) = _F3(t) x + _F4(t)}
pdsolve({BC, sys_Pde});


Error, (in PDEtools:-ToJet) found functions to be rewritten in jet notation, {V(1, t)}, having different dependency than the indicated in [V(x, t)]

 

I

have the following function phi(x,y) which depends on two unknown functions F1 and F2 which are differentiable.

Phi(x,y)=y sin(x y) + F1(y) + y^2 F2(x y)

Note that F1 and F2 are obtained by hand when I solve a partial differential equation

I would like to find  phi(x,y)  that satisfies phi=1 and diff(phi(x,y),y)=1-x^2*cos(x^2) on line y=x

 

constraint.mw

Thanks for your help

 

Hi, given the function f(t)=t^2. Determine the Fourier coefficients a_0, a_1 and b_1 for f(t). Plot the graphs for f(t) and also plot the graphs for the Fourier sum F(t) with N=1 in the same coordinate system. Let the t-axis go from 0 to 2*Pi.

Can someone help with this?

Thanks

I have a system of linear equations with a fixed number of equations, but the stracture of the system varies in T. I have solved the system for a fixed T and have to run for each value of T, which is quite boaring. I want to solve the system by a single run for multiple T values using a for loop. When I tried with the code, I got the following error.

Error, (in LinearAlgebra:-GenerateMatrix) invalid subscript selector


t.mw

L:=[1,2,0,4]:
s := sum(1/L[i], i=1..nops(L));

Error, (in limit/mrv/limsimpl) too many levels of recursion

So, this error cannot be caught by try

try    # bug
  s := sum(1/L[i], i=1..nops(L));
  catch:  s:=infinity
end try;

Error, (in limit/mrv/limsimpl) too many levels of recursion

Strangely, for L:=[1, 2, 0.0, 4]  it's OK.

Everything works with add instead of sum, but this is another thing.

 

  I want list all  diameter-2  Nonisomorphismgraphs  of order n . I use the following code, but its running speed  is slow with  order of graph gradually increasing . (for example,n=10)
 Are there other ways to Improve it? 
restart:
with(GraphTheory):
Graphs_data:=[NonIsomorphicGraphs(4,restrictto =[connected], output = graphs, outputform =graph)]:
Diameter_select:=select[flatten](t->Diameter(t)=2,Graphs_data):
DrawGraph(Diameter_select,size=[50,50]);

  By the way,  Why doesn't size=[50,50] work ?

 
                       
                   
               
               
           
           
               
                   
                 

Hi,

How can find the range of  the parameter k, such that f(x)=b ( for a given b in the set of real number R) we have a unique solution of the equation f(x)=b 

 

Many thanks for your help

Hello,

I'm trying to solve a system of ODE in a model of infectious disease. But, unfortunately, when I try to plot the curves, I get the following error message: Error, (in fproc) unable to store '-1.*HFloat(0.0)[1]' when datatype=float[8]. The code is here

restart;
with(plots);
Q := 1000; a := .9; b := 0.8e-3; mu := 0.247e-2; k := .2; y := 0.2e-1; e := .5; g := .5; T := 8; n := 100;
sigma[1] := 0.5e-1; sigma[2] := 0.9e-1; alpha[1] := 0.52e-2; alpha[2] := 0.52e-2; delta[1] := .8; delta[2] := .904; delta[3] := .8; c[1] := 50; c[2] := 250; c[3] := 50; w[1] := 140; w[2] := 130; w[3] := 150; w[4] := 160;
u[1] := min(max(0, z), 1); z := (a*i[p](t)*(i[p](t)+i[pm](t))*(lambda[4](t)-lambda[3](t))+a*s(t)*(i[p](t)+i[pm](t))*(lambda[1](t)-lambda[2](t)))/(n.w[1]); u[2] := min(max(0, c), 1); c := (b*(i[m](t)+i[pm](t))*s(t)*(lambda[3](t)-lambda[1](t))+b*(i[m](t)+i[pm](t))*i[p](t)*(lambda[4](t)-lambda[2](t)))/(n.w[2]); u[3] := min(max(0, j), 1); j := (i[p](t)*lambda[2](t)+i[pm](t)*(lambda[4](t)-lambda[7](t))-(i[p](t)+i[pm](t))*lambda[5](t))/w[3]; u[4] := min(max(0, o), 1); o := (i[m](t)*lambda[3](t)-i[pm](t)*(lambda[4](t)-lambda[7](t))-(i[m](t)+i[pm](t))*lambda[6](t))/w[4]; u[2] := 0; u[3] := 0;
;
sys := diff(s(t), t) = Q+delta[1]*r[p](t)+delta[2]*r[m](t)+delta[3]*r[pm](t)-(a*(1-u[1])*(i[p](t)+i[pm](t))/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+mu)*s(t), diff(i[p](t), t) = (1-u[1])*a*(i[p](t)+i[pm](t))*s(t)/n-(1-u[2])*b*(i[m](t)+i[pm](t))*i[p](t)/n-(sigma[1]+u[3])*i[p](t)-(alpha[1]+mu)*i[p](t), diff(i[m](t), t) = (1-u[2])*b*(i[m](t)+i[pm](t))*s(t)/n-(1-u[1])*a*(i[p](t)+i[pm](t))*i[m](t)/n-(sigma[2]+u[4])*i[m](t)-(alpha[2]+mu)*i[m](t), diff(i[pm](t), t) = (1-u[2])*b*(i[m](t)+i[pm](t))*i[p](t)/n+(1-u[1])*a*(i[p](t)+i[pm](t))*i[m](t)/n-(y+u[3]+u[4])*i[pm](t)-(alpha[1]+alpha[2]+mu)*i[pm](t), diff(r[p](t), t) = (sigma[1]+u[3])*i[p](t)+(e*y+u[3])*i[pm](t)-(delta[1]+mu)*r[p](t), diff(r[m](t), t) = (sigma[2]+u[4])*i[m](t)+(y*g*(1-e)+u[4])*i[pm](t)-(delta[2]+mu)*r[m](t), diff(r[pm](t), t) = (y*(1-g)*(1-e)+u[3]+u[4])*i[pm](t)-(delta[3]+mu)*r[pm](t), diff(lambda[1](t), t) = lambda[1](t)*(a*(1-u[1])*(i[p](t)+i[pm](t))/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+mu)-lambda[2](t)*(1-u[1])*a*(i[p](t)+i[pm](t))/n-lambda[3](t)*(1-u[2])*b*(i[m](t)+i[pm](t))/n, diff(lambda[2](t), t) = -c[1]+lambda[1](t)*(1-u[1])*a*s(t)/n-lambda[2](t)*((1-u[1])*a*s(t)/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+sigma[1]+u[3]+alpha[1]+mu)-lambda[4](t)*(b*(1-u[2])*(i[m](t)+i[pm](t))/n+(1-u[1])*a*i[m](t)/n)-lambda[5](t)*(sigma[1]+u[3]), diff(lambda[3](t), t) = -c[2]+lambda[1](t)*(1-u[2])*b*s(t)/n+lambda[2](t)*(1-u[2])*b*i[p](t)/n-lambda[3](t)*(u[4]+alpha[2]+sigma[2]+a*(1-u[1])*(i[p](t)+i[pm](t))/n-(1-u[2])*b*s(t)/n)-lambda[4](t)*((1-u[2])*b*i[p](t)/n+a*(1-u[1])*(i[p](t)+i[pm](t))/n)-lambda[6](t)*(sigma[2]+u[4]), diff(lambda[4](t), t) = -c[3]+lambda[1](t)*((1-u[1])*a*s(t)/n+(1-u[2])*b*s(t)/n)-lambda[2](t)*((1-u[2])*b*i[p](t)/n+(1-u[1])*a*s(t)/n)-lambda[2](t)*((1-u[2])*a*i[m](t)/n+b*(1-u[1])*s(t)/n)-lambda[4](t)*(y+u[3]+u[4]+alpha[1]+alpha[2]+mu-(1-u[2])*b*i[p](t)/n-b*(1-u[1])*i[m](t)/n)-lambda[5](t)*(e*y+u[3])-lambda[6](t)*(y*g*(1-e)+u[4])-lambda[7](t)*(y*(1-g)*(1-e)+u[3]+u[4]), diff(lambda[5](t), t) = -lambda[1](t)*delta[1]+lambda[5](t)*(delta[1]+mu), diff(lambda[6](t), t) = -lambda[1](t)*delta[2]+lambda[6](t)*(delta[2]+mu), diff(lambda[7](t), t) = -lambda[1](t)*delta[3]+lambda[7](t)*(delta[3]+mu), i[p](0) = 300, i[m](0) = 200, i[pm](0) = 150, r[p](0) = 200, r[m](0) = 150, r[pm](0) = 150, s(0) = 1000, lambda[1](T) = 0, lambda[2](T) = 0, lambda[3](T) = 0, lambda[4](T) = 0, lambda[5](T) = 0, lambda[6](T) = 0, lambda[7](T) = 0;
p1 := dsolve({sys}, type = numeric, method = bvp[midrich], abserr = 0.1e-5, maxmesh = 2400);
Error, (in fproc) unable to store '-1.*HFloat(0.0)[1]' when datatype=float[8]
p2o := odeplot(p1, [t, i[p](t)], 0 .. 3, numpoints = 100, labels = ["Time (Months)", " Population"], labeldirections = [horizontal, vertical], style = line, color = green, axes = boxed);
 

Can anyone help me please? I read some related problems here, but couldnt find a solution yet.

Thanks for your time

Best regards

hye, can someone help me to solve nonlinear schrodinger equation using maple? i attach with document

solution_nonlinear.pdf

  Hello: 
     We know The FindMaximalElement(L) function returns the largest element of the list L .
   My questions is  How do I find the second largest element in a list and its index?  
     Since there are so many lists to consider , Algorithmic Complexity may be as low as possible.
     More generally, we want to find the third-largest  element and so on.
     For instance, Given a list [3,2,3,6,8], we want to get 6 and 4 , since 6 is the  second largest element and 4 is its index. 
    Thank you in advance for your help.
  Licheng

 

Did someone already made a Pointplot3d for a Principal Components Analysis with projections for some data points on the eigenvectors?

I like this example very much:

http://www.joyofdata.de/public/pca-3d/

but I want to add projections on the three eigenvectors for some data points. I think it has to do something with the dot product, but I do not know how to do it in Maple. 

Hopefully someone already did this and is willing to share it.

kind regards,

Harry

 

First 686 687 688 689 690 691 692 Last Page 688 of 2218