MaplePrimes Questions

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

Hi. I need some help.... Where can i find my purchase Code to activate? Without it i can not work now.. 

I am trying to decompose an isprime into sum of 2 squares.
Can you tell me why yhse procedure are not goog.
                       

Sumof2Squares:= proc(p::And(prime, satisfies(p-> irem(p,4)=1)))
local x, y:= 1;
   x:= mods(Roots(x^2+y^2), p)[2,1];
   while x^2+y^2 > p do
      (x,y):= FermatDescent(x,y,p)
   end do;
   (x,y)
end proc:

FermatDescent:= proc(x::posint, y::posint, p::posint)
local 
   m:= (x^2+y^2)/p,
   a:= mods(x,m),  
   b:= mods(y,m);

   (abs((a*x+b*y)/m), abs((a*y-b*x)/m))
end proc:
   
trace(FermatDescent);

Sumof2Squares(1973);
Thank you.

My equation is

at  x=0

I got g'(0) in my previous equation,

,,

 

And all the parameters are mensioned in the worksheet.Then how to plot eta.Help me.

Thank you

FE-2.mw

restart:

with(LinearAlgebra):

with(plots):

with(Maplets[Examples]):

with(Student[Calculus1]):

Digits:=100:

 

NULL

``

``lambda[C] := .5

.5

(1)

lambda[L] := .5

.5

(2)

beta := 0.1e-1

0.1e-1

(3)

alpha := .5

.5

(4)

NULL

X[0]:=0;X[1]:=0.5;X[2]:=1;

1

(5)

 #A: Governing Equations:

 EQ[1] := lambda[C]^2*(diff(v[1](x), x, x, x, x, x, x))-(diff(v[1](x), x, x, x, x))

.25*(diff(diff(diff(diff(diff(diff(v[1](x), x), x), x), x), x), x))-(diff(diff(diff(diff(v[1](x), x), x), x), x))

(6)

EQ[2] := lambda[C]^2*(diff(v[2](x), x, x, x, x, x, x))-(diff(v[2](x), x, x, x, x))

.25*(diff(diff(diff(diff(diff(diff(v[2](x), x), x), x), x), x), x))-(diff(diff(diff(diff(v[2](x), x), x), x), x))

(7)

EQ[3] := s[1](x)+diff(v[1](x), x)-lambda[C]^2*(diff(s[1](x), x, x)+diff(v[1](x), x, x, x))-beta*(diff(v[1](x), x, x, x)-lambda[C]^2*(diff(v[1](x), x, x, x, x, x)))

s[1](x)+diff(v[1](x), x)-.25*(diff(diff(s[1](x), x), x))-.26*(diff(diff(diff(v[1](x), x), x), x))+0.25e-2*(diff(diff(diff(diff(diff(v[1](x), x), x), x), x), x))

(8)

``

EQ[4] := s[2](x)+diff(v[2](x), x)-lambda[C]^2*(diff(s[2](x), x, x)+diff(v[2](x), x, x, x))-beta*(diff(v[2](x), x, x, x)-lambda[C]^2*(diff(v[2](x), x, x, x, x, x)))

s[2](x)+diff(v[2](x), x)-.25*(diff(diff(s[2](x), x), x))-.26*(diff(diff(diff(v[2](x), x), x), x))+0.25e-2*(diff(diff(diff(diff(diff(v[2](x), x), x), x), x), x))

(9)

assign(dsolve({EQ[1], EQ[2], EQ[3], EQ[4]}, {s[1](x), s[2](x), v[1](x), v[2](x)}))

NULL

V[1] := subs(_C1 = A[1], _C2 = A[2], _C3 = A[3], _C4 = A[4], _C5 = A[5], _C6 = A[6], _C7 = A[7], _C8 = A[8], _C9 = A[9], _C10 = A[10], _C11 = A[11], _C12 = A[12], _C13 = A[13], _C14 = A[14], _C15 = A[15], _C16 = A[16], v[1](x))

NULL

V[2] := subs(_C1 = A[1], _C2 = A[2], _C3 = A[3], _C4 = A[4], _C5 = A[5], _C6 = A[6], _C7 = A[7], _C8 = A[8], _C9 = A[9], _C10 = A[10], _C11 = A[11], _C12 = A[12], _C13 = A[13], _C14 = A[14], _C15 = A[15], _C16 = A[16], v[2](x))

