acer

32358 Reputation

29 Badges

19 years, 332 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Markiyan Hirnyk It did make a difference. Instead of having to waffle around with calls to both eliminate and solve, the formula for Y as a function of only X can be done using just eliminate. I was also addressing Carl's concerns about lexicographic dependency and luck.

And now, negate theta. X stays the same and Y flips sign.

@Markiyan Hirnyk Why not eliminate both Y and theta? The result include formulas for Y in terms of X alone, and for theta in terms of X alone (and restrictions on X, which happen to be null).

restart;
eq1:=convert( X=cos(theta) + 0.8e-1*cos(3.*theta), rational):
eq2:=convert( Y=-sin(theta)+ 0.8e-1*sin(3.*theta), rational):
sols:=[eliminate({eq1,eq2},{Y,theta})]:
seq(sols[i][2], i=1..nops(sols));  # restrictions on X (NULL)
S:=seq(eval(Y,sols[i][1]),i=1..nops(sols)):
plot(S[1],X=-1-0.8e-1..1+0.8e-1,color=red);

Now, you may wish to try and show programmatically that only S[1] of the three results in sol is real. And then you might justify the negation Y=-S[1].

@Carl Love It might also be worth noting in this context, to get the x-axes alignment effect that the aligncolumns option of plots:-display provides,

_PLOTARRAY( Matrix(2,1, [P1,P2]), _ALIGNCOLUMNS(true) );

@Carl Love I checked, and see that I submitted a bug report (SCR) on the setattribute and floats problem in the Standard GUI in July 2010.

