Hi,
Thanks, the '-operator helped.
Now I am facing another plotting issue:
code:
Pr1:[[10076,2527],[6288,2527],[2500,3474],[2500,6315],[2500,8209],[9500,5000],[12000,5000],[19000,5000],[23333,8209],[23333,7262],[23333,6315],[13864,2527],[10076,2527]];
Pr2:[[11182,9000],[8091,9000],[5000,9773],[5000,12091],[5000,13637],[10960,11000],[13000,11000],[18712,11000],[22000,13637],[22000,12864],[22000,12091],[14273,9000],[11182,9000]];
mrr:[1,0];
rotate(P,rr):=[P[1]*rr[1]-P[2]*rr[2] , P[1]*rr[2]+P[2]*rr[1]];
Bez(P,t):=(1-t)^3*P[1] + 3*(1-t)^2*t*P[2] + 3*(1-t)*t^2*P[3] +
t^3*P[4];
my_sublist(P,a,b):=rest(rest(P,a-1),-(length(P)-b));
decim(a):=a-floor(a);
t_snip(t):=if t>=1 then 0.99999999999 else t;
Bezm(Pr,t):=Bez(my_sublist(Pr,3*floor(t_snip(t)*((length(Pr)-1)/3))+1,3*floor(t_snip(t)*((length(Pr)-1)/3))+4),decim(t_snip(t)*((length(Pr)-1)/3)));
Prof(P1,P2,t,z,rr):=append(rotate(Bezm((1-z)*P1+z*P2,t),rr),
[z]);
plot3d('[Prof(Pr1,Pr2,tt,zz,mrr)[1],Prof(Pr1,Pr2,tt,zz,mrr)[2],Prof(Pr1,Pr2,tt,zz,mrr)[3]],[tt,0,1],[zz,0,1],['grid,100,10]);
plot3d('Prof(Pr1,Pr2,tt,zz,mrr),[tt,0,1],[zz,0,1],['grid,100,10]);
The first plot3d works fine, but the second one does not. Prof returns a
list of three items, so they should be equal.
Any ideas for this?
-Topi
On Mon, 2010-03-15 at 15:28 -0600, Robert Dodier wrote:
> On Mon, Mar 15, 2010 at 3:08 PM, Topi Rinkinen <maxima at topisoft.fi> wrote:
>
> > f(t):=[1,2,3,4,5,6,7,8,9][floor(t)+1];
> > plot2d([f(x)], [x,1,5], [y,0,9],[nticks,200]);
> >
> > gives:
> >
> > Subscript must be an integer:floor(x)+1#0: f(t=x) -- an error.
>
> The subscript of a literal list must be a literal integer.
> That's not consistent with Maxima's generally relaxed
> attitude toward partial evaluation, so from my point of
> view it's a bug. But for the moment let's try to think of
> a work-around.
>
> How about this:
>
> L : [1, 2, 3, 4, 5, 6, 7, 8, 9];
> f(t) := 'L[floor(t) + 1];
> plot2d ([f(x)], [x, 1, 5], [y, 0, 9], [nticks, 200]);
>
> The single quote ' applied to L[whatever] postpones the
> evaluation of the subscripted expression. (Actually 'L[whatever]
> is a so-called noun expression, meaning that it is not evaluated
> even when whatever is a literal integer ... I won't go into nouns
> and verbs right now.)
>
> > * My maxima version is "Maxima 5.13.0".
>
> My advice is to get a more recent version; that was several
> releases ago and there have been many bug fixes and other
> changes.
>
> best
>
> Robert Dodier
>