NULL

S[1] := subs(_C1 = A[1], _C2 = A[2], _C3 = A[3], _C4 = A[4], _C5 = A[5], _C6 = A[6], _C7 = A[7], _C8 = A[8], _C9 = A[9], _C10 = A[10], _C11 = A[11], _C12 = A[12], _C13 = A[13], _C14 = A[14], _C15 = A[15], _C16 = A[16], s[1](x))

NULL``

S[2] := subs(_C1 = A[1], _C2 = A[2], _C3 = A[3], _C4 = A[4], _C5 = A[5], _C6 = A[6], _C7 = A[7], _C8 = A[8], _C9 = A[9], _C10 = A[10], _C11 = A[11], _C12 = A[12], _C13 = A[13], _C14 = A[14], _C15 = A[15], _C16 = A[16], s[2](x))

``

# B: Costitutive Boundary Conditions:

eq[1] := evalf(eval((alpha*lambda[C]^4+lambda[C]^2*lambda[L]^2)*(diff(V[1], x, x, x, x, x))-alpha*lambda[C]^3*(diff(V[1], x, x, x, x))+(-alpha*lambda[C]^2+lambda[C]^2-lambda[L]^2)*(diff(V[1], x, x, x))+(alpha*lambda[C]-lambda[C])*(diff(V[1], x, x)), x = X[0]))

-4.00000*A[16]-.750*A[14]-.50*A[13]

(10)

NULL

eq[2] := evalf(eval((alpha*lambda[C]^4+lambda[C]^2*lambda[L]^2)*(diff(V[2], x, x, x, x, x))+alpha*lambda[C]^3*(diff(V[2], x, x, x, x))+(-alpha*lambda[C]^2+lambda[C]^2-lambda[L]^2)*(diff(V[2], x, x, x))+(-alpha*lambda[C]+lambda[C])*(diff(V[2], x, x)), x = X[2]))

10.87312731383618094144114988541064999102898837479983829986787051089630652141419037828552871410066571*A[9]+.50*A[7]

(11)

````

eq[3] := evalf(eval(lambda[C]^2*(diff(S[1], x)+diff(V[1], x, x))-lambda[C]*(S[1]+diff(V[1], x))+alpha*beta*lambda[C]*(diff(V[1], x, x, x)-lambda[C]^2*(diff(V[1], x, x, x, x, x))), x = X[0]))

-1.00*A[3]+0.8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-1*A[16]-0.1500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-1*A[14]

(12)

 

eq[4] := evalf(eval(lambda[C]^2*(diff(S[2], x)+diff(V[2], x, x))+lambda[C]*(S[2]+diff(V[2], x))-alpha*beta*lambda[C]*(diff(V[2], x, x, x)-lambda[C]^2*(diff(V[2], x, x, x, x, x))), x = X[2]))

7.389056098930650227230427460575007813180315570551847324087127822522573796079057763384312485079121795*A[2]+.5911244879144520181784341968460006250544252456441477859269702258018059036863246210707449988063297436*A[9]+0.1500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-1*A[8]

(13)

NULLNULL

eq[5] := evalf(eval(alpha*lambda[C]^4*(diff(V[1], x, x, x, x, x))-alpha*lambda[C]^3*(diff(V[1], x, x, x, x))+(-alpha*lambda[C]^2+lambda[C]^2)*(diff(V[1], x, x, x))+(alpha*lambda[C]-lambda[C])*(diff(V[1], x, x))+(1-alpha)*(int(exp((z-x)/lambda[C])*(diff(V[1], x, x)-lambda[C]^2*(diff(V[1], x, x, x, x))), z = X[0] .. X[1]))-lambda[L]^2*(diff(int(exp((z-x)/lambda[C])*(diff(V[1], x, x, x)-lambda[C]^2*(diff(V[1], x, x, x, x, x))), z = X[0] .. x), x)), x = X[1]))

-1.471517764685769286382095080645843469783244524127071338031347206789845982979599213428589097383678575*A[16]-0.777287426357452235899284828632869517530750448214776276426328038192883654260245575535813672783191983e-1*A[14]-.1839397205857211607977618850807304337229055655158839172539184008487307478724499016785736371729598218*A[13]

(14)