(I have an idea that it might have regressed between Maple 11 and Maple 12, but I haven't double-checked that.)

@rlewis You might want to ensure that you're using a completely new name for the .gif target file (in case the unrebooted machine is confused about the old 0 byte file -- possibl even an orphaned kernel?).

Note that for "large" 3D animations the whole export process can use a lot of memory and a lot of time. It gets more severe as the number of frames and the size of the plotted structures grow. 100 frames can be "large" in the 3D case. Also, using plottools:-sphere rather than pointplot3d symbol=solidsphere incurs more cost.

The Maple Standard GUI can also leak memory, when rendering involved 3D plots. This can hamper 3D plot animation export which itself can use a lot of resources. It can help to export from a GUI session in which you haven't otherwise display the animation inline. Or you could run the code the generates the export fully programmatically in another interface (such as the CLI Commandline Interface).

If it happens for a modest number of frames, with an entirely new filename, using the symbol=solidsphere way, then you might check that the OS is not running any errant mserver processes. Ie, if all instances of maple owned by you are shut down and some mserver process owned by you is still running, then that process could be killed (or the host restarted).

@Karen If I knew this then I'd forgotten it.

It appears to also work on ListBox entries, component tooltips, and DataTable row and column names.

And it also seems to work with colors specified in hex format.

Using 64bit Maple 2015.0 on Linux or 64bit Maple 2015.1 on Windows 7,

Download dtfun.mw

 

@Fabian The condition -u(f,g)+u(h,e)>0 is not implied by u(anything,anything) being positive.

However,

restart:

z:=((-u(f,g)+u(h,e))^(1/a))^a:

simplify(z,symbolic);

                             -u(f, g) + u(h, e)

You might also note that in some cases you can restrict the simplification (if you don't want too much of it to be done). Eg,

restart:

z:=((-u(f,g)+u(h,e))^(1/a))^a+sin(x)^2+cos(x)^2-1:

simplify(z,power,symbolic);

                                            2         2    
                 -u(f, g) + u(h, e) + sin(x)  + cos(x)  - 1


simplify(z,symbolic);

                             -u(f, g) + u(h, e)

@rlewis In my 64bit Maple 12.02 on Windows 7 it takes 1 minute for the animate call below to compute. Then, when I use commands to programmatically export to a .gif it takes 20 sec before a 0 KB file appears and then another 40 sec before the full 2.4 MB file appears.

I used plotsetup to change the plot output device to gif. That way I didn't have to use any right-click menus to export.

A few things to note about Maple 12: the plots:-display command does not applying directional lighting or surface glossiness by default (ie. opposite of Maple 2015). So I specify those as options below.

I find that the solidcircle symbol of a 3D point plot looks clunky and rough at large symbolsize. So I use plottools:-sphere below instead. Adjust its grid option to make it more or less smooth.

restart;
with(plots): with(plottools):
f1:=cos(t)/4: f2:=sin(t)/5: f3:=sin(2*t+1)/6:
pts:=[[0,0,f1],[1+f2,1,1],[-1,0,f3]]:
ptsL:=[pts[],pts[1]]:
c:=[blue,red,green]:
p1:=seq(sphere(eval(ptsL[i],t=0),0.07,color=c[i],
               grid=[30,30],style=patchnogrid),
        i=1..3):
p2:=pointplot3d(eval(ptsL,t=0),connect,thickness=3,color=black):
display(p1,p2,scaling=constrained,lightmodel=Light4,glossiness=1.0);
p:=tt->display(seq(sphere(eval(ptsL[i],t=tt), 0.07,
                          color=c[i], grid=[30,30],
                          style=patchnogrid, lightmodel=Light4),
                   i=1..3),
               pointplot3d(eval(ptsL,t=tt),
                           connect, thickness=3, color=black),
               scaling=constrained,lightmodel=Light4,glossiness=0.0):
A:=animate(p,[t],t=0..50,frames=100):
fn:=cat(kernelopts(homedir),"/rl01.gif"):
plotsetup(gif,plotoutput=fn);
A; # This should now create the .gif file, eventually.

Running the above in 64bit Maple 12.02 on Windows 7 gave me this .gif, eventually.

 

@rlewis Using Preben's code for Maple 12, and running it in Maple 12.02, I right-clicked and chose "Export" as the bottom choice in the popped-up context-menu. I selected the GIF item from the submenu of that "Export" item. I gave it a file location, etc. It takes a few moments for Maple to finish writing out the .gif file and close the write operation.

Here's what I got when it finished writing out the file:

@Carl Love I don't want to confuse Robert, but FYI it is possible in Maple 2015 to write code which embeds a PlotComponent which contains the plot-sequence-animation and which plays it automatically (ie. fully programmatically).

Robert, Carl's suggestions 1) or 2) are very much the usual way, and are what you need to do in Maple 12.

Also, Robert, right-click context-menu export of the visible plot (animation) should allow you to produce an animated .gif file, if you want.

@rlewis Apart from converting to tangents your bullet points are what I did in my Answer. I used expand to deal with terms like cos(t1+t). Then I used freeze and subs to replace the sin and cos terms with names. Then I built extra a set of the additional equations based on that same trig identity. And then I solved with RootFinding:-Isolate (which I let return float results but which internally does exact solving for the system of polynomials with exact rational coefficients -- its default method=RS computes via a Groebner basis ). And then I used the solutions from that stage to recover roots in terms of the original names (and I noted that I could have just used inverse trig, but wanted it coded more generally).

 

@Carl Love The output from anames could be compared, from before and after.

Hmmm.  By Maple 17.02 `realroot` has become an appliable module which doesn't export `zero_one`.

restart:

kernelopts(version);

          Maple 16.02, X86 64 WINDOWS, Nov 18 2012, Build ID 788210

showstat(zero_one);
Error, (in showstat) procedure name expected

readlib(realroot);

                 proc(poly, widthgoal)  ...  end proc;

showstat(zero_one);

zero_one := proc(A, x, n, widthgoal)
local Astar, var, L, Aprime, Lprime, Aprime2, Lprime2, y;
   1   Astar := expand(subs(y = x+1,expand(y^n*subs(x = 1/y,A))));
   2   var := polyvariations(Astar,x,n);
   3   if var = 0 then
   4     return []
       elif var = 1 then
   5     if 1 <= widthgoal then
   6       return [[0, 1]]
         else
   7       return midpoint(A,x,n,widthgoal)
         end if
       end if;
   8   Aprime := subs(x = 1/2*x,A);
   9   if subs(x = 1,Aprime) = 0 then
  10     L := [[1/2, 1/2]];
  11     divide(A,2*x-1,'Aprime');
  12     Aprime := subs(x = 1/2*x,Aprime)
       else
  13     L := []
       end if;
  14   Aprime := expand(2^n*Aprime);
  15   Lprime := zero_one(Aprime,x,n,2*widthgoal);
  16   L := [op(L), op(map((x, y) -> map(y,x),Lprime,z -> 1/2*z))];
  17   Aprime2 := expand(subs(x = x+1,Aprime));
  18   Lprime2 := zero_one(Aprime2,x,n,2*widthgoal);
  19   L := [op(L), op(map((x, y) -> map(y,x),Lprime2,z -> 1/2*z+1/2))]
end proc

And then there are `polyvariations` and `midpoint` and a few other erstwhile locals of module `realroot`to consider as well.

Was `zero_one` ever documented? If not, why use it without making a code comment about what it does?

Your question is not clearly phrased.

Are you looking for a sequence of some (or all) of the permutations of the fixed number k diagonal entries being 1? For example, for fixed k=7 you want several or all of the possible permutations of the 7 nonzero values along the disagonal?

Or are you looking for a sequence, for k=1..9 say, where the k entries of value 1 are in the first (say, or last) k rows? 

acer

How many pieces are allowed?

Do you have a mechanism for evaluating f(x) at arbitary x, or do you only know f(x) at a fixed, given set of x points?

Are you looking to minimize the error between f(x) and the approximation, between known endpoints and a and b?

More details of your goal would likely help get you to an acceptable answer.

acer

First 329 330 331 332 333 334 335 Last Page 331 of 592