Maple 2019 Questions and Posts

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

The attached sheet contains equations H1 to H6 and K1 to K3. What data do I need to modify to ensure that the values of H1 to H6 fall between 0 and 1, and K1 to K3 are negative? The parameter ranges are also given in the sheet. Is there a method to achieve this?

rouhg.mw

How to use for loop in the optimization function? The objective function contain piecewise function, in that case what to do?
Can anyone help me with the syntax? I am attaching the sheet below:
Question_loop.mw

I can't isolate a variable from the constraint and move it to one side of the inequality. For example, it's like having theta <= all other terms. I've tried using the isolate and eval functions, but they aren't producing any results or simplifying the expression. What am I doing wrong?

Attaching sheet below (issue marked yellow in background): N_1.mw 

Can anyone helps me with my optimization Problem.  Following are the issues :-

  • I have to minimize the function TRC, i am unable to do. 
  • I am unable to add a constraint with if statement. 
  • Check whether i have represented I1 and I2 with respect to alpha and beta right or wrong

Attaching the sheet below, the background marked in yellow is the problem area. Thankyou

Basic_model.mw

Hello Everyone;

I need to find the bifurcation point and further bifarcation diagram for the given model. But facing error. Can anybody help to do this? Can you refer some library for bifurcation analysis of ODE's? Code is attched. Thanks in Advance. 

123.mw

 

 

 

 

restart

C_m := 1.0; g_K := 36.0; I_inj := 0; g_L := .3; E_Na := 50.0; E_K := -77.0; E_L := -54.4

alpha_m := (.1*(V-25.0))/(1-exp(-(V-25.0)*(1/10))); beta_m := 4*exp(-V/(18.0)); alpha_h := 0.7e-1*exp(-V/(20.0)); beta_h := 1/(1+exp(-(V-30)*(1/10))); alpha_n := (0.1e-1*(V-10.0))/(1-exp(-(V-10.0)/(10.0))); beta_n := .125*exp(-V/(80.0)); I_Na := g_Na*m^3*h*(V-E_Na); I_K := g_K*n^4*(V-E_K); I_L := g_L*(V-E_L)

.125*exp(-0.1250000000e-1*V)

(1.1)

eq1 := (I_inj-I_Na-I_K-I_L)/C_m; m := alpha_m/(alpha_m+beta_m); n := alpha_n/(alpha_n+beta_n); h := alpha_h/(alpha_h+beta_h)

-16.32000000-1.000000000*g_Na*m^3*h*(V-50.0)-36.00000000*n^4*(V+77.0)-.3000000000*V

 

.1*(V-25.0)/((1-exp(-(1/10)*V+2.500000000))*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V)))

 

0.1e-1*(V-10.0)/((1-exp(-.1000000000*V+1.000000000))*(0.1e-1*(V-10.0)/(1-exp(-.1000000000*V+1.000000000))+.125*exp(-0.1250000000e-1*V)))

 

0.7e-1*exp(-0.5000000000e-1*V)/(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3)))

(1.2)

bif_eq1 := eq1 = 0;

-16.32000000-0.7000000000e-4*g_Na*(V-25.0)^3*exp(-0.5000000000e-1*V)*(V-50.0)/((1-exp(-(1/10)*V+2.500000000))^3*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V))^3*(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3))))-0.3600000000e-6*(V-10.0)^4*(V+77.0)/((1-exp(-.1000000000*V+1.000000000))^4*(0.1e-1*(V-10.0)/(1-exp(-.1000000000*V+1.000000000))+.125*exp(-0.1250000000e-1*V))^4)-.3000000000*V = 0

bif_eq2 := diff( eq1, V) = 0;

