Items tagged with vector vector Tagged Items Feed

Consider the list [x,y,z], say. Does there in Maple exist some fundamental function for querying the position in the list of x,y, and z, respectively? I am unable to locate any such. Such a function can, of course, be constructed, an example being the following:

listPos := (l::list) -> table(zip(`=`,l,[$(1..nops(l))])):
pos := listPos([x,y,z]);
pos[x],
pos[y],
pos[z];

But that seems unsatisfactory. The same question concerning Vectors: Consider Vector([x,y,z]), say. Here, the following code, say, will perform the task:

VectorPos := (V::Vector) -> table([map(rhs = lhs,op(2,V))[]]):
pos := VectorPos(Vector([x,y,z]));
pos[x],
pos[y],
pos[z];

PS: Of course, list and Vectors can be converted into one another, so any one of the codes above can in practice be used to perform both tasks.

Hello,

How can I do to suppress all the complex components of a vector ? Is there a simple code to do this?

For example, I would like to replace the complex components with zero.

If the considered vector is a:= [2+I,2,5], i would like to obtain after modifications amod:= [0,2,5] ou amod  [Nothing,2,5]

VectorWithComplexComponents.mw

Nota :

The origin of my issue is to be able to plot points with the following syntax :

pointplot([tp,xp,symbol = solidcircle,color=black,symbolsize = 10): where xp is a vector with, sometimes, some complex components. 

I would like to plot the points only for the real components of xp

Thanks a lot for your help

 

 

Good day everyone, I would like to know how to work this out in a code on maple:
-I have some vectors (K(1),K(2),K(3) etc) similar to this:

K(1)=[A B C]

-I want to sort all of them by the value of C, but when I use the sort built in comand the program return a answer based on K index instead a sorting based on C.

Any ideas would be higly apreciated.

Hello everyone, I recently learned how to plot vector fields using maple. So far, I know of two ways using VectorField(output = plot) and fieldplot3d(some_vectorfunction). My problem is that, it seems these two functions yield slightly different plots, fieldplot3d seems to give a more accurate depiction of the actual vector field, whereas the other function gives a similar ouput but in a more 'sloppy' form. Is this normal? Or am I doing something wrong?

Here are the two plots done by each function:

fieldplot3d:

Plot done by 'fieldplot3d' function.

VectorField(output = plot):

Plot done by 'VectorField(output = plot)' function.

Hey,


I want to assign a value to a symbol stored in a vector. I know the position of the symbol in the vector. Is there an easy way to do this?

Here to illsutrate my problem:

restart:

vec:=<a,b,c>:

vec(1):=1;    # expected result: a:=1

vec := Vector(3, {(1) = 1, (2) = b, (3) = c})

(1)

a;            # expected result: 1

a

(2)

 

 

Download point_to_element.mw

 

 

A := Vector([1, 2, 3])

solve(2*A = 5+x, {x})

 

can anyone help me why i am having proble to solve for x?

Thanks

Hello


I am new to maple. If i have a vector from 0 to 1000 every 10 step (in matlab it is sth like this x=0:10:1000) can anyone help me how to do this in maple?

thanks

I have a vector, it is a zero vector apparently. I don't know what opperation lead to it being a zero vector. Any time I try to reduce this thing, I mess it up. I can't reduce it manually.

a=-((4*I)*sqrt(3)+4*sqrt(3)-5-7*I)/((4*I)*sqrt(3)+4*sqrt(3)-7-9*I)

b=-((390*I)*sqrt(3)+30*sqrt(3)-52-675*I)/(-3-4*I+2*sqrt(3)+(2*I)*sqrt(3))^3

c=-(1/2)*sqrt(2-2*I)*((6*I)*sqrt(3)+6*sqrt(3)-11-10*I)*(-2+sqrt(3))*sqrt(-2-2*I)*((2*I)*sqrt(3)+2*sqrt(3)-5-2*I)/(-3-4*I+2*sqrt(3)+(2*I)*sqrt(3))^3

 

<a/sqrt(a^2+b^2+c^2),b/sqrt(a^2+b^2+c^2),c/sqrt(a^2+b^2+c^2)>

 

The simplify command will reduce this bugger no problem. The moment I try rationalizing the denominator or anything like that I end up buggering the whole thing up. Maybe I should do a distance on two of the ordinates independently first. Anyway, I don't know what's up. 

Dear all;

 

Hello everybody, I need your help to dispaly some values obtained using my function f. When I run the code there is no results obtained. Many thanks.

restart:

# The vectors e(i) satify the folowing conditions
e(0)*e(1)=e(n-1) assuming  1<n;
e(0)*e(0)=e(2):
e(1)*e(1)=e(n-1) assuming  1<n: :
e(2)*e(1)=e(n) assuming  1<n:
#
for i from 1  to n-1 do
e(i)*e(0)=e(i+1);
end do:

# We define the function f
f:=e(0)->e(0)+(n-3)*e(1);
f:=e(1)->(n-2)*e(1);
for i from 2  to 3 do
f:=e(i)->(n+i-3)*e(i)+(i-1)*(n-3)*e(n-3+i);
end do:

for i from 4 to n do
f:=e(i)->(n+i-3)*e(i)
end do:

# We define the two vectors
x:=sum(alpha(k)*e(k),k=0..n);
y:=sum(beta(k)*e(k),k=0..n);

#Question : I would like to compute the following  but there is no display of the solution. 
(x*y);
f(x*y);
f(x);
f(y);
x*f(y);
f(x)*y;
f(x*y)- f(x)*y-x*f(y);

Hello all,

I am trying to create a matrix throgh a procedure but unfortunately I could not find how to define an empty matrix in Maple. This is how my procedure looks like,

Initial_Matrix := proc (BC::list, n, BP::list)
local M::Matrix, i;
M:=[][];
for i from 1 to numelems(BC) do
M:= <M,function_coeffs(BC[i], n, BP)>;
end do;

where the procedure function_coeffs returns a row vector. Logically, it should keep adding rows function_coeffs(BC[i], n, BP) to the emty matrix, but its not happening. Please help me out.

Thank you for your time.

Hi,

what i have to calculate in Maple for q=Mises-Stress and the third invariant of deviatoric stress as r???

It is for:

Link:
http://www.egr.msu.edu/software/abaqus/Documentation/docs/v6.7/books/stm/default.htm?startat=ch04s04ath116.html

 

Suppose we are given a matrix M[n*2n] of n linearly independent row vectors. Then I am trying to create a procedure to add n more linearly independent row vectors to this matix resulting in to a matrix M[2n*2n].

Consider this easy example, if the given matrix $M_{2*4}$ is

Matrix(2, 4, {(1, 1) = 4, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 4, (2, 4) = 1}) 
then we can add $[0,0,0,1]$ and $[0,0,1,0]$ to obtain the matrix $M_{4*4}$

Matrix(4, 4, {(1, 1) = 4, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 4, (2, 4) = 1, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 1, (4, 4) = 0})

 

Can I use rref form?Thank you for your help.

 

I am tryng to write and solve within Maple the equations of movement for a single body subject to a gravitatinal field, F_=-GMm/r2

But I get an error message when trying to define the Angular Momentum which doesn't make sense for me.

Thank you for any help on this topíc.


restart; with(Physics[Vectors]); conventions, Setup(mathematicalnotation = true);
conventions, [mathematicalnotation = true]
r_ := rho*_rho;
r_ := rho _rho
_rho(t);
_rho(t)
rho(t);
rho(t)
v_ := diff(rho(t)*_rho(t), t);
/ d \ / d \
v_ := |--- rho(t)| _rho(t) + rho(t) |--- phi(t)| _phi(t)
\ dt / \ dt /
a_ := diff(%, t);
/ 2 \
| d | / d \ / d \
a_ := |---- rho(t)| _rho(t) + 2 |--- rho(t)| |--- phi(t)| _phi(t)
| 2 | \ dt / \ dt /
\ dt /

/ 2 \ 2
| d | / d \
+ rho(t) |---- phi(t)| _phi(t) - rho(t) |--- phi(t)| _rho(t)
| 2 | \ dt /
\ dt /

eq[1] := -G*M*_rho(t)/r^2-a_ = 0;
/ / 2 \ 2\
| G M | d | / d \ |
eq[1] := _rho(t) |- --- - |---- rho(t)| + rho(t) |--- phi(t)| |
| 2 | 2 | \ dt / |
\ r \ dt / /

/ / 2 \
| / d \ / d \ | d |
+ _phi(t) |-2 |--- rho(t)| |--- phi(t)| - rho(t) |---- phi(t)|
| \ dt / \ dt / | 2 |
\ \ dt /

\
|
| = 0
|
/
Eq[1, 2] := seq(Component(lhs(eq[1]), n) = 0, n = 1 .. 2);
/ 2 \ 2
G M | d | / d \
Eq[1, 2] := - --- - |---- rho(t)| + rho(t) |--- phi(t)| = 0,
2 | 2 | \ dt /
r \ dt /

/ 2 \
/ d \ / d \ | d |
-2 |--- rho(t)| |--- phi(t)| - rho(t) |---- phi(t)| = 0
\ dt / \ dt / | 2 |
\ dt /
NULL;

L_ := `&x`(r_, m*v_);
Error, (in Physics:-Vectors:-&x) found the unit vector _rho present also as a function _rho(t); either one form or the other - not both - can be present in an algebraic expression

 

If I have an N-dimensional vector V and a polytope defined as the set of solutions to the equation A*x = b, where A is a d X N matrix, and b is a d X 1 vector, how can I project V onto the surface defined as above?

Thanks!

Hello,

I'm having an issue with this and I can't seem to fix it. Any help is greatly appreciated! Thank you in advance!!! For some reason mapleprimes won't let me upload the worksheet so I have pasted it below this message.

 

Kind regards.

Gambia Man

with(LinearAlgebra); UseHardwareFloats; with(plots); interface(rtablesize = infinity); with(Statistics);
L := 4; U := 1;
V := proc (x, y) options operator, arrow; piecewise((1/4)*L <= x and x <= (1/2)*L and (1/4)*L <= y and y <= (1/2)*L, U) end proc;
plot3d(V(x, y), x = 0 .. L, y = 0 .. L);

Vij := proc (ni, mi, nj, mj) local Xi, Xj; option remember; global U, L; Xi := 2*sin(ni*evalf(Pi)*x/L)*sin(mi*evalf(Pi)*y/L)/L; Xj := 2*sin(nj*evalf(Pi)*x/L)*sin(mj*evalf(Pi)*y/L)/L; return U*(int(int(Xi*Xj, x = (1/4)*L .. (1/2)*L), y = (1/4)*L .. (1/2)*L)) end proc;
HamilMat := proc (K::integer) local ni, mi, nj, mj, N, Hamil, Eigenvec, i, j, res; option remember; global Vij, U, L; N := K^2; ni := Vector(N); mi := Vector(N); nj := Vector[row](N); mj := Vector[row](N); for i to N do for j to K do res := (i+K-j)/K; if type(res, integer) = true then ni[i] := j; nj[i] := j; mi[i] := res; mj[i] := res end if end do end do; Hamil := Matrix(N, shape = symmetric); for i to N do for j from i to N do if i <> j then Hamil(i, j) := Vij(ni[i], mi[i], nj[j], mj[j]) elif i = j then Hamil(i, j) := Vij(ni[i], mi[i], nj[j], mj[j])+(1/2)*(ni[i]^2+mi[i]^2)*Pi^2/L^2 end if end do end do; Eigenvec := Eigenvectors(Hamil, output = ['values', 'vectors']), Hamil end proc;
SigFigEi := proc (Location::integer, SigFig::integer, VecSize::integer) local values, Eig, i; global HamilMat, OptK; Eig := Vector(VecSize); for i from 2 to VecSize do Eig[i] := HamilMat(i)[1][Location]; if evalf(Eig(i), SigFig+1) = evalf(Eig(i-1), SigFig+1) then OptK := i; break end if end do; values := evalf(Eig[i], SigFig); return values, OptK end proc;
BasisFunc := proc (location) local ni, mi, func, i, j, p, N, res, BasisSol; global HamilMat, L, OptK; p := evalf(Pi); N := OptK^2; ni := Vector(N); mi := Vector(N); for i to N do for j to OptK do res := (i+OptK-j)/OptK; if type(res, integer) = true then ni[i] := j; mi[i] := res end if end do end do; func := Vector(N); for i to N do func[i] := HamilMat(OptK)[2][i][location]*sin(ni[i]*p*x/L)*sin(mi[i]*p*y/L) end do; BasisSol := unapply(add(func[i], i = 1 .. N), x, y); return plot3d(BasisSol(x, y), x = 0 .. L, y = 0 .. L), func end proc;
BasisFunc(1);
Error, (in Vector) dimension parameter is required for this form of initializer

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