acer

17433 Reputation

29 Badges

14 years, 144 days

On google groups. (comp.soft-sys.math.maple and sci.math.symbolic)

On stackoverflow.

On math.stackexchange.com.

MaplePrimes Activity


These are replies submitted by acer

It would be much better if your clearly explained your broader goal, rather than showing us difficulties you have with your attempts at getting there.

@vv 

restart;

kernelopts(version);

`Maple 2018.2, X86 64 LINUX, Nov 16 2018, Build ID 1362973`

eqa := x(n) = x(n-1)*(9+n)*(10-n)*F(n)/(2*n);

x(n) = (1/2)*x(n-1)*(9+n)*(10-n)*F(n)/n

H := rsolve({convert(eqa,signum),x(1)=1},x(n));

H := piecewise(1 <= n and n < 10, -(-1)^n*2^(1-n)*(product(F(n0+1)*(n0^2+n0-90)/(n0+1), n0 = 1 .. n-1)), 0)

HH := factor(combine(convert(eval(H,F=(n->(-1)^n)),factorial))) assuming n::integer;

HH := piecewise(n < 1, 0, n < 10, -(-1)^((1/2)*n*(n+5))*2^(-n)*factorial(9+n)/(45*factorial(9-n)*factorial(n)), 10 <= n, 0)

seq(HH,n=1..12);

1, 22, -308, -3003, 21021, 105105, -360360, -765765, 765765, 0, 0, 0

 

Download rsolve_goofy.mw

@mmcdara Yes, the double underscore is just to avoid collision with other names (including special ones).

Another way to do such things is to use an anonymous procedure which is called directly. In such a way name collision is avoided, as the temporary names are local. For example, the following is procedure call of an anonymous procedure. Note the round brackets at the end.

   proc() local LL,KK,KO,NN,ver; ....etc... end proc():

 

@opus64 Right, that is why I stated that, "the optimal solution would be for each parameter's label in each separate exploration to be able to retain its own independent formatting specification."

By the above I meant a scenario in which each parameter could get its own individual treatment, and in which that individual treatment would be part of the embedded exploration's (handling of the) individual Slider components (and not the package's general common runtime).

At present there is no way to get distinct formatting for distinct parameters (eg, with values on quite different scales).

@mmcdara Thank you. However, your claim is not true, in several ways.

For regular output, the following can be done (since about Maple 18 or whenever 2D plots got the size option):

Resize:=proc(P,m::posint,n::posint)
      op(0,P)(op(P),ROOT(BOUNDS_X(0),BOUNDS_Y(0),
                   BOUNDS_WIDTH(n),BOUNDS_HEIGHT(m)));
   end proc:

P:=plot3d(cos(x)*y^3,x=-Pi..Pi,y=-1..1):

Resize(P,700,700);

The difference is that the code in the Post (at top) enables the size option to be used directly in each plotting command. That's more direct than modifying a generated 3D plot result, after generation, with such a Resize procedure. That is the central idea of this current post.

Since you mention DocumentTools, well, there too it is possible to embed a plot that is either smaller or larger than default. Your code snippet is just not one of the ways to enlarge it. The DocumentTools facilities also allow for embedding of programmatically scaled and panned plots. But note that these DocumentTools mechanisms are only for embedded display effects, whereas the size option produces a plot as output/return-value and which carries its size details as part of its structure

Upload a .mw Document/Worksheet that reproduces your problem in full.

You can make it at attachment here  using the green up-arrow in the mapleprimes editor.

@mmcdara In this attachment (made with Maple 2015), it does what you've shown except for showing one step separately.

That omitted single step is the bringing of the inert Diff inside the inert Sum, prior to actually differentiating. It could be done, but perhaps not in a way that makes the mechanism natural for any non-Maple-user audience.

The loading of student is to get the Sum expansion in Maple 2015. The extended typesetting mode is to allow inert `%.` to prettyprint nicely, since not default in Maple 2015.

restart:

kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

with(student): with(LinearAlgebra):
interface(typesetting=extended):

RSS := Sum((Y[n] - (a*X[n]-b))^2, n=1..N);

Sum((-a*X[n]+b+Y[n])^2, n = 1 .. N)

G := [Diff(RSS, a), Diff(RSS, b)];

[Diff(Sum((-a*X[n]+b+Y[n])^2, n = 1 .. N), a), Diff(Sum((-a*X[n]+b+Y[n])^2, n = 1 .. N), b)]

eval(G, Diff=diff);

[Sum(-2*(-a*X[n]+b+Y[n])*X[n], n = 1 .. N), Sum(-2*a*X[n]+2*b+2*Y[n], n = 1 .. N)]

expand(%);

[2*a*(Sum(X[n]^2, n = 1 .. N))-2*b*(Sum(X[n], n = 1 .. N))-2*(Sum(X[n]*Y[n], n = 1 .. N)), -2*a*(Sum(X[n], n = 1 .. N))+2*b*(Sum(1, n = 1 .. N))+2*(Sum(Y[n], n = 1 .. N))]