NULL

NULL``

NULL

eq[6] := evalf(eval(alpha*lambda[C]^4*(diff(V[2], x, x, x, x, x))+alpha*lambda[C]^3*(diff(V[2], x, x, x, x))+(-alpha*lambda[C]^2+lambda[C]^2)*(diff(V[2], x, x, x))+(-alpha*lambda[C]+lambda[C])*(diff(V[2], x, x))-(1-alpha)*(int(exp((x-z)/lambda[C])*(diff(V[2], x, x)-lambda[C]^2*(diff(V[2], x, x, x, x))), z = X[1] .. X[2]))+lambda[L]^2*(diff(int(exp((x-z)/lambda[C])*(diff(V[2], x, x, x)-lambda[C]^2*(diff(V[2], x, x, x, x, x))), z = x .. X[2]), x)), x = X[1]))

10.87312731383618094144114988541064999102898837479983829986787051089630652141419037828552871410066571*A[9]+.4740904191214182588033571723789043494156416517261741241191223987269038781913251474821395442405602671*A[8]+.1839397205857211607977618850807304337229055655158839172539184008487307478724499016785736371729598218*A[7]

(15)

NULL

eq[7] := evalf(eval(lambda[C]^2*(diff(S[1], x)+diff(V[1], x, x))-lambda[C]*(S[1]+diff(V[1], x))+alpha*beta*lambda[C]*(diff(V[1], x, x, x)-lambda[C]^2*(diff(V[1], x, x, x, x, x)))+(1-alpha)*beta*(int(exp((z-x)/lambda[C])*(diff(V[1], x, x, x)-lambda[C]^2*(diff(V[1], x, x, x, x, x))), z = X[0] .. X[1])), x = X[1]))

-.3678794411714423215955237701614608674458111310317678345078368016974614957448998033571472743459196437*A[3]+0.2943035529371538572764190161291686939566489048254142676062694413579691965959198426857178194767357150e-1*A[16]-0.5518191617571634823932856552421913011687166965476517517617552025461922436173497050357209115188794656e-2*A[14]

(16)

NULL

eq[8] := evalf(eval(lambda[C]^2*(diff(S[2], x)+diff(V[2], x, x))+lambda[C]*(S[2]+diff(V[2], x))-alpha*beta*lambda[C]*(diff(V[2], x, x, x)-lambda[C]^2*(diff(V[2], x, x, x, x, x)))-(1-alpha)*beta*(int(exp((x-z)/lambda[C])*(diff(V[2], x, x, x)-lambda[C]^2*(diff(V[2], x, x, x, x, x))), z = X[1] .. X[2])), x = X[1]))

2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427*A[2]+.2174625462767236188288229977082129998205797674959967659973574102179261304282838075657105742820133142*A[9]+0.551819161757163482393285655242191301168716696547651751761755202546192243617349705035720911518879466e-2*A[8]

(17)

# D: Variationally Consistent Conditions:

 

eq[9] := evalf(eval(V[1], x = X[0]))

A[11]+A[15]+A[16]

(18)

NULL

NULL

eq[10] := evalf(eval(V[2], x = X[2]))

A[5]+A[6]+A[7]+A[8]+7.389056098930650227230427460575007813180315570551847324087127822522573796079057763384312485079121795*A[9]+.1353352832366126918939994949724844034076315459095758814681588726540733741014876899370981224906570488*A[10]

(19)

 

eq[11] := evalf(eval(V[1]-V[2], x = X[1]))

A[11]+.5*A[12]+.25*A[13]+.125*A[14]+2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427*A[15]+.3678794411714423215955237701614608674458111310317678345078368016974614957448998033571472743459196437*A[16]-1.*A[5]-.5*A[6]-.25*A[7]-.125*A[8]-2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427*A[9]-.3678794411714423215955237701614608674458111310317678345078368016974614957448998033571472743459196437*A[10]

(20)

 

eq[12] := evalf(eval(S[1]-S[2], x = X[1]))

