MaplePrimes Questions

How do  I solve system of differential equations in finite difference method or finite element method?

eq1 := (diff(f(x), x, x, x))*(a*beta*f(x)^2-1)+(diff(f(x), x))^2-2*a*beta*f(x)*(diff(f(x), x))*(diff(f(x), x, x))+(diff(f(x), x))*(M+k[1])-(diff(f(x), x, x))*f(x)-(alpha*theta(x)+delta*phi(x))/rho = 0;

eq2 := -(diff(theta(x), x, x))*K[SB]*(Df-(Rd+k[hnf]/k[bf])/Pr)+N[t]*K[SB]*(diff(theta(x), x))^2-N[b]*(diff(theta(x), x))*(diff(phi(x), x))-(diff(f(x), x))*(diff(theta(x), x))-lambda*theta(x)-mu*Ec*(M*(diff(f(x), x))^2+(diff(f(x), x, x))^2) = 0;

eq3 := diff(phi(x), x, x)+Le*Sr*(diff(theta(x), x, x))+Le*f(x)*(diff(phi(x), x)) = 0;

ics := f(0) = 0, (D(f))(0) = 0, theta(0) = 1, phi(0) = 1;

bcs := (D(f))(100) = 0, theta(100) = 0, phi(100) = 0;


Parameters1 := rho = 2063.905, k[hnf] = .29942, k[bf] = .2520, mu = .38694, a = .1, beta = 5, k[1] = 2.0, M = 10, alpha = 20, delta = 20, K[SB] = .5, Df = 3, Pr = 1.2, Rd = 5, N[t] = 1.2, N[b] = 1.0, lambda = 1.5, Ec = 5, Le = .1, Sr = .1;

 

 

I know that I can have Websource and WebSink at the beginning and end of the web. However, when the roller is set to a variable roller, the following error occurs when connecting the websource and websink. I would like to know why the error occurs and what I should do.

How to solve delay differential equations in maple?

restart;
with(PDETools);
eq1 := (D(x))(t) = 2*a[4]*y(t)-c[1]*z(t)*x(t)-d[2]*x(t)-a[1]*x(t-tau);

eq2 := (D(y))(t) = a[1]*x(t-tau)-d[3]*y(t)-a[4]*y(t)-c[3]*z(t)*y(t)-k[1]*(1-exp(-k[2]*w(t)))*y(t);

eq3 := (D(z))(t) = K+rho*z(t)*(x(t)+y(t))^3/(alpha+(x(t)+y(t))^3)-c[2]*z(t)*x(t)-c[4]*y(t)*z(t)-d[1]*z(t)-k[3]*(1-exp(-k[4]*w(t)))*z(t);

eq4 := (D(w))(t) = -gamma*w(t);


ics := x(0) = 1, y(0) = 1, z(0) = 1, w(0) = 1;

Parameters := a[1] = .84, a[4] = .91, c[1] = 7.56*10^(-2), c[3] = 7.56*10^(-2), c[2] = 3.422*10^(-4), c[4] = 3.422*10^(-4), d[1] = 0.4e-1, d[2] = .11, d[3] = .66, K = 0.37e-1;

 

Is there a way to do calculations with tensors on arbitrary smooth manifolds without fixing a dimension and/or a coordinate system? (things like tensor products, contractions, covariant derivatives, Lie derivatives, exterior calculus, Riemann Tesnsor, torsion tensor,...)

The physcis package (thougfh really good otherwise)  always needs a dimension and a metric, default being 4 dimesnion and Minkowski, metric "arbitrary" is not an option since dimension must still be fixed and calculations become extremely slow and cluttered for very low dimesnional manifolds.

The DifferentialGeometry seems to always need a fixed dimension and a coordinate system. Or am I overlooking some options? 


I would need a solution for either using only geometric objects or an abstract index notation a la Wald (ideally without assuming holonomic bases). 

The only external package I could find is tensorpack, but this seems to be no longer maintained and depends on other packages (Riemann, Canon) which seem to be no longer maintained as well, and it has some drawbacks, e.g. consistent handling of dummy indices is not enforced (e.g. renaming when a conflict arises)

