marla11

40 Reputation

2 Badges

16 years, 50 days

MaplePrimes Activity


These are answers submitted by marla11

Thanks for the help but I found an alternative to erasing so I'm going to use that instead.

I realized in the new code I used I did not include the part with E[k] from the original is I changed it to:

with(plots):
datalist := array(0 .. 10000):

for j from 0 to 510 do
    datalist[j] := readdata(`destination0.txt`, integer, 3)
end do:
E := array(0 .. 1000):
for k from 0 to 510 do
    E[k] := pointplot3d(datalist[k], style = line, linestyle = solid, thickness = 3)
end do:
breaker := proc (L, A, B)
    local R, n, m, breakpoints;
    R := NULL ;
    n := nops(L);
    breakpoints := select(i-> (L[i] = A and L[i+1] = B), [$1 .. n-1]);
    m := nops(breakpoints);
    if m = 0 then L
    else L[1 .. breakpoints[1]], seq(L[breakpoints[i-1]+1 .. breakpoints[i]], i = 2 .. m), L[breakpoints[m]+1 .. n]
    fi
end proc;
PlotFrame := proc (i) options operator, arrow; plots:-display(E[i]) end proc;
evalindets(PlotFrame, listlist, breaker, [4, 3, 3], [2, 3, 4])
 

First I tried changing the integer to a float but neither the evalf or entering the points as floating-point numbers changed anything.

Concerning the "nothing shows up" I don't think I was clear enough.  First of all I ran the changed code (with the breaker in it) on a different worksheet than the original code so the original was not there.   Secondly, everything was repeated back to me because there were no colons but no plots of any kind showed up.
 

PlotFrame does not by itself produce a plot, animate produces it using PlotFrame.  This may be where there is a problem in the new code because animate is not used.

To tell you the truth I'm not sure I know enough of whats going on in the code to fully explain it clearly.  But to try:  Datalist[j] is an array of points read in from a file.  E[k] then takes the points from datalist[k] and makes a plot.  If an individual E[k] is printed (such as E[1]) then it prints a polygon based on the points from datalist[k] such as the picture below.  PlotFrame is then all the E[k] together (with B and C, which in this case don't matter).  Animate then creates the animation of all the PlotFrames. 

 


So I don't know if this helped answer any questions, and I know I probably confused people even more so thanks for trying to help.

This is exactly what I want to do but I can't seem to get it to work for my situation.  The original code I had was:

with(plots):
datalist := array(0 .. 10000):

for j from 0 to 510 do  
    datalist[j] := readdata(`destination0.txt`, integer, 3):
end do:

E := array(0 .. 1000):
for k from 0 to 510 do
    E[k] := pointplot3d(datalist[k], style = line, linestyle = solid, thickness = 3):
end do:

B := pointplot3d([[4, 3, 4], [3, 3, 4], [2, 3, 4]], color = [black], style = line, linestyle = solid,         thickness = 3):
C := pointplot3d([[3, 2, 2], [3, 2, 1], [3, 3, 1], [3, 4, 1], [3, 4, 2]], color = [black], style = line,     linestyle = solid, thickness = 3):
PlotFrame := proc (i) options operator, arrow; plots:-display(E[i], B, C) end proc:
animate(PlotFrame, [c], c = [`$`(1 .. 510-1)], trace = 0)

 

where `destination0.txt` contains a bunch of points and this prints out an animation of polygons.  However, now I want to get rid of the segement from [4,3,4] to [2,3,4] so I did:

 

datalist := array(0 .. 10000):
for j from 0 to 510 do
    
    datalist[j] := readdata(`destination0.txt`, integer, 3):
end do:

breaker:= proc(L, A, B)
        local R, n,m, breakpoints;
        R:= NULL;
        n:= nops(L);
        breakpoints:= select(i -> (L[i]=A and L[i+1]=B), [$1..n-1]);
        m:= nops(breakpoints);
        if m = 0 then L
        else L[1..breakpoints[1]], seq(L[breakpoints[i-1]+1..breakpoints[i]], i=2..m),
              L[breakpoints[m]+1..n]
        fi
    end proc;

PlotFrame := i -> plots[pointplot3d]( datalist[i], style=line, linestyle=solid, thickness=5 );
 
  evalindets(PlotFrame, listlist, breaker, ([4,3,3]), ([2,3,4]));
 

There are no errors but nothing shows up, so I was just wondering if I did something wrong or what I need to add something.

Thank you.

Page 1 of 1