25 Reputation

2 Badges

3 years, 235 days

MaplePrimes Activity

These are replies submitted by mkonto

@vv The code that I originally needed now works well, thanks to you, so once again I say thanks. I am running into one more issue (and I apologize if this has an obvious solution, as I am new to Maple - though I did do a good deal of searching on Maple's website to no avail): in short I reuse part of the procedure you define to pick a random vector which satisfies Ax = b. That code is here:

allSolutions := LinearSolve(A, b, free = t);

firstGuess:= eval(allSolutions, t = 1);

If my understanding is correct this should just substitute 1 into the free variable t in the solutions to Ax = b. What is weird is that when t = 0, as in your original solution, it works fine! But I need to be able to substitute non-zero values, and for whatever reason when I do that I get out a vector that looks something like [3 + t_3, 15 + t_3, 12 + t_3] (where t is replaced with it's value, but still takes the form t_3, so the first element if t=1 looks like 3 + 1_3, and doesn't evaluate to 4, as it should.) Note that if t = 0 I do NOT get [3 + 0_3, 15 + 0_3, 12 + 0_3], instead I get what I want, which is [3, 15, 12]. 0 seems to be the only exception. 

I also tried using the subs() command instead, but got the same results. Again all help is greatly appreciated.


@vv First off, thank you this did the trick more or less, my problem now is that my vector is a Gradient of some other function. It's almost working, but keeps throwing the Error, (in VectorCalculus:-Gradient) no coordinate names were given. I have no clue how to get around this, as I've tried specifying cartesian both in the input to that function, e,g. pass a vector v after calling setCoordinates(v, cartesian), and I've also tried specifying it in the call to gradient - neither seems to work. Any ideas?

Much appreciated!

Page 1 of 1