-0.2100000000e-3*g_Na*(V-25.0)^2*exp(-0.5000000000e-1*V)*(V-50.0)/((1-exp(-(1/10)*V+2.500000000))^3*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V))^3*(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3))))+0.2100000000e-4*g_Na*(V-25.0)^3*exp(-0.5000000000e-1*V)*(V-50.0)*exp(-(1/10)*V+2.500000000)/((1-exp(-(1/10)*V+2.500000000))^4*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V))^3*(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3))))+0.2100000000e-3*g_Na*(V-25.0)^3*exp(-0.5000000000e-1*V)*(V-50.0)*(.1/(1-exp(-(1/10)*V+2.500000000))-0.1000000000e-1*(V-25.0)*exp(-(1/10)*V+2.500000000)/(1-exp(-(1/10)*V+2.500000000))^2-.2222222222*exp(-0.5555555556e-1*V))/((1-exp(-(1/10)*V+2.500000000))^3*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V))^4*(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3))))+0.3500000000e-5*g_Na*(V-25.0)^3*exp(-0.5000000000e-1*V)*(V-50.0)/((1-exp(-(1/10)*V+2.500000000))^3*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V))^3*(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3))))+0.7000000000e-4*g_Na*(V-25.0)^3*exp(-0.5000000000e-1*V)*(V-50.0)*(-0.3500000000e-2*exp(-0.5000000000e-1*V)+(1/10)*exp(-(1/10)*V+3)/(1+exp(-(1/10)*V+3))^2)/((1-exp(-(1/10)*V+2.500000000))^3*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V))^3*(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3)))^2)-0.7000000000e-4*g_Na*(V-25.0)^3*exp(-0.5000000000e-1*V)/((1-exp(-(1/10)*V+2.500000000))^3*(.1*(V-25.0)/(1-exp(-(1/10)*V+2.500000000))+4*exp(-0.5555555556e-1*V))^3*(0.7e-1*exp(-0.5000000000e-1*V)+1/(1+exp(-(1/10)*V+3))))-0.1440000000e-5*(V-10.0)^3*(V+77.0)/((1-exp(-.1000000000*V+1.000000000))^4*(0.1e-1*(V-10.0)/(1-exp(-.1000000000*V+1.000000000))+.125*exp(-0.1250000000e-1*V))^4)+0.1440000000e-6*(V-10.0)^4*(V+77.0)*exp(-.1000000000*V+1.000000000)/((1-exp(-.1000000000*V+1.000000000))^5*(0.1e-1*(V-10.0)/(1-exp(-.1000000000*V+1.000000000))+.125*exp(-0.1250000000e-1*V))^4)+0.1440000000e-5*(V-10.0)^4*(V+77.0)*(0.1e-1/(1-exp(-.1000000000*V+1.000000000))-0.1000000000e-2*(V-10.0)*exp(-.1000000000*V+1.000000000)/(1-exp(-.1000000000*V+1.000000000))^2-0.1562500000e-2*exp(-0.1250000000e-1*V))/((1-exp(-.1000000000*V+1.000000000))^4*(0.1e-1*(V-10.0)/(1-exp(-.1000000000*V+1.000000000))+.125*exp(-0.1250000000e-1*V))^5)-0.3600000000e-6*(V-10.0)^4/((1-exp(-.1000000000*V+1.000000000))^4*(0.1e-1*(V-10.0)/(1-exp(-.1000000000*V+1.000000000))+.125*exp(-0.1250000000e-1*V))^4)-.3000000000 = 0

 

 

 

bif_sol := solve({ bif_eq1,bif_eq2}, {V, g_Na});

Warning, solutions may have been lost

 

 

as the solutions, which are then expressed as the points mu, y via

   

[Back to ODE Powertool Table of Contents]

 

 

Hi, I have an homework where I need to find the highest point and the lowest point on an ellipse form by the intersection of two equations wich are 4x-3y+8z=5 and z^2=x^2+y^2 and I have to use the LagrangeMultiplier command. I get how it works but I can't get the correct form. How should I do it ? 

Hello everyone,

I'm trying to symbolically diagonalize a 5x5 matrix in Maple. I can determine the eigenvalues for my matrix, but when it comes to evaluating the eigenvectors, Maple gives me the following results:

eigenvalues(A): -a + u, a + u, u, u, u

eigenvectors(A): [a + u, 1, {r}], [-a + u, 1, {r}], [u, 5, {r, r, r, r, r}]

I don't understand why I'm getting {r} in the eigenvectors. How can I display the eigenvectors for my matrix A?

Thank you in advance for your answers !

5x5

 

restartNULL

with(linalg)

[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp, QRdecomp, Wronskian, addcol, addrow, adj, adjoint, angle, augment, backsub, band, basis, bezout, blockmatrix, charmat, charpoly, cholesky, col, coldim, colspace, colspan, companion, concat, cond, copyinto, crossprod, curl, definite, delcols, delrows, det, diag, diverge, dotprod, eigenvals, eigenvalues, eigenvectors, eigenvects, entermatrix, equal, exponential, extend, ffgausselim, fibonacci, forwardsub, frobenius, gausselim, gaussjord, geneqns, genmatrix, grad, hadamard, hermite, hessian, hilbert, htranspose, ihermite, indexfunc, innerprod, intbasis, inverse, ismith, issimilar, iszero, jacobian, jordan, kernel, laplacian, leastsqrs, linsolve, matadd, matrix, minor, minpoly, mulcol, mulrow, multiply, norm, normalize, nullspace, orthog, permanent, pivot, potential, randmatrix, randvector, rank, ratform, row, rowdim, rowspace, rowspan, rref, scalarmul, singularvals, smith, stackmatrix, submatrix, subvector, sumbasis, swapcol, swaprow, sylvester, toeplitz, trace, transpose, vandermonde, vecpotent, vectdim, vector, wronskian]