2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427*A[4]+.3678794411714423215955237701614608674458111310317678345078368016974614957448998033571472743459196437*A[3]-1.*A[12]-1.0*A[13]-.6900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*A[14]-5.219101110641366851891751944997111995693914419903922383936577845230227130278811381577053782768319540*A[15]+.7063285270491692574634056387100048654959573715809942422550466592591260718302076224457227667441657159*A[16]-2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427*A[2]-.3678794411714423215955237701614608674458111310317678345078368016974614957448998033571472743459196437*A[1]+A[6]+1.0*A[7]+.6900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*A[8]+5.219101110641366851891751944997111995693914419903922383936577845230227130278811381577053782768319540*A[9]-.7063285270491692574634056387100048654959573715809942422550466592591260718302076224457227667441657159*A[10]

(21)

 

eq[13] := evalf(eval(lambda[C]^2*(diff(V[1], x, x, x, x))-(diff(V[1], x, x)), x = X[0]))

-2.*A[13]

(22)

NULL

eq[14] := evalf(eval(lambda[C]^2*(diff(V[2], x, x, x, x))-(diff(V[2], x, x)), x = X[2]))

-2.*A[7]-6.*A[8]

(23)

NULL````

eq[15] := evalf(eval(diff(V[1], x, x)-(diff(V[2], x, x))-lambda[C]^2*(diff(V[1], x, x, x, x)-(diff(V[2], x, x, x, x))), x = X[1]))

-2.*A[7]-3.0*A[8]+2.*A[13]+3.0*A[14]

(24)

NULL

eq[16] := evalf(eval(diff(V[1], x, x, x)-(diff(V[2], x, x, x))-lambda[C]^2*(diff(V[1], x, x, x, x, x)-(diff(V[2], x, x, x, x, x)))-1, x = X[1]))

6.*A[14]-1.-6.*A[8]

(25)

 

equations := [seq(eq[i], i = 1 .. 16)]:
unknowns := [seq(A[i], i = 1 .. 16)]:  

assign( solve(equations, unknowns)):

 

 

 

display(plot(V[1],x=X[0]..X[1]))

Warning, expecting only range variable x in expression A[11]+A[12]*x+A[13]*x^2+A[14]*x^3+A[15]*exp(2*x)+A[16]*exp(-2*x) to be plotted but found names [A[11], A[12], A[13], A[14], A[15], A[16]]

 

 

eval(V[1], x = .5)

A[11]+.5*A[12]+.25*A[13]+.125*A[14]+2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427*A[15]+.3678794411714423215955237701614608674458111310317678345078368016974614957448998033571472743459196437*A[16]

(26)

 

Hi.

I have faced a problem in solving a system of differential equations with 16 boundary conditions with maple. Unfortunately, maple does not solve it and I could not find out what the problem is. I share the maple file here and I will be grateful for any 

Download Timoshenko_Beam.mw

I should like to find the list of Friday 13 of a year

The help page mentions: 

The package supports five q-hypergeometric terms. They are q-Pochhammer symbol, q-binomial coefficient, q-brackets, q-factorial, and q-Gamma, which correspond to the five functions , , , , and . 

