vv

13790 Reputation

20 Badges

9 years, 306 days

MaplePrimes Activity


These are replies submitted by vv

@max125 

No, you are not, according to the provided print screen.

Use the menu

Tools > Options > Display

@Carl Love 

Perm1to2_E:= (L1::list, L2::list)-> subs(`=`~(L1,[seq(1..nops(L1))]), L2):

 

n:=100000;
f:='randpoly([x, y])':
L1:= ['f' $ n]:
L2:= combinat:-randperm(L1):

             
                100000

Perm1to2_D:= (L1::list, L2::list)->
     sort(L1, output= permutation)[sort(sort(L2, output= permutation), output= permutation)]:
Perm1to2_E:= (L1::list, L2::list)-> subs(`=`~(L1,[seq(1..nops(L1))]), L2):

PD:= CodeTools:-Usage(Perm1to2_D(L1,L2)):
evalb(L1[PD] = L2);
PE:= CodeTools:-Usage(Perm1to2_E(L1,L2)):
evalb(L1[PE] = L2);

memory used=10.09MiB, alloc change=8.86MiB, cpu time=187.00ms, real time=156.00ms, gc time=0ns
                              true

memory used=14.06MiB, alloc change=8.77MiB, cpu time=124.00ms, real time=125.00ms, gc time=46.80ms
                              true

 

Edit: An even faster one:

Perm1to2_E_bis:= proc(L1::list, L2::list)
local T;
T:=convert(L2,Array);
subs[inplace](`=`~(L1,[seq(1..nops(L1))]), T):
convert(T,list)
end;

 

 

 

@Carl Love 

I was intrigued by your version of cartprod.

Could you please answer the following questions.

1. The order in the resulting list is reversed lexicographic, unlike cartprod where the order is lexicographic.
What changes are needed to have the same order?

2. I have tested the speed of both versions for a list L given by

m:=7;n:=10; # then n=12
L:=[seq( [seq(10*i+j,j=1..n)], i=1..m)];
p:=n^m;

I have used only time[real]():

T:=combinat[cartprod](L);
t:=time[real]():
nops( [ seq(T[nextvalue](),i=1..p) ] );
time[real]()-t;

I was surprised to see that CartProd was only about twice faster than cartprod for such large lists.
How do you explain this?
Have you an ideea about complexity in both cases?

Best regards,
V.

 

 

 

 

@Markiyan Hirnyk 

Just to prevent nonsense inputs:

rad := proc(u::polynom) `*`(op(map( z->op(1,z),factors(u)[2]))) end:

@Markiyan Hirnyk 

The ring of the polynomials, of course, K[x,y,...], K an extension of Q.

@Markiyan Hirnyk 

1. The results are the same, modulo the units of the ring.
One may apply primpart to all the terms, but it is not necessary.

2. You are right. But over the reals, factors works better.
And if we consider e.g. polynomials over a noncommutative field, then both methods fail. :-)

 

@Markiyan Hirnyk 

I lnow that it may fail; actually it could be fixed.

The real point was that factor could work where Radical fails.

@Markiyan Hirnyk 

Radical also fails for such polynomials (with irrational coeffs).

factor may work. E.g.

g:=expand((x*sqrt(2)+y*sqrt(3)+z*sqrt(6)+x*y*sqrt(6)+x)^6):
r:=factor(g):
if op(0,r)=`*` and type(op(1,r),realcons) then r:=op(2,r) fi:
if op(0,r)=`^` then op(1,r) else FAIL fi;

@Carl Love 

As mentioned It works in the more general case when {op(L2)} is a subset of {op(L1)},
so o permutation may not exist, e.g. [1,2,3] --> [1,2,1].

 

@I_Mariusz 

I'm also waiting for a version where

is(Re(RootOf(Zeta(z),z))=1/2) assuming Re(z)>0, Re(z)<1;

will work. Or, even better:

is(Re(RootOf(Zeta(z),z))=1/2, option=proof) assuming Re(z)>0, Re(z)<1;

@Kitonum 

I think that a simple simplify should produce

k1*(.1124471606*n^2*k1^2-.2042283048*k2*n^2*k1-0.1874763818e-1*k2^2*n^2+.2042283048*k2*n*k1
+.1025985806*k1*n^2+0.3749527637e-1*k2^2*n+.1349080187*k2*n^2-0.4685942835e
-1*k1*n-0.1874763818e-1*k2^2-.2698160373*k2*n-.1823825149*n^2-0.5573915226e-1*k1
+.1349080187*k2+.3647650297*n-.1823825149)/(n-1.)

To obtain this it seems that we must enter five commands:

normal(evalf(expand(normal(convert(A,rational)))));

 

@Markiyan Hirnyk 

I also suspect that FindFormula will try to be for functions what Maple's identify is for numbers.
I.e. identify will act as FindFormula applied to a constant input.
I wonder how accurate will/could it be!

 

 

@Preben Alsholm 

A related question about searching the help system

Say we are searching for inert function.
The most relevant entry would be ?value
But in the help system, 'value' appears as the 20th entry.
I also find that the (rather new) organisation of the Table of Contents
in help system is less intuitive.

What keywors should we use instead of inert function
such that "value" appears in the first place?
(except for value, of course).

For now, it seems that a google search is more effective!
For example,

maple inert function

sends us directly to
http://www.maplesoft.com/support/help/Maple/view.aspx?path=value

i.e. the best place!

@EugeneKalentev 

A box is determined by xmin,ymin,zmin,xmax,ymax,zmax.  E.g.

B:=Box(-1..1,-1..1,-1..1, outward);

is the box having the faces tangent to your sphere.

@Carl Love 

The simplest is

int(1/sqrt(x),x=0..1);

After x=t^2 ==> int(2,t=0..1)

 

 

First 170 171 172 173 174 175 176 Page 172 of 176