Maple 15 Questions and Posts

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

Dear all,

I hope everyone helps me about the problem of converting a permutation into numbers and vice versa on maple

Let Sn denote the set of all permutations of the set {0, 1, ..., n − 1}

Lehmer code is a bijective function l : Sn ->{0, 1, 2, ..., n! − 1}.

Define function l(S)=Sum(ci x (n − 1 − i)! ) where S in Sn and ci is the number of elements of the set { j > i | sj < si }

Inverse Lehmer code is a bijective function l−1 : {0, 1, 2, ..., n! − 1} -> Sn

For example: n=4 -->{0, 1, 2, 3}, for S = (0, 2, 1, 3) , so c0 = 0, c1 = 1 ( j=2 > i=1 and sj = 1 < si = 2), c2 = 0, c3 = 0 -->

I(S) = 0 x (3-0)! + 1 x (3 - 1)! + 0 x (3-2)! + 0 x (3 - 3)! = 2! = 2. So I((0, 2, 1, 3)) =2  and I-1(2) = (0, 2, 1, 3).

How to calculate I and I-1 on maple? Please help me! Thanks alot.

 

 

I have not touched Maple in about 10 years and I'm back but apparently my Maple skills got quite a bit it rusty. I'm trying to plot a function but keep getting this warning and a blank graph:

"Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct"


Here is what I'm trying to do (put and call formulas for Black 76 model):

> with(Statistics);
> X := RandomVariable(Normal(0, 1));
> K := 150;
> r := 0.25e-1;
> s := .75;
> t := .5;
> d1 := f-> (log(f/K)+.5*s^2*t)/(s*sqrt(t)):

> d2 := f-> d1(f)-s*sqrt(t):
> c := f-> exp(-r*t)*(f*([CDF])(X, d1(f))-K*([CDF])(X, d2(f))) :
p := ->exp(-r*t)*(K*([CDF])(X, -d2(f))-f*([CDF])(X, -d1(f))):

All of the above work as intented:
> evalf(c(100)), evalf(p(100));

return the correct values. But I can't plot c( ) or p( ):

plot(c(f), f = 50 .. 100)

"Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct"

What am I doing wrong here? I will appreciate any help.

Thank you.

Hi, i want to plot an ode plot with respect to a parameter (E) in range [0,4] instead of time.
I start with unassign variable E and tried to change 't' for 'E' directly, but its give me error 
did I use the incorrect syntax/ step?
 

restart; with(linalg); with(VectorCalculus); with(DEtools); with(plots)

r := .9; K := 10; beta := .5; g := 0.3e-1; alpha[1] := .4; alpha[2] := 2.2; alpha[3] := 4; d[1] := .1; d[2] := .1; q := 1; E := 2.5; s := .46; delta := 1.5; b := 1.2; p := 1; c := 0.1e-1; mu := 0.25e-1; P0 := 4; M0 := 5; N0 := 3; L0 := 2; T := 20

> dP := VectorCalculus[`+`](VectorCalculus[`+`](VectorCalculus[`*`](VectorCalculus[`*`](r, P(t)), VectorCalculus[`+`](1, VectorCalculus[`-`](VectorCalculus[`*`](P(t), 1/K)))), VectorCalculus[`*`](g, P(t))), VectorCalculus[`-`](VectorCalculus[`*`](beta, P(t)))); dM := VectorCalculus[`+`](VectorCalculus[`+`](VectorCalculus[`*`](beta, P(t)), VectorCalculus[`-`](VectorCalculus[`*`](VectorCalculus[`*`](q, E), M(t)))), VectorCalculus[`-`](VectorCalculus[`*`](d[1], M(t)))); dN := VectorCalculus[`+`](VectorCalculus[`-`](VectorCalculus[`*`](s, N(t))), VectorCalculus[`*`](VectorCalculus[`*`](VectorCalculus[`*`](delta, N(t)), M(t)), 1/VectorCalculus[`+`](M(t), VectorCalculus[`*`](b, N(t))))); dL := VectorCalculus[`+`](VectorCalculus[`*`](VectorCalculus[`+`](alpha[1], VectorCalculus[`-`](VectorCalculus[`*`](VectorCalculus[`*`](alpha[2], L(t)), 1/VectorCalculus[`+`](alpha[3], M(t))))), L(t)), VectorCalculus[`-`](VectorCalculus[`*`](d[2], L(t))));