But what about the so-called q-hypergeometric function? Though there exist QDifferenceEquations:-IsQHypergeometricTerm and QDifferenceEquations:-QHypergeometricSolution in Maple, they do not seem to represent the function itself
For example, how to type the q-Gauss sum (cf. DLMF's §17.6(i)) or verify the last “simple series expression” given in Basic hypergeometric series - Wikipedia? In Mma, one may achieve these with something like 

while 

convert("QHypergeometricPFQ[{a, b}, {c}, q, c/(a b)]", 'FromMma', 'evaluate');
 = 
                              /                 c \
            QHypergeometricPFQ|[a, b], [c], q, ---|
                              \                a b/

So has the q-hypergeometric function been implemented in Maple?

What is the correct way, in code, to check if Maple result contains any one of its own global build in symbols such as _Z or _C or any such symbol it uses?

I need to bypass this result. Currently I check explicitly, but I am sure there is a better way. Here is an example

r:=discont(1/tan(x),x);

This returns 

Currently I do 

if has(r,_Z1)  or has(r,_Z2) or has(r,_Z3) then
etc...

same for _C1, _C2., etc...

But this method is not robust. The problem is that _Z1 is symbol. So I can't check for symbol type in the  result as result could possibly have one of my own symbols there depending on input.

Is there  better way to do this? I am only asking about output of discont here and not any other Maple function. I assume discont uses _Zn only but I am not sure. It could use different symbol? 

Example: Exanding the left hand side below to the right hand side

Unit('kg'*'m'/'s'^2) = Unit('kg')*Unit('m')/Unit('s')^2;

Such functionality would be useful for manipulating rational functions whose coefficients have units that can otherwise only be simplified by substituting new dimensionless independent variables as dicussed here.

Is there statement that can be mapped over an expression that identifies all subsexpressions with units and expands them to a products of units?

Probably not possible but also desireable: A variant that expands derived physical quantities to a product of base units as for example Newton to base units: Unit('N') = Unit('kg')*Unit('m')/Unit('s')^2;

Unit('N') = Unit('kg')*Unit('m')/Unit('s')^2;

Edit: Example from the link above on Unit expressions with compound units

``

Example that cannot be simplified

H(s) = 60.*Unit('m'*'kg'/('s'^2*'A'))/(.70805*s^2*Unit('kg'^2*'m'^2/('s'^3*'A'^2))+144.*s*Unit('kg'^2*'m'^2/('s'^4*'A'^2))+0.3675e-4*s^3*Unit('kg'^2*'m'^2/('s'^2*'A'^2)))

H(s) = 60.*Units:-Unit(m*kg/(s^2*A))/(.70805*s^2*Units:-Unit(kg^2*m^2/(s^3*A^2))+144.*s*Units:-Unit(kg^2*m^2/(s^4*A^2))+0.3675e-4*s^3*Units:-Unit(kg^2*m^2/(s^2*A^2)))

(1)

simplify(%)

H(s) = 60.*Units:-Unit(m*kg/(s^2*A))/(.70805*s^2*Units:-Unit(kg^2*m^2/(s^3*A^2))+144.*s*Units:-Unit(kg^2*m^2/(s^4*A^2))+0.3675e-4*s^3*Units:-Unit(kg^2*m^2/(s^2*A^2)))

(2)

After expansion of Unit expression (here done by hand) simplifcationis possible with other Maple commands

H(s) = 60.*Unit('m')*Unit('kg')/((.70805*s^2*Unit('kg')^2*Unit('m')^2/(Unit('s')^3*Unit('A')^2)+144.*s*Unit('kg')^2*Unit('m')^2/(Unit('s')^4*Unit('A')^2)+0.3675e-4*s^3*Unit('kg')^2*Unit('m')^2/(Unit('s')^2*Unit('A')^2))*Unit('s')^2*Unit('A'))

H(s) = 60.*Units:-Unit(m)*Units:-Unit(kg)/((.70805*s^2*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^3*Units:-Unit(A)^2)+144.*s*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^4*Units:-Unit(A)^2)+0.3675e-4*s^3*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^2*Units:-Unit(A)^2))*Units:-Unit(s)^2*Units:-Unit(A))

(3)

factor(H(s) = 60.*Units:-Unit(m)*Units:-Unit(kg)/((.70805*s^2*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^3*Units:-Unit(A)^2)+144.*s*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^4*Units:-Unit(A)^2)+0.3675e-4*s^3*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^2*Units:-Unit(A)^2))*Units:-Unit(s)^2*Units:-Unit(A)))

H(s) = 1632653.061*Units:-Unit(s)^2*Units:-Unit(A)/(Units:-Unit(m)*Units:-Unit(kg)*s*(19266.66666*s*Units:-Unit(s)+3918367.346+.9999999999*s^2*Units:-Unit(s)^2))

(4)

normal(H(s) = 60.*Units:-Unit(m)*Units:-Unit(kg)/((.70805*s^2*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^3*Units:-Unit(A)^2)+144.*s*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^4*Units:-Unit(A)^2)+0.3675e-4*s^3*Units:-Unit(kg)^2*Units:-Unit(m)^2/(Units:-Unit(s)^2*Units:-Unit(A)^2))*Units:-Unit(s)^2*Units:-Unit(A)))

H(s) = 60.*Units:-Unit(s)^2*Units:-Unit(A)/(Units:-Unit(m)*Units:-Unit(kg)*s*(.70805*s*Units:-Unit(s)+144.+0.3675e-4*s^2*Units:-Unit(s)^2))

(5)

Normalization to a dimensionless equation expression (that still has units) by a scaling factor with units

Sc := Unit('s')^3*Unit('A')/(Unit('m')*Unit('kg'))

