35 Reputation

8 years, 147 days

How to check whether a vector is a multi...

Maple

Hi,

How would you go about checking whether a vector is a scalar multiple of another in the set? eg. my set is {[-2, 1, 1, -2, 1, 1], [-2, 1, 1, 2, -1, -1], [0, -1, 1, 0, 1, -1], [0, 1, -1, 0, -1, 1]}. I need to get rid of one of the last two, since it is (-1) times the other.

What would be the most straightforward way of doing this? I've tried doing something along the lines of V1=c.V2 for each component and then checking...

Simple question about 'and' in if loops...

Maple

Hi,

Another (hopefully) simple question that I can't work out the answer for. How can I write an if loop for which n things must be true? I need to have:

if thing[1]=true and thing[2]=true and thing[3]=true and ... and thing[n]= true then
...;
fi;

n will change for different inputs, so I can't write out explicitly.

Hope that makes sense! Thanks.

Expanding non-commutative products...

Maple

Hi,

I need to expand a function of the form {[1]}.{[2]}.({[2, 3]}-{[3, 2]}).({[1, 3]}-{[3, 1]}), where '.' is for non-commutative multiplication. I need to get  {[1]}.{[2]}.{[2,3]}.{[1,3]} - {[1]}.{[2]}.{[2,3]}.{[3,1]} - ... (the order of matters).

Maple has a command 'expand', but that only works for normal products. eg. {[1]}*{[2]}*({[2, 3]}-{[3, 2]})*({[1, 3]}-{[3, 1]}).

Any help appreciated!

Is there a simple way to turn an inner l...

Maple

Hi,

I'm trying to develop a new notation and am having problems with lists vs. sets.

Basically I have things of the form [[a,b]],[[c,d,e]],[[f],[f,h]] and I want to change them to the form [{a,b}],[{c,d,e}],[{f},{f,h}].

I start from a flat list [a,b,c,d,e,f,f,h] and then divide it up, so using sets initially would lose repeated elements. But then once it has been divided up, I need the innermost brackets to be sets.

Simple question about excluding values f...

Maple

Say I wanted to print out all values from 1 to 8 but excluding 3, how would I do that using a for loop?

For example, this just stops after 2:

for i to 8 while i <> 3 do
print(i);
end do ;

whereas I want it to skip 3 so going 1,2,4,5,6,7,8.

For what I'm actually doing, I need i to run over a range but excluding one value.

Thanks!

 1 2 Page 1 of 2
﻿