Is there any solution?


dS := -beta*S*Q;
dQ := Q*S*beta - Q*alpha;
dR := alpha*Q;
beta := 0.2;
alpha := 0.1;
S0 := 0.8;
Q0 := 0.2;
R0 := 0;
RungeKutta := proc(f::list, y0::list, t0::float, tf::float, h::float) local n, t, y, k1, k2, k3, k4, i; n := 1 + floor((tf - t0)/h); t := Vector(n, fill = 0); y := Matrix(n, length(y0), fill = 0); t[1] := t0; y[1] := Vector(y0); for i to n - 1 do k1 := Vector(map(f, t[i], y[i])); k2 := Vector(map(f, t[i] + 1/2*h, y[i] + 1/2*h*k1)); k3 := Vector(map(f, t[i] + 1/2*h, y[i] + 1/2*h*k2)); k4 := Vector(map(f, t[i] + h, y[i] + h*k3)); y[i + 1] := y[i] + 1/6*h*(k1 + 2*k2 + 2*k3 + k4); t[i + 1] := t[i] + h; end do; [t, y]; end proc;
f = [dS, dQ, dR];
t0 := 0;
tf := 50;
h := 0.1;
result := RungeKutta(f, [S0, Q0, R0], t0, tf, h);
t_values := result[1];
S_values := result[2][() .. (), 1];
Q_values := result[2][() .. (), 2];
R_values := result[2][() .. (), 3];
plots:-display(plot(t_values, S_values, color = "blue", legend = "Susceptible"), plot(t_values, Q_values, color = "red", legend = "Infected"), plot(t_values, R_values, color = "green", legend = "Recovered"), legend = ["Susceptible", "Infected", "Recovered"], title = "Simulation of Infectious Disease Model", xlabel = "Time", ylabel = "Population", view = [0 .. tf, 0 .. 1]);
Warning, (in RungeKutta) `i` is implicitly declared local
                         dS := -0.2 S Q

                     dQ := 0.2 S Q - 0.1 Q

                          dR := 0.1 Q

                          beta := 0.2

                          alpha := 0.1

                           S0 := 0.8

                           Q0 := 0.2

                            R0 := 0

RungeKutta := proc (f::list, y0::list, t0::float, tf::float, 

   h::float) local n, t, y, k1, k2, k3, k4, i; n := 1+floor((tf-\

  t0)/h); t := Vector(n, fill = 0); y := Matrix(n, length(y0), 

   fill = 0); t[1] := t0; y[1] := Vector(y0); for i to n-1 do 

   k1 := Vector(map(f, t[i], y[i])); k2 := Vector(map(f, 

   t[i]+(1/2)*h, y[i]+(1/2)*h*k1)); k3 := Vector(map(f, 

   t[i]+(1/2)*h, y[i]+(1/2)*h*k2)); k4 := Vector(map(f, t[i]+h, 

   y[i]+h*k3)); y[i+1] := y[i]+(1/6)*h*(k1+2*k2+2*k3+k4); 

   t[i+1] := t[i]+h end do; [t, y] end proc


[-0.2 S Q, 0.2 S Q - 0.1 Q, 0.1 Q] = [-0.2 S Q, 0.2 S Q - 0.1 Q, 

  0.1 Q]


                            t0 := 0

                            tf := 50

                            h := 0.1

Error, invalid input: RungeKutta expects its 3rd argument, t0, to be of type float, but received 0
                     t_values := result[1]

               S_values := result[2][() .. (), 1]

               Q_values := result[2][() .. (), 2]

               R_values := result[2][() .. (), 3]

Warning, expecting only range variable result[2][(NULL) .. (NULL),1] in expression result[1] to be plotted but found name result[1]
Warning, expecting only range variable result[2][(NULL) .. (NULL),2] in expression result[1] to be plotted but found name result[1]
Warning, expecting only range variable result[2][(NULL) .. (NULL),3] in expression result[1] to be plotted but found name result[1]
Error, (in plots:-display) unexpected options: [xlabel = "Time", ylabel = "Population"]

