Carl Love

Carl Love

28025 Reputation

25 Badges

12 years, 313 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

You have given minimal information, so I can only give a minimal Answer. To evaluate an expression ex at x=17 do

eval(ex, x= 17);

If you need more help than that, you must post your code.

In Maple, the mathematical constant Pi is spelled with a capital P. If you spell it pi, it is treated as just another variable.

Hmm, I think that you mean a nine-game round of a competition, not a nine-team. How can there be nine games in the first round if there are nine teams? Anyway, here's a one-line procedure for it. The parameter n is the number of games. So, the matrix that you specifically asked for is T(9).

T:= n-> Matrix((op~)~(combinat:-permute([[1,0]$n,[0,1]$n], n)))^%T;

Note that every even-numbered row of the matrix is redundant: It is the exact opposite of the row above it.

I feel that the Answer by Markiyan and the comment by Tom have brought an unnecessary cloud of negativity over this situation. Yet it can be easily and simply solved by Maple when solutions exist.

Here's a worksheet with a procedure for the eigenvalues and a procedure for an associated eigenvector to each eigenvalue. I do an example over a field with a prime number of elements and one over a field with a prime power number of elements.


Eigenvalues and Eigenvectors over finite fields

 

In this worksheet, I present two simple procedures: One gives the eigenvalues of a matrix over a finite field, and the other returns an eigenvector given an eigenvalue.

`mod/Eigenvalues`:= proc(M::Matrix(square), p::posint)
     local x;
     Roots(Charpoly(M, x) mod p) mod p
end proc:

`mod/Eigenvector`:= proc(M::Matrix(square), lambda, p::posint)
#Returns an eigenvector of M associated with the eigenvalue lambda.
uses LA= LinearAlgebra;
local
     n:= op([1,1], M),
     rank, t,
     sol:= Linsolve(M - lambda*LA:-IdentityMatrix(n), Vector([0$n]), rank, t) mod p
;
     if rank=n then
          error "Second argument must be an eigenvalue of the first."
     end if;
     eval(sol, indets(sol, specindex(posint,t))[]= 1)
end proc:
     

Examples of use: First we do a field with a prime number of elements. Note that in the case of finite fields, there is a possibility that there are no eigenvalues.

p:= 13:

M:= LinearAlgebra:-RandomMatrix(10):

eig:= Eigenvalues(M) mod p;

[[9, 1]]

(1)

The eigenvalues are returned paired with their multiplicity.

 

Now get the eigenvector associated with the first eigenvalue.

if eig<>[] then Eigenvector(M, eig[1,1]) mod p end if;

Vector(10, {(1) = 2, (2) = 3, (3) = 1, (4) = 11, (5) = 5, (6) = 10, (7) = 10, (8) = 8, (9) = 10, (10) = 1})

(2)

Now an example over a finite field with a non-prime number of elements: GF(2,2).

alias(alpha= RootOf(x^2+x+1)):

R:= rand(1..4):

GF4:= [0,1,alpha,alpha+1]:

M:= Matrix(5, 5, (i,j)-> GF4[R()]);

M := Matrix(5, 5, {(1, 1) = alpha, (1, 2) = alpha+1, (1, 3) = 1, (1, 4) = 0, (1, 5) = alpha, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = alpha+1, (2, 5) = alpha+1, (3, 1) = alpha+1, (3, 2) = 0, (3, 3) = alpha+1, (3, 4) = 1, (3, 5) = alpha, (4, 1) = alpha+1, (4, 2) = 1, (4, 3) = 1, (4, 4) = alpha, (4, 5) = 1, (5, 1) = 1, (5, 2) = alpha, (5, 3) = alpha+1, (5, 4) = 1, (5, 5) = 0})

(3)

Eigenvalues(M) mod 2;

[[0, 1], [alpha+1, 2]]

(4)

Eigenvector(M, 0) mod 2;

Vector(5, {(1) = 1, (2) = 0, (3) = 0, (4) = 1, (5) = 1})

(5)

Eigenvector(M, alpha+1) mod 2;

Vector(5, {(1) = 0, (2) = alpha+1, (3) = 0, (4) = alpha, (5) = 1})