Units:-Unit(s)^3*Units:-Unit(A)/(Units:-Unit(m)*Units:-Unit(kg))

(6)

(H(s) = 60.*Units[Unit](s)^2*Units[Unit](A)/(Units[Unit](m)*Units[Unit](kg)*s*(.70805*s*Units[Unit](s)+144.+0.3675e-4*s^2*Units[Unit](s)^2)))*(1/Sc)

Units:-Unit(m)*Units:-Unit(kg)*H(s)/(Units:-Unit(s)^3*Units:-Unit(A)) = 60./(Units:-Unit(s)*s*(.70805*s*Units:-Unit(s)+144.+0.3675e-4*s^2*Units:-Unit(s)^2))

(7)

Rewriting the left hand side

(proc (x) options operator, arrow; x = convert(x, units, m/V) end proc)(Sc)

Units:-Unit(s)^3*Units:-Unit(A)/(Units:-Unit(m)*Units:-Unit(kg)) = Units:-Unit(m/V)

(8)

isolate(Units[Unit](s)^3*Units[Unit](A)/(Units[Unit](m)*Units[Unit](kg)) = Units[Unit](m/V), Unit('m'))

Units:-Unit(m) = Units:-Unit(s)^3*Units:-Unit(A)/(Units:-Unit(m/V)*Units:-Unit(kg))

(9)

subs(Units[Unit](m) = Units[Unit](s)^3*Units[Unit](A)/(Units[Unit](m/V)*Units[Unit](kg)), Units[Unit](m)*Units[Unit](kg)*H(s)/(Units[Unit](s)^3*Units[Unit](A)) = 60./(Units[Unit](s)*s*(.70805*s*Units[Unit](s)+144.+0.3675e-4*s^2*Units[Unit](s)^2)))

H(s)/Units:-Unit(m/V) = 60./(Units:-Unit(s)*s*(.70805*s*Units:-Unit(s)+144.+0.3675e-4*s^2*Units:-Unit(s)^2))

(10)

Magnitude plot

abs(H(s)/Units[Unit](m/V) = 60./(Units[Unit](s)*s*(.70805*s*Units[Unit](s)+144.+0.3675e-4*s^2*Units[Unit](s)^2)))

abs(H(s))/Units:-Unit(m/V) = 60./(Units:-Unit(s)*abs(s*(.70805*s*Units:-Unit(s)+144.+0.3675e-4*s^2*Units:-Unit(s)^2)))

(11)

H(s) = H(f), s = I*omega, omega = 2*Pi*f

H(s) = H(f), s = I*omega, omega = 2*Pi*f

(12)

subs(H(s) = H(f), s = I*omega, omega = 2*Pi*f, abs(H(s))/Units[Unit](m/V) = 60./(Units[Unit](s)*abs(s*(.70805*s*Units[Unit](s)+144.+0.3675e-4*s^2*Units[Unit](s)^2))))

abs(H(f))/Units:-Unit(m/V) = 60./(Units:-Unit(s)*abs((2*I)*Pi*f*((4.448809357*I)*f*Units:-Unit(s)+144.-0.14700e-3*Pi^2*f^2*Units:-Unit(s)^2)))

(13)

plot(rhs(abs(H(f))/Units[Unit](m/V) = 60./(Units[Unit](s)*abs((2*I)*Pi*f*((4.448809357*I)*f*Units[Unit](s)+144.-0.14700e-3*Pi^2*f^2*Units[Unit](s)^2)))), f = 0*Unit('Hz') .. 10*Unit('Hz'), labels = [f/Unit('Hz'), lhs(abs(H(f))/Units[Unit](m/V) = 60./(Units[Unit](s)*abs((2*I)*Pi*f*((4.448809357*I)*f*Units[Unit](s)+144.-0.14700e-3*Pi^2*f^2*Units[Unit](s)^2))))])

 

 


Download Expansion_of_Unit_command_and_simplification_to_m_per_V.mw

Dear Maple experts, I have written a not-very-complicated Maple procedure, including eval, if, etc. However,

restartNULL

with(plots)

c := 1; cr := 0.3e-1*c; u := 1; sExp := 0.6e-1*c; s := .65*c; v := 3*c

NULL

NULLNULL

