MaplePrimes Questions

Unfortunately,  Optimization:-Maximize command in following example returns a not precise result (I use Maple 2020).

restart:
s1:= Optimization:-Maximize((x-2*y)/(5*x^2-2*x*y+2*y^2), {2*x^2 - y^2 + x*y=1})

Maple is running the following results:

I read help of  Maximize, It seems to be using only numerical methods .

 

The Minimize and Maximize commands use various methods implemented in a built-in library provided by the Numerical Algorithms Group (NAG). 

 

Can't Maple find a symbolic solution for extreme values under such constrained inequality or equality conditions?

Ps:

For the correct  symbolic  solution, we can try to  use Mathematica 12.

Maximize[{(x - 2*y)/(5*x^2 - 2*x*y + 2*y^2), 
  2*x^2 - y^2 + x*y == 1}, {x, y}]

  We can compare numerical sizes of Optimal solution between maple and mathematica. 

Digits:=20;
sqrt(2.)/4.

Another Problem:

If I accept numerical solutions of maple ,how do I estimate errors without knowing the exact solution ?

 

 

 

I am trying to compute the rank of the Commutator Matrix of a Lie algebra. That is, I wish to construct a matrix version of the multiplication table for a given matrix Lie algebra, and then compute the rank of this matrix.

 

Download CommutatorExample.mw
 

with(DifferentialGeometry); with(LieAlgebras)

``

``

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

[Matrix(%id = 18446744078224010646), Matrix(%id = 18446744078224010766), Matrix(%id = 18446744078224003190)]

(1)

L := LieAlgebraData(M, Alg1)

_DG([["LieAlgebra", Alg1, [3, table( [ ] )]], [[[1, 3, 3], 1], [[2, 3, 3], -1]]])

(2)

``

DGsetup(L)

`Lie algebra: Alg1`

(3)

T := MultiplicationTable("LieTable")

Matrix(%id = 18446744078223968366)

(4)

``

``

``

``

 

 

I have the above, but I run into two issues:

1. It doesn't have matrix format, so Rank is undefined (I have tried convert(T,matrix) to no avail),

