Adeel

4 Reputation

2 Badges

18 years, 113 days

MaplePrimes Activity


These are questions asked by Adeel

Hello,

Please help my with my program. First, I'll post the relevant code, then the questions:

--------------------------------------------------------------------------------------

with(Statistics); with(LinearAlgebra);

#k is a Vector everywhere in this program
ModeFreq := (k, m)->Norm(<Norm(k, 2), m>, 2);
OscillatorAmplitude :=(n, k, m, x) -> (ModeFreq(k, m)/Pi)^(1/4)*exp(-1/2*x^2*ModeFreq(k, m))*HermiteH(n, x*sqrt(ModeFreq(k, m)))/sqrt(2^n*factorial(n));
DeltaApproxAmplitude :=(x0, N, k, m, x) -> evalf(expand((sum(OscillatorAmplitude(n, k, m, x)*OscillatorAmplitude(n, k, m, x0), n = 1 .. N))/sqrt(sum(OscillatorAmplitude(n, k, m, x0)^2, n = 1 .. N))));
Hello,

Here is my problem:

> vec1:=Vector(2): plot(vec1[floor(x)], x = 1 .. 2);
Error, bad index into Vector

The above should give the zero plot, but it gives the error message.

Of course, vec1[floor(x)] gives the correct answer for any specific x. (i.e. vec1[floor(1.5324)] gives 0, which is correct).

I get the same problem when plotting or integrating functions that simliarly depend on Matrices. What's going on?

Sincerely,
Adeel
Page 1 of 1