FirmModelH := proc (alpha, beta, delta, h) local q, p, pr, FirmpfSiS, F1, G1, G2, G3, RecpfSiS, sol, UnsoldSiS, EnvironSiS, p0, UsedSoldPrimary, xi, ps, qs, prs, prof1F, prof1P, prof2F, prof2P, kappa; option remember; kappa := (beta*(ps-delta*v)*(1-h)+sExp*(1-beta))/(beta^2*((ps-delta*v)*(1-h)-sExp)/(u*(1-alpha))+2*cr); prof1F := (ps-c)*qs+((1/2)*beta^2*qs^2*xi^2/(u*(1-alpha))-(1/2)*(1+beta*xi)^2*qs^2/u)*(ps-s)+h*(ps-delta*v)*(beta*xi*qs-(1/2)*beta^2*qs^2*xi^2/(u*(1-alpha))); prof1P := (ps-c)*qs+((1/2)*beta^2*kappa^2/(u*(1-alpha))-(1/2)*(qs+beta*kappa)^2/u)*(ps-s)+h*(ps-delta*v)*(beta*kappa-(1/2)*beta^2*kappa^2/(u*(1-alpha))); prof2F := (ps-c)*qs-(1/2)*(ps-s)*qs^2/(alpha*u)+h*(ps-delta*v)*(beta*xi*qs-(1/2)*beta^2*qs^2*xi^2/(u*(1-alpha))); prof2P := (ps-c)*qs-(1/2)*(ps-s)*qs^2/(alpha*u)+h*(ps-delta*v)*(beta*kappa-(1/2)*beta^2*kappa^2/(u*(1-alpha))); xi := 1; if alpha <= 1/(1+beta) then p, q := (eval([ps, qs], solve({diff(prof1F, qs) = 0, qs = alpha*u*(v-ps)/(v-s), c < ps, sExp+delta*v < ps}, [ps, qs])[1]))[]; if eval(kappa, [ps = p, prs = p-delta*v]) < q then p, q := (eval([ps, qs], solve({diff(prof1P, qs) = 0, qs = alpha*u*(v-ps)/(v-s), c < ps, sExp+delta*v < ps}, [ps, qs])[1]))[] end if; xi := min(1, (eval(kappa, [ps = p]))/q); FirmpfSiS := eval(prof1F, [ps = p, qs = q]); RecpfSiS := ((1-h)*(p-delta*v)-sExp)*(beta*xi*q-(1/2)*beta^2*xi^2*q^2/(u*(1-alpha)))+sExp*xi*q-cr*xi^2*q^2; UnsoldSiS := (1/2)*(1+beta*xi)^2*q^2/u-(1/2)*beta^2*xi^2*q^2/(u*(1-alpha)); EnvironSiS := q+UnsoldSiS else p, q := (eval([ps, qs], solve({diff(prof2F, qs) = 0, qs = alpha*u*(v-ps)/(v-s), c < ps, sExp+delta*v < ps}, [ps, qs])[1]))[]; pr = p-delta*v; if eval(kappa, [ps = p]) < q then p, q := (eval([ps, qs], solve({diff(prof2P, qs) = 0, qs = alpha*u*(v-ps)/(v-s), c < ps, sExp+delta*v < ps}, [ps, qs])[1]))[] end if; kappa := (beta*(p-delta*v)*(1-h)+sExp*(1-beta))/(beta^2*((1-h)*(p-delta*v)-sExp)/(u*(1-alpha))+2*cr); xi := min(1, (eval(kappa, [ps = p]))/q); FirmpfSiS := eval(prof2F, [ps = p, qs = q]); RecpfSiS := ((1-h)*(p-delta*v)-sExp)*(beta*xi*q-(1/2)*beta^2*xi^2*q^2/(u*(1-alpha)))+sExp*xi*q-cr*xi^2*q^2; UnsoldSiS := (1/2)*(1+beta*xi)^2*q^2/u-(1/2)*beta^2*xi^2*q^2/(u*(1-alpha)); EnvironSiS := q+UnsoldSiS end if; return p, q, FirmpfSiS, RecpfSiS, EnvironSiS, UnsoldSiS, UsedSoldPrimary, xi end proc
NULL

NULL

NULLNULL

NULL

FirmModelH(.8, .15, .15, .10)[3]