> satu := diff(P(t), t) = dP; dua := diff(M(t), t) = dM; tiga := diff(N(t), t) = dN; empat := diff(L(t), t) = dL;

> pdb := satu, dua, tiga, empat; fcns := {L(t), M(t), N(t), P(t)};
> Q := dsolve({pdb, L(0) = L0, M(0) = M0, N(0) = N0, P(0) = P0}, fcns, type = numeric, method = rkf45, maxfun = 500000);
> odeplot(Q, [[t, P(t), color = blue], [t, M(t), color = green], [t, N(t), color = red], [t, L(t), color = gold]], t = 0 .. T, numpoints = 100000, thickness = 2); 

its work fine if i plot with respect to time (t), but when i tried to change it for a parameter like E its doesnt work

unassign('E'); 
odeplot(Q, [[E, P(t), color = blue]], E = 0 .. 4, numpoints = 100000, thickness = 2)

Error, (in plots/odeplot) curve is not fully specified in terms of the ODE solution, found additional unknowns {E}
following the output that I expected

attached: captive_breeding.mw

Consider the finite field G:=GF(p,k) for some prime p and a positive integer k. Let H be an nxm matrix over G.

My question: How to obtain the minimum number of linearly dependent columns of the H over G. 

Thanks in advance  

How to find characterstics for the PDE  yzp+2xq=xy  using maple.....plz help me 

 

I want to write a procedure P such that the input of P is a positive integer number n and the output of P is a random permutation of the numbers {1,2,..,n}. 

I know that there is a command in Maple 2017 such that the command produces the mentioned request (random permutation in the combinatoric package), but I should work with Maple 15 and there is no the random permutation command in Maple 15. 

One of the solutions that I am used is based on the random number and check that if the produced numbers are pairwise distinct or not. The problem of this method  is that for n>128, it takes too time to generate a random permutation of the length n.

Thanks for any suggestions. 

Let A=(a_{i,j}) be an nxn non-singular matrix over GF(2). Assume that we have a positive integer number s and an irreducible polynomial f of degree n over GF(2). 

My question: How to get nxn binary matrices such as A provided that the characteristic polynomial  of these matrices over GF(2) is f and also sum(a_{i,j}) is equal to s with 1<=i<=n and 1<=j<=n.

For example, consider n=8 and s=10 and f= x^8+x^7+x^5+x+1. Then I applied the following Maple code to generate the mentioned matrices. 

restart
with(LinearAlgebra):

randomize(); 
 roll := rand(1 .. 64);
 roll1 := rand(1 .. 8); 
 roll2 := rand(9 .. 16);
 roll3 := rand(17 .. 24);
 roll4 := rand(25 .. 32);
 roll5 := rand(33 .. 40);
 roll6 := rand(41 .. 48);
 roll7 := rand(49 .. 56); 
 roll8 := rand(57 .. 64);

u := 1; while u > 0 do 
L := [roll(), roll1(), roll2(), roll3(), roll4(), roll5(), roll6(), roll7(), roll8(), roll()];
if nops({L[]}) = 10 then
A := Matrix(8, 8, 0); s := 0;
for i to 8 do
for j to 8 do 
s := (i-1)*8+j; 
if evalb(`in`(s, L)) then A[i, j] := 1 end if
end do; end do;
if Determinant(A) <> 0 then
if evalb(`in`(sort(`mod`(Factor(CharacteristicPolynomial(A, x)), 2))[x^8+x^7+x^5+x+1]))
then print(A, sort(`mod`(Factor(CharacteristicPolynomial(A, x)), 2))); 
u := 0 end if; end if; 
unassign('A, s, i, j') 
end if; end do; 
unassign('u, i')

with my computer, it takes less than one minute to generate an 8x8 desired non-singular binary matrix as follows

  \left[
 \begin {array}{cccccccc}
 0&0&1&0&0&0&0&0\\
 0&1&1&0&0&0&0&0\\
 0&0&0&1&0&0&0&0\\
 0&1&0&0&0&0&1&0\\
 1&0&0&0&0&0&0&0\\
 0&0&0&0&1&0&0&0\\
 0&0&0&0&0&0&0&1\\
 0&0&0&0&0&1&0&0
 \end {array} 
 \right]