I want to center align all the math in my document. I have not been able to find a shortcut key for alignment, and I cannot find a default setting for alignment anywhere. I don't want to mouse click every single time.

Please help, thanks!

Howdy,

I am trying to do explicit Lie algebra computations, and I am not sure the best way to automate these.

Suppose I have a Lie algebra with basis e1 through e8, and I have some linear functions:

f(e1,e2) = c1e1+c2e2+...+c8e8

Now suppose I want to compute something like

[e5, f] - f([e5,e1],e2) + f([e5,e2],e1), or more generally x.f with the typical module structure.

I can do this line by line - say [e5,e1] = -e1 and [e5,e2] = 0, then I can ask Maple for LieBracket(e5,f)+f(e1,e2)-0. However, I'd like to make an operator that does this for me. Can anyone please point me in the right direction?

Thanks!

If we solve the equation  x^x=1/sqrt(2)  in Maple 2018.2, then Maple returns only one solution  x=1/2 , although this equation has 2 solutions  x=1/2  or  x=1/4 . This can be seen if you plot graphs or , for example, solve by the  Student:-Calculus1:-Roots  command. In this case, the root  x=1/4   is returned only as a numerical approximation. I wonder if this bug has been fixed in the latest versions of Maple?

restart;
solve(x^x=1/sqrt(2));
Student:-Calculus1:-Roots(x^x=1/sqrt(2));

condi := [p1 + p2 + p3 = 1];
simplify(s, condi);
                  condi := [p1 + p2 + p3 = 1]

 /      c (-1 + p1 + p2)        c (-1 + p1 + p2)         
{ a = - ----------------, b = - ----------------,           c = c, 
 \             p1                               p2                

      c (p1 + p2) (-1 + p1 + p2)           c (p2 - 1)          c (p1 - 1)
  d = --------------------------,             e = ----------, f = ----------
                p1 p2                                       p1                 p2    

  \ 
   }
  / 


assigne(%);
c := 10;
a := factor(simplify(a, condi));
b := factor(simplify(b, condi));
d := factor(simplify(d, condi));
e := factor(simplify(e, condi));
f := factor(simplify(f, condi));
                            c := 10

                             a := a

                             b := b

                             d := d

                             e := e

                             f := f

NULL;
Why "factor" does not play its role ?   Thank you.

I'd like to be able to define functions with units and then use them.

In the example below, things don't work with Maple input. I've shown one example, with the function f2.

It seems to work better with 2D input, but it seems that it is not possible to make plots.

In the example below, I define f4 as a function of two variables that returns a function of one variable.

I'd like to call the outer function, obtain a function as a result (r1 below) and then plot the latter.

restart

with(Units:-Simple)

NULL

f1 := proc (x) options operator, arrow; x*Unit('m') end proc

proc (x) options operator, arrow; Units:-Simple:-`*`(x, Unit('m')) end proc

(1)

f1(2)

2*Units:-Unit(m)

(2)

f2:=x->xUnit(m)

Units:-Unit(m)

(3)

f2(2)

f2(2)

(4)

f3 := proc (x, y) options operator, arrow; x*Unit('m')*y*Unit('m') end proc

proc (x, y) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')) end proc

(5)

f3(2, 3)

6*Units:-Unit(m^2)

(6)

f4 := proc (x, y) options operator, arrow; proc (z) options operator, arrow; x*Unit('m')*y*Unit('m')*z*Unit('m') end proc end proc

proc (x, y) options operator, arrow; proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')), z), Unit('m')) end proc end proc

(7)

r1 := f4(2, 3)

proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(2, Unit('m')), 3), Unit('m')), z), Unit('m')) end proc

(8)

r1(4)

24*Units:-Unit(m^3)

(9)

plot(r1)

 

NULL

The contents above aren't showing the error that Maple gives when I try to plot.

Here is a screenshot

Download FunctionUnits.mw

I have a variable with the unit Volt.