(6)

 


Download finite_field_eigenvalues.mw

The issue is exactly as Tom Leslie suggests in his fourth point: The lack of spacing in the expression P[B](p-w) causes Maple to interpret it as a function, P[B], whose argument is p-w. You no doubt intended for P[B] to be a coefficient to p-w. To express that multiplication, you need either a space or an explicit multiplication symbol between the two: either P[B] (p-w) or P[B]*(p-w).

This is only an issue when using Maple's odious 2D-input. In 1D-input, both f(x) and f (x) represent function application, and multiplication always requires an explicit symbol. I suggest switching to 1D-input.

The notation D(P[B])(p-w) means the derivative of the unknown (but known to be univariate) function P[B] evaluated at p-w.

I suspect that what you created was a table, not a list. I'd be able to tell instantly if I saw your code. So, try

display(convert(plotlist, list));

I suspect that you did something like the below, which creates a table, not a list:

for k to 5 do
     plotlist[k]:= plot(x^k, x= 0..1)
end do:

There's nothing wrong with the above code; indeed, one of the best ways to make a list is to first make a table and then convert it to list.

Yes, I can confirm it. To workaround, include the option linestyle= solid. This is also required if you want to see the wireframe or grid or mesh lines of surface plots.

Your input has been mangled horribly by Maple's 2D-input. In particular, most of your function applications have been misinterpretted as multiplications. For example, x(t) has been changed to x*t in several places. This is probably because you entered x (t) rather then x(t). I suggest that you use the 1D-input: Go to the Tools menu, select Options, then the Display tab. From the Input display pull-down, select Maple notation. Then select the Interface tab. From the "Default format for new worksheets" pull-down, select Worksheet. Then click on Apply Globally. Then open a new worksheet and retype your program.

Do you mean that you want the abcissa to be the circumference of a circle of radius R?

R:= 5:
plot(
     [
          [cos(t)*(cos(7*t)+R), sin(t)*(cos(7*t)+R), t= 0..2*Pi],
          [R*cos(t), R*sin(t), t= 0..2*Pi]
     ],
     color= [red, black], axes= none
);

plot3d([cos(t)*sin(p), sin(t)*sin(p), cos(p)], t= 0..2*Pi, p= 0..Pi);

You wrote:

I have another question: ... how could I find the values of root on vertical axis? In this figure I want to know the value of F(0) that cut the vertical axis?

Simply enter F(0), or in this case K(0), and you'll get the answer, 1. How is it possible that you are working with Kummer and Heun functions, and yet you don't know this basic math? It's called the y-intercept.

Yes, there is a shortcut. This can be done with a single call to dsolve with three parameters. Then the returned procedure is used for all n plots, resetting the parameters for each one. One parameter is the random value, and the other two are the starting values of t and for the segment. This runs very fast if is set to 36.

n:= 3:
Ra:= RandomTools:-Generate(float(range= 0.1e-1..0.5, method= uniform), makeproc):

b:= 0.1e-2:
T:= 10:

eq:= diff(L(t),t) = A*L(t)-b:
sol:= dsolve({L(T0) = L0, eq}, L(t), parameters= [T0, L0, A], numeric):

sol(0):= [L(t)=100]: #Load remember table with first initial condition.
for i to n do
     sol(parameters= [T*(i-1), eval(L(t), sol(T*(i-1))), Ra()]);
     p[i]:= plots:-odeplot(sol, [t,L(t)], t= T*(i-1)..T*i)
end do:

plots:-display(convert(p, list));

 

z:= Int(f(t-s), s= 0..1):
F:= unapply(subs(s= convert(s, `local`), z), t);

F(s);

There's no ambiguity in the above result: The two ss are distinct, and only the global one is accessible by name.

eval(%, s= q);

Try D(f)(-1) instead of diff.

Change

add((aver[1]-ma[j][2][1])^2, j = 1 .. 3)

to

add((rhs(aver[1])-rhs(ma[j][2][1]))^2, j = 1 .. 3)

First 265 266 267 268 269 270 271 Last Page 267 of 395