I wish I could find a systematic method to find these kind of matrices. 

Thanks for any suggestions 

Suppose that A is an nxn matrix over the finite field Z:=GF(2,q) for some q. I wan to get the smitform of A over Z. First I used the package  

with(LinearAlgebra[Generic]) 

and after that I applied the command 

S := SmithForm[Z](A)

but the mentioned command made some errors. In fact, I do not how to define commands igcdex, iquo, irem, sign and abs for SmithForm over finite fields.

Thanks for any suggestions 

Suppose that n is a positive integer number and [k1,k2,...,kn] is a list of non-negative integer numbers. 

My Question: How to create the procedure proc([k1,k2,...,kn]) such that the output of this procedure is in the following form:

For i1 from 0 to k1 do

for i2 from 0 to k2 do

......................

for in from 0 to kn do

i1+i2+...+in

end do; end do;...end do;

Hello Everyone,

First of all I want to thank you to pay attention to my post.

For some reasons I want to know when does the root of my solution is equal to 0 isolating α, which yields the following equation
 

(6*alpha^4*l^2-7*alpha^3*l^2+6*alpha^3*l+2*alpha^2*l^2-6*alpha^2*l+alpha*l+3*alpha-2*sqrt(alpha^3*l^2*(alpha*l-l+1)*(9*alpha^4*l-13*alpha^3*l+9*alpha^3+6*alpha^2*l-12*alpha^2-alpha*l+6*alpha-1))-1)*(-1+2*alpha)/(alpha^2*l-3*alpha+1)^2 = 0
``

  1/2, -1/l, (1/8)*(3*l+(9*l^2-16*l)^(1/2))/l, -(1/8)*(-3*l+(9*l^2-16*l)^(1/2))/l``

``

NULL

 

NULL

``

 

 

When I substitute 1/2 it verifies the equation, but when I substitute other solutions my equation is not verified. For instance substituting "α=-1/l" I get something different from 0 as you can see

``

``

(6*alpha^4*l^2-7*alpha^3*l^2+6*alpha^3*l+2*alpha^2*l^2-6*alpha^2*l+alpha*l+3*alpha-2*sqrt(alpha^3*l^2*(alpha*l-l+1)*(9*alpha^4*l-13*alpha^3*l+9*alpha^3+6*alpha^2*l-12*alpha^2-alpha*l+6*alpha-1))-1)*(2*alpha-1)/(alpha^2*l-3*alpha+1)^2
"(->)"(-2/l-2*(1/l^2)^(1/2))*(-2/l-1)/(4/l+1)^2"(=)"2*((1/l^2)^(1/2)*l+1)*(2+l)/(4+l)^2

``

My question is what are these "solutions" if they are not solutions ?

I attach the file in case you would take a look at it

Download Maple_question2.mw

Hello,

Simple question:

Why does

restart;

(exp(I*t))^q;

`assuming`([simplify(%)], [t > 0, t < 2*Pi, q > 0, q < 1])

 

 

not simplify to exp(I*t*q)

?

I draw a 3d graph and now i want the table of this graph. how can we get a table from the data of a plotted graph.

May grapg was obtained from the following commands

 

restart;
plot3d(1/2*(q^(2*n)-5.*q^n+(2.*q-1)^n+3), q = 2 .. 15, n = 2 .. 20);
 

I am interested in taking a complex number and repeatedly raising it to a power and graphing the result to see if it looks cool (i think it will) to do this i wrote this program

iterativepower := proc (base, index, n)

local out, i;
out := vector(n+1, 1);

out[1] := base;

for i to n do out[i+1] := out[i]^index end do;

out;

end proc;


this can be run with:

iterativepower(2, 2, 5)


This doesn't return a vector, it returns the word out. Why is that, and how do i fix it?

Hi. Can anyone help me with this error, it says 

Error, (in unknown) cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up

 

restart

Shootlib := "F:\MAPLE\3";

"F:MAPLE3"

(1)

libname := Shootlib, libname;

"F:MAPLE3", "C:\Program Files\Maple 2015\lib", "."

(2)

with(Shoot);

[shoot]

(3)

with(plots):

``

FNS := {`&phi;p`(eta), f(eta), fp(eta), fpp(eta), fppp(eta), phi(eta), theta(eta), `&theta;p`(eta)}