2. I need to be able to remove the first and second rows and columns from T (because these rows/columns are occupied by the Lie algebra's basis elements, and separating lines, respectively).

 

I believe that if I can convert T into a matrix somehow, I can simply use SubMatrix to remove the things I don't want, and then Rank should work.

 

Any help would be greatly appreciated!

 

P.S. Thanks to dharr1338 for the suggestion of including the worksheet, I'm very new to Maple and MaplePrimes, so I appreciate the patience.

Hi, I am working on a bification diagram and was wondering if there is a way to plot the stable and unstable curves onto one figure.

I have two curves, if the eq1<eq2 I would like to indicate when this happens, with a dashed line.

When eq1>eq3 I would like to indicate this with a soild line.

implicitplot, x[m] vs x[u] with axis[2]=[mode=log] 

r:=0.927: K:=1.8182*10^8:d[v]:=0.0038:d[u]:=2: delta:=1: p[m]:=2.5: M:=10^4: p[e]:=0.4: d[e]:=0.1: d[t]:=5*10^(-9): omega:=2.042: b:=1000: h[e]:=1000:h[u]:=1:h[v]:=10^4:

eq1 := r*d[t]*h[e]*x[u]^3+(r*h[e]*(-K*d[t]+d[t]*h[v]+d[e])+r*p[e]*x[m])*x[u]^2+(r*h[e]*(-K*d[t]*h[v]-K*d[e]+d[e]*h[v])+K*p[e]*(d[u]-r)*x[m])*x[u]-r*K*h[e]*d[e]*h[v];

eq2 := (d[t]*x[u]+d[e])*(2*r*x[u]/K+d[u]*p[e]*x[m]*x[u]/((h[v]+x[u])*(d[t]*x[u]+d[e])*(h[e]+p[e]*x[m]*x[u]/((h[v]+x[u])*(d[t]*x[u]+d[e]))))-r)+d[u]*h[e]*x[u]*(p[e]*h[v]*x[m]/(h[v]+x[u])^2-d[t]*p[e]*x[m]*x[u]/((h[v]+x[u])*(d[t]*x[u]+d[e])))/(h[e]+p[e]*x[m]*x[u]/((h[v]+x[u])*(d[t]*x[u]+d[e])))^2

i have matrix M depend on x1 x2 x3 .... want limit of M. for sure can use loop like M[i,j]:=limit(M[i,j],[x1=0,x2=0,...]; i=1.. j=1..

want use map2 to do all at same time, try map2(limit,[x1=0,x2=0],M); gives error

Error, invalid input: limit expects its 1st argument, expr, to be of type Or(equation, algebraic), but received [x1 = 0, x2 = 0]

is possible to do using map or other thing not loop

 

Consider the family of functions "{`f__n`   : -infinity< n<infinity}," where the index n is
integer, and f__n; proc (R) options operator, arrow; R end proc.   It is known that diff(f__n(x), x) = `f__n-1`(x) for all n.

 

I want to convey that information to Maple.  For instance, given the input
diff(f[3](x),x), Maple should return f__2(x).  Similarly:
diff(f[3](x), x$2)                   should return   f__1(x)
f[4](x)*diff(f[3](x),x)^5   should return   f__4(x)*f__2(x)^5

What is a good way of doing that?

 

Hello,

I have tried to get a simple matlab example of a fourier transform code to work in Maple. This is just to understand a simple fourier transform and eventually try some more difficult 2D transforms.

restart:
with(LinearAlgebra):
with(RandomTools):
with(orthopoly):
with(plots):
with(ArrayTools):
with(DiscreteTransforms):
Digits:=15:

# 1D Fourier Transform

Fs := 1000;                       # Sampling frequency                    
T := 1/Fs;                        # Sampling period       
L := 1500;                        # Length of signal
t := Vector(L, i -> i-1)*T:       # Time vector

f := Fs*Vector(floor(L/2)+1, i-> i-1)/L:   # Frequency                 


S:= Vector(L, i -> 0.7*sin(2.0*Pi*50*t[i]) + sin(2.0*Pi*120*t[i])):    # Signal


Z1 := FourierTransform(Vector(L, j->S[j])):              # DFT 
Z2 := Vector(L, i-> sqrt(Re(Z1[i])**2 + Im(Z1[i])**2)):  # Amplitude
                

FP1 := pointplot({seq([f[n],Z2[n]],n=1..floor(L/2)+1)}, labels=["Frequency","Amplitude"], connect=true, color=green):

display(FP1, axes=boxed);

The right answer should be a plot with frequencies at 50Hz and 120Hz, with amplitudes at 0.7 and 1.0, respectively. However my amplitude axes is off somehow and I don't understand why. 

Hello!

Could you help me please to plot a fuction with domain and complex range (Maple 2020.1). For example:

f := (x, w) -> exp(w*x*I)

x,w are real numbers

 

Hello!

I've just want to use indexes in functions, like this (Maple 2020.1)

f[l,m]:=(x,y)->x^k + y^m

But I can't get the result of it:

f[1,1](2,2)

Maple show me not 4, but the same function.

Hi, am trying to differentiate the following eq w.r.t t2 and N. But in t2 I am getting zero and in wrt N, an Error (non-algebraic expressions cannot be differentiated). But according to the article, I am following expression should come.

I am differentiating following

TCS := proc (N, T, m, n) options operator, arrow; piecewise(M <= t__3 and N <= t__4, TCS__1, M <= t__3 and t__4 < N, TCS__2, t__3 <= M and N <= t__4, TCS__3, `t__3 ` <= M and t__4 < N, TCS__4) end proc

ode5 := diff(proc (N, T, m, n) options operator, arrow; piecewise(M <= t__3 and N <= t__4, TCS__1, M <= t__3 and t__4 < N, TCS__2, t__3 <= M and N <= t__4, TCS__3, `t__3 ` <= M and t__4 < N, TCS__4) end proc, t__2) = 0

ode6 := diff(proc (N, T, m, n) options operator, arrow; piecewise(M <= t__3 and N <= t__4, TCS__1, M <= t__3 and t__4 < N, TCS__2, t__3 <= M and N <= t__4, TCS__3, `t__3 ` <= M and t__4 < N, TCS__4) end proc, N) = 0

Error, non-algebraic expressions cannot be differentiated
 

following are the pre-requisite to use above (also in the attachment doubt_2.mw)

i__m1(t) = ((-c*t^2*theta__m^2+b*t*theta__m^2+2*c*t*theta__m-b*theta__m+theta__m^2-2*c)*exp(theta__m*t)*a*N^alpha*(lambda-1)/theta__m^3-(-b*theta__m+theta__m^2-2*c)*a*N^alpha*(lambda-1)/theta__m^3)*exp(-theta__m*t)

i__m2(t) = (-(-c*t^2*theta__m^2+b*t*theta__m^2+2*c*t*theta__m-b*theta__m+theta__m^2-2*c)*exp(theta__m*t)*a*N^alpha/theta__m^3+(-c*t__2^2*theta__m^2+b*t__2*theta__m^2+2*c*t__2*theta__m-b*theta__m+theta__m^2-2*c)*exp(theta__m*t__2)*a*N^alpha/theta__m^3)*exp(-theta__m*t)

TC__m := A__m/(t__1+t__2)+(int(h__m*(i__m*t+1)*i__m1(t), t = 0 .. t__1))*(int(h__m*(i__m*t+1)*i__m2(t), t = 0 .. t__2))+P__m*I__om*m*(-(1/3)*a*c*N^alpha*M^3+(1/2)*a*b*N^alpha*M^2+a*N^alpha*M)/(t__1+t__2)+C__m*theta__m*(int(i__m1(t), t = 0 .. t__1)+int(i__m2(t), t = 0 .. t__2))/(t__1+t__2)

i__d(t) = (-(-c*t^2*theta__d^2+b*t*theta__d^2+2*c*t*theta__d-b*theta__d+theta__d^2-2*c)*a*N^alpha*exp(theta__d*t)/theta__d^3+(-c*t__3^2*theta__d^2+b*t__3*theta__d^2+2*c*t__3*theta__d-b*theta__d+theta__d^2-2*c)*a*N^alpha*exp(theta__d*t__3)/theta__d^3)*exp(-theta__d*t)

TC__d1 := A__d*m/(t__1+t__2)+m*(int(h__d*(i__d*t+1)*i__d(t), t = 0 .. t__3))/(t__1+t__2)+P__d*I__OD*m*n*(-(1/3)*a*c*N^alpha*N^3+(1/2)*a*b*N^alpha*N^2+a*N^alpha*N)/(t__1+t__2)+P__m*theta__m*m*(int(i__d(t), t = 0 .. t__3))/(t__1+t__2)+P__m*I__c*m*(int(i__d(t), t = M .. t__3))/(t__1+t__2)-P__d*I__e*m*(-(1/3)*a*c*N^alpha*M^3+(1/2)*a*b*N^alpha*M^2+a*N^alpha*M)/(t__1+t__2)

TC__d2 := A__d*m/(t__1+t__2)+m*(int(h__d*(i__d*t+1)*i__d(t), t = 0 .. t__3))/(t__1+t__2)+P__d*I__OD*m*n*(-(1/3)*a*c*N^alpha*N^3+(1/2)*a*b*N^alpha*N^2+a*N^alpha*N)/(t__1+t__2)+P__m*theta__m*m*(int(i__d(t), t = 0 .. t__3))/(t__1+t__2)-P__d*I__e*m*(-(1/4)*a*c*N^alpha*t__3^4+(1/3)*a*b*N^alpha*t__3^3+(1/2)*a*N^alpha*t__3^2+M-t__3-(1/3)*a*c*N^alpha*t__3^3+(1/2)*a*b*N^alpha*t__3^2+a*N^alpha*t__3)/(t__1+t__2)

i__r(t) = (-(-c*t^2*theta__r^2+b*t*theta__r^2+2*c*t*theta__r-b*theta__r+theta__r^2-2*c)*a*N^alpha*exp(theta__r*t)/theta__r^3+(-c*t__4^2*theta__r^2+b*t__4*theta__r^2+2*c*t__4*theta__r-b*theta__r+theta__r^2-2*c)*a*N^alpha*exp(theta__r*t__4)/theta__r^3)*exp(-theta__r*t)

TC__r1 := A__r*m*n/(t__1+t__2)+m*n*(int(h__r*(i__r*t+1)*i__r(t), t = 0 .. t__4))/(t__1+t__2)+P__d*theta__r*m*n*(int(i__r(t), t = 0 .. t__4))/(t__1+t__2)+P__d*I__c*m*n*(int(i__r(t), t = N .. t__4))/(t__1+t__2)-P__r*I__e*m*n*(-(1/4)*a*c*N^alpha*N^4+(1/3)*a*b*N^alpha*N^3+(1/2)*a*N^alpha*N^2)/(t__1+t__2)

TC__r2 := A__r*m*n/(t__1+t__2)+m*n*(int(h__r*(i__r*t+1)*i__r(t), t = 0 .. t__4))/(t__1+t__2)+P__d*theta__r*m*n*(int(i__r(t), t = 0 .. t__4))/(t__1+t__2)-P__r*I__e*m*n*(-(1/4)*a*c*N^alpha*t__4^4+(1/3)*a*b*N^alpha*t__4^3+(1/2)*a*N^alpha*t__4^2+N-t__4-(1/3)*a*c*N^alpha*t__4^3+(1/2)*a*b*N^alpha*t__4^2+a*N^alpha*t__4)/(t__1+t__2)

TCS__1 := TC__m+TC__d1+TC__r1

TCS__2 := TC__m+TC__d1+TC__r2

TCS__3 := TC__m+TC__d2+TC__r1

TCS__4 := TC__m+TC__d2+TC__r2

 

Thanks in advance.

Hi,

I want to solve an equation(see the attached file) numerically, find  values of M that satisfy this equation and then plot the curve of M versus sigmai for those values of M that satisfy the mentioned equation. How can I do that with Maple?

 

eq.mw

In the OrthogonalExpansions package, how can I change the summation variable to be n instead of i?


doubt_1.mw

Hi, I am trying to solve two simultaneous equations (for t1) they are as follows-

eq 1

i__m2(0) = (-(-b*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`+`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2-2*c)*exp(0)*a*N^alpha/`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^3+(-c*t__2^2*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2+b*t__2*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2+2*c*t__2*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`-b*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`+`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2-2*c)*exp(`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`*t__2)*a*N^alpha/`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^3)*exp(0)

eq 2

i__m1(t__1) = ((-c*t__1^2*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2+b*t__1*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2+2*c*t__1*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`-b*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`+`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2-2*c)*exp(`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`*t__1)*a*N^alpha*(lambda-1)/`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^3-(-b*`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`+`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^2-2*c)*a*N^alpha*(lambda-1)/`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`^3)*exp(-`#msub(mi("&theta;",fontstyle = "normal"),mi("m"))`*t__1)