Error, (in FirmModelH) cannot determine if this expression is true or false: (-0.4957031250e-11*(-0.3155744681e13*xi^2+(0.3966029880e25*xi^4-0.2830096342e26*xi^3+0.4078080001e26*xi^2+0.5006706391e26*xi+0.5289940424e27)^(1/2)+0.1144851064e14*xi+0.7761702136e13)/(63.*xi^2-240.*xi-800.)-0.9750e-2)/(-0.3717773438e-11*(-0.3155744681e13*xi^2+(0.3966029880e25*xi^4-0.2830096342e26*xi^3+0.4078080001e26*xi^2+0.5006706391e26*xi+0.5289940424e27)^(1/2)+0.1144851064e14*xi+0.7761702136e13)/(63.*xi^2-240.*xi-800.)+0.768750000e-2) < (24.89361704*xi^2-102.*xi-720.0000001+0.1250000000e-10*(0.3966029880e25*xi^4-0.2830096342e26*xi^3+0.4078080001e26*xi^2+0.500670...

 

NULL

NULLNULLNULLNULLNULL

``

pltH01A := plot('FirmModelH(alpha, .25, .40, 0)[1]', alpha = 0. .. 1, color = yellow, legend = [SiS(h__0)], labels = [alpha, "New Product Price"], labeldirections = ["horizontal", "vertical"], symbolsize = 10, numpoints = 50, adaptive = false, axes = boxed, thickness = 1.0)

NULLNULLNULL

TH1 := table([seq(h = sprintf("SiS:", h), h = .1 .. .5, .2)])

WhyNotH1 := proc (alpha, h) if not [alpha, h]::(list(numeric)) then return ('procname')(args) end if; FirmModelH(alpha, 0.25, 0.40,h)[1] end proc:NULL

 

pltH1 := plot([seq(WhyNotH1(alpha, h), h = .1 .. .5, .2)], alpha = 0. .. 1, linestyle = [dash, dashdot, longdash], color = [red, green, blue], legend = [seq(typeset(TH1[h], 'h' = h), h = .1 .. .5, .2)], legendstyle = [location = left], labels = [alpha, "New Product Price"], labeldirections = ["horizontal", "vertical"], legendstyle = [location = bottom], thickness = 1.0, adaptive = false, axes = boxed)

 

Download SiS_Quadratic_(goal).mw

it faces an error saying that Maple cannot determine if the procedure is true. Would you please have a look and advise?

given 

r1:=   -1 <= x and x <= 0;
r2:=   0 <= x and x <= 1;

We see that the above can be simplified to one inequality

-1<= x and x<=1

The closest I found to do this is

r1:=-1 <= x and x <= 0;
r2:=0 <= x and x <= 1;
solve(r1 or r2,x);

which gives RealRange(-1, 1) but I'd like to get the form  -1<= x and x<=1 similar to:

I tried convert to piecewise and simplify and few other things. Is there a trick in Maple to simplify/combine/join inequalites like the above? i.e. convert RealRange(-1, 1) to -1<=x and x<=1 

everything is on the real line.

Maple 2023.2

> kernelopts(version)
   Maple 2023.2, X86 64 LINUX, Nov 24 2023, Build ID 1762575

I got results I did not expect using &^ and mod. So, I created a simple example.

powermod.mw

&^ ... mod does not seem to allow () to set order of execution where ^ ... mod does.

How does &^ ... mod arrive at the values that are different than ^ ... mod?

Tom Dean

How to solve this type of ode in maple

need the value of S, Q, E

how do i change the decimal separator, i cant find the setting anywhere. I already changed all the settings in windows related to this. It displays numbers the way i want it to, by separating decimals using a comma, since that's what I'm used to. My regional settings on windows are also correct, however I can't seem to get maple to use the same separation. It looks like 123.13 when i want it to be 123,13. I couldn't find a solution online so I made an account here in the hope of finding a solution. Thanks

Does anyone know the difference between the standard inv(A)*b to solve A*x=B linear system vs. the A\b usage by Matlab?  I believe they are different in method.

I can correctly solve with MatrixInverse(A).b for x but was wondering the differences, accuracy and overall shortcut command versus typing the full MatrixInverse function.

Just trying to improve my portability knowledge.    

Thanks in Advance,
Bill

First 93 94 95 96 97 98 99 Last Page 95 of 2376