Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am pretty new to maple and have the following question:

If I define a vector q containing a parameter b should i define it like:

q := vector[column]([b, 0])

or like

q(b) := vector[column]([b, 0])
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

It depends upon what you want to do with "q". If you simply want to refer to your vector, without instantiating the parameter "b", you can just use the first form. But, if you want to construct various vectors with different values of the parameter "b", you should probably define "q" to be a procedure with parameter "b". It appears that you may be trying to do just that with the second form, but it is not quite correct. Perhaps confusingly, the second form does create a procedure "q", but it is probably not what you expect. The syntax you are looking for in this case is probably

q := b -> Vector[column]([b,0]);

They way you wrote it, you get a procedure that returns a vector for the literal input `b' (i.e., the name `b`), whereas you probably want `q( 2 )' to return a vector with a "2" in it. (If I'm wrong in my assumptions about what you are trying to do then this advice is, of course, useless.)

share|improve this answer
    
Like James said, it depends what you want to do with it. If you are doing vector calculus then you might wanna use with(VectorCalculus) This defines vectors in a way such that you can use calculus tools on it. Similarly there is a linear algebra package as well. –  Tyler Hilton Oct 18 '11 at 23:45
    
ok thanks, what i want to do is i want to maximize some function of q with respect to b, i.e. I want to find a b, s.t. f(q) attains its maximum. So I should probably use the syntax you suggested? –  stefan Oct 19 '11 at 2:08
    
@stefan Yes, it sounds like this would be the right syntax for your situation. –  James Oct 19 '11 at 22:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.