(1.1)

A := Matrix([[0, 1, 0, 0, 0], [(gamma-1)*H-u^2-a^2, (3-gamma)*u, -(gamma-1)*v, -(gamma-1)*w, gamma-1], [-u*v, v, u, 0, 0], [-u*w, w, 0, u, 0], [u*((gamma-2)*H-a^2), H-(gamma-1)*u^2, -(gamma-1)*u*v, -(gamma-1)*u*w, gamma*u]])

Matrix(%id = 18446746202416421574)

(1.2)

eigenvalues(A)

u+(-gamma*u^2-gamma*v^2-gamma*w^2+2*H*gamma-a^2+u^2+v^2+w^2-2*H)^(1/2), u-(-gamma*u^2-gamma*v^2-gamma*w^2+2*H*gamma-a^2+u^2+v^2+w^2-2*H)^(1/2), u, u, u

(1.3)

V := sqrt(u^2+v^2+w^2)

(u^2+v^2+w^2)^(1/2)

(1.4)

H := (1/2)*V^2+a^2/(gamma-1)

(1/2)*u^2+(1/2)*v^2+(1/2)*w^2+a^2/(gamma-1)

(1.5)

eigenvalues(A)

-a+u, a+u, u, u, u

(1.6)

eigenvectors(A)

[-a+u, 1, {r}], [a+u, 1, {r}], [u, 3, {r, r, r}]

(1.7)

``

Download maps.mw

Please help me check why my minmax optimization is not having these errors:

Error, (in minimize/cell/function/multidependence/univariate) 

Error, n should be an integer for integer[n]
Error, (in minimize/cell/function/multidependence/univariate) invalid input: `minimize/continuous` expects its 2nd argument, yFP, to be of type {name, list(name)}, but received `X[4,3]` = -infinity

Error, invalid input: `convert/Array` expects its 1st argument, A, to be of type {Array, Matrix, Vector, array, sequential}, but received 0

my design optimization objective function is to carry out a minimize the maximum assignments from vector B overlap  between any two members in A , such that in vector A all members fall under a group and there is no duplication of membership, further   a member from each group representing the group  is to be assigned to vector B such that only one member of a group should be assigned each member of vector B, while ensuring that every member in vector B has represntation from every group in vector A. 

with(Optimization); num_profiles := 4; num_websites := 3; num_groups := 2; X := Array(1 .. num_profiles, 1 .. num_websites, datatype = integer[0 .. 1]); obj := minimize(max(seq(add(X[i, j], j = 1 .. num_websites), i = 1 .. num_profiles))); constraints := {seq(add(add(X[i, j], i = k*num_profiles/num_groups+1 .. (k+1)*num_profiles/num_groups), k = 0 .. num_groups-1) = 1, j = 1 .. num_websites)}; sol := Optimization[Minimize](obj, constraints, assume = binary); optimal_assignment := convert(sol[1], Array); for i to num_profiles do for j to num_websites do if optimal_assignment[i, j] = 1 then print("Profile ", i, " assigned to Website ", j) end if end do end do; print("Objective Value (Minimized Maximum Website Overlap): ", sol[2])

"Objective Value (Minimized Maximum Website Overlap): ", [obj = 0, X[1, 1] = 0, X[1, 2] = 0, X[1, 3] = 0, X[2, 1] = 0, X[2, 2] = 0, X[2, 3] = 1, X[3, 1] = 1, X[3, 2] = 1, X[3, 3] = 0, X[4, 1] = 0, X[4, 2] = 0, X[4, 3] = 0]

(1)

``

Download firstworkablecode.mw

Sorry if this is already known, but I haven't found the proper function call.

I just want to "print" this expression without evaluating the boolean calls

restart;
P(X <= 5) = P(-5 <= -X) = P(E(X) - 5 <= E(X) - X);

As it stands, this will evaluate to "false" which I obviously don't want.

I just want to use it as a displayer.

Hi, I'm trying to solve these 2 nonlinear equations in f, g, and x, where x is from 0 to 1 with an increment of 0.1.

I am new to Maple and do not know the basics. Please try and help me. I'd highly appreciate it.

Since this is a nonlinear system, multiple solutions exist, I need to find the first 3 or 5 solutions. Once I solve the system, I would like to plot 2 plots, y-x and z-x.