(M, P) := GenerateMatrix(%, [a, b]);

M, P := Matrix(2, 2, {(1, 1) = 2*(Sum(X[n]^2, n = 1 .. N)), (1, 2) = -2*(Sum(X[n], n = 1 .. N)), (2, 1) = -2*(Sum(X[n], n = 1 .. N)), (2, 2) = 2*(Sum(1, n = 1 .. N))}), Vector(2, {(1) = 2*(Sum(X[n]*Y[n], n = 1 .. N)), (2) = -2*(Sum(Y[n], n = 1 .. N))})

`%.`('M', <[a,b]>) ='P';

`%.`(M, Vector(2, {(1) = a, (2) = b})) = P

EQ := %;

EQ := `%.`(Matrix(2, 2, {(1, 1) = 2*(Sum(X[n]^2, n = 1 .. N)), (1, 2) = -2*(Sum(X[n], n = 1 .. N)), (2, 1) = -2*(Sum(X[n], n = 1 .. N)), (2, 2) = 2*(Sum(1, n = 1 .. N))}), Vector(2, {(1) = a, (2) = b})) = (Vector(2, {(1) = 2*(Sum(X[n]*Y[n], n = 1 .. N)), (2) = -2*(Sum(Y[n], n = 1 .. N))}))

 

And, for no reason,

 

eval(EQ, `%.`=`.`);

(Vector(2, {(1) = 2*a*(Sum(X[n]^2, n = 1 .. N))-2*b*(Sum(X[n], n = 1 .. N)), (2) = -2*a*(Sum(X[n], n = 1 .. N))+2*b*(Sum(1, n = 1 .. N))})) = (Vector(2, {(1) = 2*(Sum(X[n]*Y[n], n = 1 .. N)), (2) = -2*(Sum(Y[n], n = 1 .. N))}))

simplify(combine(map(lhs-rhs,Equate(op(%)))));

[2*(Sum(a*X[n]^2-b*X[n]-X[n]*Y[n], n = 1 .. N)), -2*(Sum(a*X[n]-b-Y[n], n = 1 .. N))]

 

Download SimplifySum_bis_ac.mw

@vv Thank you very much for the comments.

I believe that the failure to auto-scale (to a square the size of the smaller dimension) for the case you mention is fixable. I have also observed somewhat new behavior when manually resizing purely horizontally, on occasion, and I've reported that regression recently. But the case of a purely square window, or oblong in the other orientation, seems fine..

I also believe that the case you describe is quite uncommon, since if behaving fixed it would incur the wasteful white space above and below (which is unpopular). Or one could simply force a large square. So, either undesirable or already attainable.

I would also like new plot substructures to denote the axis ratios, and the pan and zoom. The latter pair of those are currently stored in the XML of a .mw file but not in the actual plot structure; ie. Maple language. So some of those effects can be achieved by embedding with DocumentTools, but not with regular output. There is an example of an animation within a long prism in the Help, where the 3D plot shows without the usual unfortunate large white spaces above and below.

Small steps...

I have posted a patch/edit attempt here:
    https://mapleprimes.com/posts/211817-3D-Plot-Size-Option

@Thomas Richard A minor comment: data could also be split with,
   xdata := data[..,1]: ydata := data[..,2]:
 

@amrramadaneg Why haven't you answered Carl's questions?

As stated your question doesn't make sense.

@arashghgood What are the values of alpha and beta, exactly?

Your explanation is inadequate.

Do you have the context-panel open on the right? Is the behavior the same if you close it?

@Kitonum This code relies on ListTools:-Collect for its crucial task of tallying the data, a command which was introduced only in Maple 2017.

In contrast, the Statistics:-Tally command predates that by many years, and its output can be quite easily used to form the coordinate pairs obtained from ListTools:-Collect even if more general plotting is wanted.

In Maple 2016 these get me a similar effect:

with(Statistics):
L := [1,2,2,2,3,3,4,4,5,5,6,6]:

Statistics:-Histogram( L, binwidth=1-1e-9,
                       view=[min(L)-1..max(L)+1,0..0.3],
                       xtickmarks=[{L[]}[]] );

Statistics:-Histogram( L, binbounds=[seq(min(L)-0.5..max(L)+0.5)],
                       view=[min(L)-1..max(L)+1,0..0.3],
                       xtickmarks=[{L[]}[]] );

T := table(Tally(L,output=list),sparse):
S := {L[]}:
LL := [seq(i=T[i]/nops(L),i=min(S)..max(S))]:
ColumnGraph(LL, datasetlabels=none,
            offset=0.5, distance=0.0, width=1.0,
            view=[min(L)-1..max(L)+1,0..0.3],
            xtickmarks=[seq(i,i=min(S)..max(S))]);

hist_2016.mw

1 2 3 4 5 6 7 Last Page 3 of 400