{`&phi;p`(eta), f(eta), fp(eta), fpp(eta), fppp(eta), phi(eta), theta(eta), `&theta;p`(eta)}

(4)

ODE := {diff(`&phi;p`(eta), eta) = (-f(eta)*`&phi;p`(eta)+K*phi(eta)*(1-phi(eta))^2)*Sc, diff(f(eta), eta) = fp(eta), diff(fp(eta), eta) = fpp(eta), diff(fpp(eta), eta) = fppp(eta), diff(fppp(eta), eta) = (-fppp(eta)-f(eta)*fpp(eta)+k1*(2*fp(eta)*fppp(eta)-fpp(eta)^2)+lambda*fp(eta)+(1+Fr)*fp(eta)^2)/(k1*f(eta)), diff(phi(eta), eta) = `&phi;p`(eta), diff(theta(eta), eta) = `&theta;p`(eta), diff(`&theta;p`(eta), eta) = (-f(eta)*`&theta;p`(eta)+y*f(eta)*fp(eta)*`&theta;p`(eta))/(1/Pr-y*f(eta)^2)}

{diff(`&phi;p`(eta), eta) = (-f(eta)*`&phi;p`(eta)+K*phi(eta)*(1-phi(eta))^2)*Sc, diff(f(eta), eta) = fp(eta), diff(fp(eta), eta) = fpp(eta), diff(fpp(eta), eta) = fppp(eta), diff(fppp(eta), eta) = (-fppp(eta)-f(eta)*fpp(eta)+k1*(2*fp(eta)*fppp(eta)-fpp(eta)^2)+lambda*fp(eta)+(1+Fr)*fp(eta)^2)/(k1*f(eta)), diff(phi(eta), eta) = `&phi;p`(eta), diff(theta(eta), eta) = `&theta;p`(eta), diff(`&theta;p`(eta), eta) = (-f(eta)*`&theta;p`(eta)+y*f(eta)*fp(eta)*`&theta;p`(eta))/(1/Pr-y*f(eta)^2)}

(5)

blt := 4.; 1; IC := {`&phi;p`(0) = Psi, f(0) = 0, fp(0) = 1, fpp(0) = 0, fppp(0) = alpha, phi(0) = 0, theta(0) = 1, `&theta;p`(0) = beta}

4.

 

{`&phi;p`(0) = Psi, f(0) = 0, fp(0) = 1, fpp(0) = 0, fppp(0) = alpha, phi(0) = 0, theta(0) = 1, `&theta;p`(0) = beta}

(6)

BC := {fp(blt) = 0, fpp(blt) = 0, phi(blt) = 1, theta(blt) = 0};

{fp(4.) = 0, fpp(4.) = 0, phi(4.) = 1, theta(4.) = 0}

(7)

``

infolevel[Shoot:-shoot] := 1:

.7

 

1.0

 

.2

 

.2

 

1.0

 

.3

 

.5

 

.3

(8)

S := shoot(ODE, IC, BC, FNS, [alpha = 3.0125, beta = -2.31, Psi = -0.])

shoot: Step #  1

shoot: Parameter values :  alpha = 3.0125 beta = -2.31 Psi = -0.

Error, (in unknown) cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up

 

p := odeplot(S, [eta, fp(eta)], 0 .. 15)

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

display(p)

Error, (in plots:-display) expecting plot structure but received: p

 

p2 := odeplot(S, [eta, theta(eta)], 0 .. 10)

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

display(p2)

Error, (in plots:-display) expecting plot structure but received: p2

 

p3 := odeplot(S, [eta, phi(eta)], 0 .. 10)

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

display(p3)

Error, (in plots:-display) expecting plot structure but received: p3

 


 

Download Darcy.mw

Hi,

I am having trouble with the syntax for entering a limit of a multivariate function with direction specifiers.

For a single variate function f(x) the limit for x -> a from the right is specified by

limit(f(x),x=a,right)

A limit of a multivariate function f(x,y) for x -> a and y -> b can be entered by

limit(f(x,y),{x=a,y=b})

However I do not know how to specify directions in this case. Say, I want x to approach a from the right, and y to approach b from the left. What is the syntax to do this?

Cheers!

 

 

 

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