I currently do extensive modeling that involves Monte Carlo simulations. This kind of analysis seems idially suited to parallel computing. To begin the process I have been following the teachings of chapter 15 of the Programming Guide 2023. As a first excersize I copyied the code on pages 583-584 and attempted to run it on my system. My Maple program is a 2019  Student Version running on anHP laptop using Windows11. The code yields an error code "Error, invalid input: add_range uses a 1st argument, lo, which is missing"

This is an exact copy of the ccode in the guide. Is there posibly a probem with my installation? I am willing to update and upgrade as may be needed. Any suuggestions how to procced?

Thanks

Ray

 I defined the following function L1 and L2 to test, if  Maple is returning the same results. Mathematically they are identical. For all testpoints, L1 returns the correct results (for y := -5 the result is -15).  L2  returns identical results exept for y:=-5. For y:= -5, where you can see on the first glance that the result must be -15,  Maple is returning for L2 a complex number. I am worried about this different treatment of the functions L1 and L2, because I am calculating with functions, where you cannot prove the result as easy as it can be done here. 

L1 := y -> 3*y*((y + 4)^2)^(1/3);
   L1 := proc (y) options operator, arrow, function_assign; 

      3*y*((y+4)^2)^(1/3) end proc

L2 := y -> 3*y*(y + 4)^(2/3);
   L2 := proc (y) options operator, arrow, function_assign; 

      3*y*(y+4)^(2/3) end proc
NULL;
for y from -5 to 0 do
    print("y = ", y, "L1(y)   =  ", L1(1.0*y), "          L2(y)  =,  ", L2(1.0*y));
end do;
  "y =  ", -5, "L1(y)   =  ", -15.0, "          L2(y)  =,  ",     7.500000000 - 12.99038105 I
 "y =  ", -4, "L1(y)   =  ", -0., "          L2(y)  =,  ", -0.
"y =  ", -3, "L1(y)   =  ", -9.0, "          L2(y)  =,  ", -9.0
           "y =  ", -2, "L1(y)   =  ", -9.524406312,              "          L2(y)  =,  ", -9.524406312
           "y =  ", -1, "L1(y)   =  ", -6.240251469,              "          L2(y)  =,  ", -6.240251469
   "y =  ", 0, "L1(y)   =  ", 0., "          L2(y)  =,  ", 0.

Question about using the command „ExtremPoints“

I am using Maple 2019.

Using the command ExtremPoints I got different list when defining the function over a closed intervall piecewise or with f(x), x=a..b.

Maple desciption states:
ExtremePoints(f(x), x = a..b) command returns all extreme points of f(x) in the interval [a,b] as a list of values.

An extreme point is defined as any point which is a local minimum or maximum, which includes any finite end points.

So I expected, Maple returns the same list, independend of how the same function is defined (see example below). Instead: with the piecewise definition Maple returns as extrempoints only the local extrempoints without the finite endpoints.
Defining the same function with f(x),x=a..b Maple returns the list with local minimum or maximum, which includes any finite end points.

Example:

f := x -> piecewise(-1 <= x and x <= 2, x^2, undefined);

Return:  ExtremePoints(f(x));

                              [0] 

g := x -> x^2

ExtremePoints(g(x), x = -1 .. 2);

                           [-1, 0, 2]

restart;
Pr:=0.71: n:=-1:

eta0:=0.0699;

EQ1:=diff(H(x), x ) - x*diff(F(x), x ) ;
 

EQ2:=(1+x^2)*diff(F(x), x$2) + (3*x + x*F(x)-H(x))*diff(F(x), x) + F(x)^2 + G(x)^2 +2*P(x) + x*diff(P(x), x) ;

EQ3:=(1+x^2)*diff(G(x), x$2) + (3*x + x*F(x)-H(x))*diff(G(x), x) ;

EQ4:=(1+x^2)*diff(H(x), x$2) + (3*x + x*F(x)-H(x))*diff(H(x), x) + (1+F(x))*H(x)- diff(P(x), x);

EQ5:=(1+x^2)*diff(theta(x), x$2) + x*(1-2*n)*diff(theta(x), x) + n^2*theta(x) - Pr*( n*F(x)*theta(x) + ( H(x)-x*F(x) )*diff(theta(x), x)  ) ;


EQ:={EQ1=0, EQ2=0,EQ3=0,EQ4=0 ,EQ5=0}:


IC:={ F(0)=0, G(0)=12, H(0)=0, theta(0)= 1, F(eta0)=0, G(eta0)=12, H(eta0)=0, theta(eta0)= 0, P(0)=0};
 

sol:= dsolve(EQ union IC,numeric,output=Array([0,0.0699]));

ques.mw

What will be the range of p and q to get the plot and to get the optimum solution?
If possible get a solution for particular value of p and q.
file attached: q1.mw

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