I'd like to print something like "The voltage is %f" where the floating point is the value of the variable with the unit.

I've tried the options below so far.

How would one accomplish this?

with(Units:-Simple)

NULL

x := 5*Unit('V')

5*Units:-Unit(V)

(1)

printf(x)

Error, (in fprintf) format string expected

 

printf("%f", x)

Error, (in fprintf) number expected for floating point format

 

printf("%d", x)

Error, (in fprintf) integer expected for integer format

 

printf("%a", x)

5*Units:-Unit(V)

 

printf("%A", x)

5*Units:-Unit(V)

 

printf("%q", x)

5*Units:-Unit(V)

 

printf("%v", x)

5*Units:-Unit(V)

 

printf("%P", x)

                               5 Units:-Unit(V)

 

print(x)

5*Units:-Unit(V)

(2)

print(The*voltage*is, x)

The*voltage*is, 5*Units:-Unit(V)

(3)

print(The*voltage*is*x)

5*The*voltage*is*Units:-Unit(V)

(4)

NULL

Download PrintUnits.mw

Performing

II := int( Dirac(x^2+y^2-1), x = -infinity..infinity )

gives 

II = 1/sqrt(abs(y^2 - 1))

with no restriction on y. It seems that the answer (at least to the question I thought I was asking) is actually 

II = 1/sqrt(1-y^2) for y\in[-1,1], 0 else

Am I misunderstaning the meaning of Dirac and its integral?

Hi all,

How Can I sort a list of polynomials with parametric coefficients based on the following criteria?
1. Fewer different parameters in the coefficients.
2. If the number of parameters is the same, the lower power of the parameters.
3. If the previous criteria are the same, sentences with parametric coefficients appear later.

Otherwise, the list is in order. For example, I want to obtain the sorted list 

[(a+2)*x[1]+3*x[2]-x[3]+(a-2)*x[4],2*x[1]+2*x[2]-b*x[3]+(c+1)*x[4], (a-1)*x[1]+x[2]+(a+1)*x[3]+(C^2-1)*x[4], (a+b)*x[1]+(c-3)*x[2]+(-b-1)*x[3]+2*x[4]] from the following list:

[(a-1)*x[1]+x[2]+(a+1)*x[3]+(C^2-1)*x[4], 2*x[1]+2*x[2]-b*x[3]+(c+1)*x[4], (a+2)*x[1]+3*x[2]-x[3]+(a-2)*x[4], (a+b)*x[1]+(c-3)*x[2]+(-b-1)*x[3]+2*x[4]]. 

Could you please guide me?

Thanks.

Good day. 

I recently constructed a Maple model using an LPSolve routine to solve for a classic factory (Operations Research) assignment problem. Basically, this involves 4 factories that, in any combination, can supply goods and fulfil demand to 10 customers. If any given factory is activated, the model determines what factory should supply what customer so that the weighted-distance is minimized.

However, in addtion to this - I would like to know the quantity of items that each factory supplies to each of their respective customers and I would like to verify that the quantity demanded by each customer is fulfilled. 

I was hoping that somebody could guide me on how to do this. Any suggestions would be most welcomed.

The model is attached.

Thanks for reading!

MaplePrimes_Jan_27.mw

I am trying to draw the streamline for my coupled system but do not get the outcome. Could anyone please help in this regard?

Detail: My system contains x and y;  Regrading x=0, if I do not assign it to zero, do not get the results. Otherwise, there is no need to put x=0 because I am interested in plotting stream plots between y and x (y on the vertical axis and x on the horizontal axis). Besides this, I solved this system analytically, then considered the stream function, did some steps, and plotted the streamline. It is different from the stream function, which has been obtained directly by using the numeric method. I have assigned the values to the parameters that I used during the analytical plot. I put x=0 and did not get the answer. Besides,  I am uploading the graph as a reference, which I have obtained by considering the stream function. This plot is similar to my flow direction, and I expect the same results from the numeric method.

streamline_Help.mw

5 6 7 8 9 10 11 Last Page 7 of 2298