rhs(i__m2(0) = (-(-b*theta__m+theta__m^2-2*c)*exp(0)*a*N^alpha/theta__m^3+(-c*t__2^2*theta__m^2+b*t__2*theta__m^2+2*c*t__2*theta__m-b*theta__m+theta__m^2-2*c)*exp(theta__m*t__2)*a*N^alpha/theta__m^3)*exp(0)) = rhs(i__m1(t__1) = ((-c*t__1^2*theta__m^2+b*t__1*theta__m^2+2*c*t__1*theta__m-b*theta__m+theta__m^2-2*c)*exp(theta__m*t__1)*a*N^alpha*(lambda-1)/theta__m^3-(-b*theta__m+theta__m^2-2*c)*a*N^alpha*(lambda-1)/theta__m^3)*exp(-theta__m*t__1))

solve({-(-b*theta__m+theta__m^2-2*c)*a*N^alpha/theta__m^3+(-c*t__2^2*theta__m^2+b*t__2*theta__m^2+2*c*t__2*theta__m-b*theta__m+theta__m^2-2*c)*exp(theta__m*t__2)*a*N^alpha/theta__m^3 = ((-c*t__1^2*theta__m^2+b*t__1*theta__m^2+2*c*t__1*theta__m-b*theta__m+theta__m^2-2*c)*exp(theta__m*t__1)*a*N^alpha*(lambda-1)/theta__m^3-(-b*theta__m+theta__m^2-2*c)*a*N^alpha*(lambda-1)/theta__m^3)*exp(-theta__m*t__1)}, [t__1]);
Warning, solutions may have been lost
 

Can someone, please help. Thanks in advance.

Any idea why a similar indexing call to an Array and a Matrix gives different "orientations"?

The indexing call [1..2,1] to a Matrix gives a a column Vector, while a similar call to an Array gives a (row) Array. So somehow the Array call gives a transpose of the original.

MatrixVsArray.mw

I have used maple to solve a system of differential equations. However, I need to do the same in R. The problem is that when I use the same parameter values as used in maple to R, I don't get the same plots. Can someone assist wrt? 

The definition 
a:=ModularSquareRoot(10,11)
returns
Error, ... because no numbers in Z11 have the square equal to 10. I need, in a procedure, to prevent the error, I mean something like this:
if a<>ERROR then b:=b+1 else c:=c+1 end if
Any suggestions? Thanks

First 524 525 526 527 528 529 530 Last Page 526 of 2428