## 3713 Reputation

5 years, 347 days

## Is this what you want?commut := proc(Phi...

I used your worksheet and just add this at the end of it:

```# you wrote "I can always define a function that computes the commutator"
# Yes, here is a naive example where neither the type of Phi nor e is checked

commut := proc(Phi, e)
collect(simplify(mult(Phi, e)-mult(e, Phi)), [Dx])
end proc:

f := x -> sin(x)*cos(x)^8:
commut(A(s), f(x))

/        2   \       7
\9 cos(x) - 8/ cos(x)

# "What command allows me to act with 'A(s)' on 'f' and get the resulting function?"
#
# I suggest you doing this

eval(diffop2de(A(s),u(x)), u(x)=f(x));
8         9           2       7
s cot(x) sin(x) cos(x)  + cos(x)  - 8 sin(x)  cos(x)
```

Example_mmdara.mw

## @jennierubyjane  Here is the a...

Here is the answer to your removed question  (see @Preben Alsholm above)

 > > > >  (1)
 >  (2)
 > >  (3)
 >  (4)
 > # check the number of boundary conditions we need select(has, indets({DE1, DE2, DE3}, function), diff); nb_of_bcs_needed := add(map(u -> numelems(select(has, %, u)), [f, phi, theta]))  (5)
 >  (6)
 >  (7)
 >  (8)
 > # Check the whole number of unknowns indets({BC1, BC2, BC3, DE1, DE2, DE3}) minus {eta} minus {f, phi, theta}(eta); Whole_nb_of_unknowns := numelems(%);  (9)
 > Number_of_parameters := Whole_nb_of_unknowns - nb_of_bcs_needed; parameters := indets({BC1, BC2, BC3, DE1, DE2, DE3}, name) minus {eta}  (10)
 > > # Below you fix one parameter (Pr) to numerical values. # Thus it remains to you to fix also parameters minus{Pr}; # If not MAPLE will consider you have 7+4=11 quantities and will wait for 11 bcs (11)
 > # As I told you in a previous answer, the 'parameter' options is not supported by bc solvers. # Thus you have to fix {Bi, Le, Nb, Nt} by using, for instance, the way you use to fix Pr. # # But it's probably better to define something like this solver := proc(Bi, Le, Nb, Nt)   # place her the code you have written   # add   return R end proc: # do this # solver(1, 2, 3, 2, 1)
 > > > ## Using de Cayley-Menger determinant,it se...

Using de Cayley-Menger determinant,
it seems there is no other solution:

 > restart:
 > Vol := proc(L::table)   local M := Matrix(5\$2, (i,j) -> `if`(i=j, 0, `if`(i=1 or j=1, 1, L[[op(sort([i-1,j-1]))]]^2))):   sqrt( LinearAlgebra:-Determinant(M)/288 ): end proc (1)
 > P := table([ [1, 2]=6, [2, 3]=8, [1, 3]=10, [1, 4]=11, [2, 4]=7, [3, 4]=9 ]); Vol(P) (2)
 > # search for polyhedra whose sides are in arithmetic progression with common difference n Q := table([ [1, 2]=6+n, [2, 3]=8+n, [1, 3]=10+n, [1, 4]=11+n, [2, 4]=7+n, [3, 4]=9+n ]); Vol(Q);  (3)
 > # the term under the square root mus be a multiple of 144 sol := msolve(2*n^6+102*n^5+2099*n^4+22128*n^3+124160*n^2+340992*n+331776=0, 144) (4)
 > # plug these potential solution within Q and compute the volumes of the tetrahedra map(s -> Vol(eval(Q, s)), [sol]): select(is, %, integer) (5)
 > factor(2*n^6+102*n^5+2099*n^4+22128*n^3+124160*n^2+340992*n+331776); b := op(1, %); # the equation b=Z^2 doesn't seem to have any integer solution [seq(sqrt(eval(b, n=m)), m in [seq(2...10^5, 2)])]: select(is, %, integer)   (6)
 >

Other_Polyhedra.mw

## By hand.From elementary calculus (probab...

By hand.
From elementary calculus (probably in your Dutch Book?):

1. sqrt(1+eta) is equivalent to 1+eta/2 as eta tends to 0
2. 1/(1-mu) is equivalent to 1+mu as mu tends to 0

Assume abs(v) << c, set v^2 / c^2 = eta and apply rule 1 above.

Then apply rule 2

You'll get the desired result

## Not completely clear: "maximum of p...

Not completely clear:

• "maximum of p" : what is p? is it power?
• Are  [Rth, Rload, S, X, Y] the unknowns of the maximization  problem?
• In such a case why does the expression of power not contain Rth but R? A typo?
• Are the remaining variables a kind of  "parameters" you would like to express the maximiser in terms of?

## First error :The term [diff(f(eta),...

First error :

The term

`[diff(f(eta), eta)]^2`

should be written

`diff(f(eta), eta)^2`

(no square brackets).

Second error:

Bi, Le, Nb and Nt are not set to numerical values before calling dsolve.
Fotr BCs problems it's not possible to use the option 'parameters', meaning you must fix these 4 parameters.

Third error:

What does this boundary contitions mean?

`f(eta) = 1-exp(-eta)`

Either you fix f(eta) this way and you must discard DE1 or you remove this condition (which is not a BC).

Once corrected this will work.
Here is an example

 > restart
 > with(plots):
 > fixedparameter := [Nb = 0, Nt = 0, Bi = 1000, Le = 10] (1)
 > DE1 := diff(f(eta), eta\$3)+f(eta)*(diff(f(eta), eta\$2))-(diff(f(eta), eta))^2 = 0; (2)
 > DE2 := diff(theta(eta), eta\$2)+Pr*f(eta)*(diff(theta(eta), eta))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*diff(theta(eta), eta)^2 = 0 (3)
 > DE3 := diff(phi(eta), eta\$2)+Le*(diff(phi(eta), eta))+Nt*(diff(theta(eta), eta\$2))/Nb (4)
 > BC1 := f(0) = 0, (D(f))(0) = 1, (D(f))(10) = 0 (5)
 > BC2 := theta(10) = 0, (D(theta))(0) = -Bi*(1-theta(0)) (6)
 > BC3 := phi(0) = 1, phi(10) = 0 (7)
 > L := [0.7e-1, .2, .7, 2, 7, 20, 70]; (8)
 > dsolve(eval({BC1, BC2, BC3, DE1, DE2, DE3}, [Pr = L, Nb=1, Nt=1, Le=1, Bi=1]), numeric) (9)
 >

I guess that :

1. You want to built a linear model which relates the "Thoracic IDEM" to "First" and "Min"?
2. Plot this model and the experimental points on the same plot?

Please let me know if I'm mistaken and still want to draw a curve and not a plane.

```# Step 1: extract the coordinates of the pointt and arrange them as a matrix

pts := `<,>`(op~(1, [L])[]);

# Step 2: Build a linear model in the least square sense.
# Notations: x=First, y=Min, and dependent variable=Predicted

fit := LinearFit([1, x, y], pts, [x, y]);

#  Step 3: plotting

display(
L,
plot3d(fit, x=(min..max)(pts[..,1]), y=(min..max)(pts[..,2]), style=wireframe, color="Gray"),
axes = boxed,
view = [-800 .. 800, -800 .. 800, -800 .. 800],
orientation = [125, 65],
title = `Thoracic IDEM`,
labels = [First, Min, Predicted],
labelfont = ["HELVETICA", 20],
titlefont = ["ROMAN", 30]
)
```

## A way......

... burt not the only one

```restart:
expr := f(2)+f(3)+f(4);
nrew_expr := eval(expr, f=h)
h(2) + h(3) + h(4)

expr := F(f(2))+F(f(3))+F(f(4));
nrew_expr := eval(expr, [F=H, f=h])
F(f(2)) + F(f(3)) + F(f(4))
H(h(2)) + H(h(3)) + H(h(4))
```

BTW, what do you mean by "where f(x) is really 'anything'? "

## @tomleslie @lczUnless the graphs ar...

Unless the graphs are ordered in some way the proportion of graphs whose vertex connectivity equals 6 is about 1/3 :

```r := rand(1..numelems(L)):
s := map(n -> VertexConnectivity(L[r()]), [\$1..100]):
Statistics:-Tally(s)
[4 = 67, 6 = 33]
```

I do believe you're right @lcz saying that Maple is (EXTREMELY) slow in computing the vertex connectivity.

PS :
I use to use R and it looks like a white elephant to read graph6 format graphs ; so I exported the graphs from Maple into (only) 3 formats that are easily readable from R : edge and pajek.
It takes about 104s to comute the vertex connectivity of the graphs in pajek format,
but only 3s if they are in edge format.
As you see the computation time strongly depends on the format of the graph.

This suggest that a significant part of the time Maple takes to compute the vertex connectivities could come from the conversion from graph6 format into a mor suitable one for this computation.

But more probably, as @vv wrote, this is a compilation issue. In R the inner procedure which does the computation is a compiled C procedure whereas MaxFlow (Maple) is not.

## Try surd instead:   is(surd(257, ...

```is(surd(257, 2) < -79999999/10000000)
false
is(-surd(257, 2) < -79999999/10000000)
true
```

## An alternative...

```restart:
expr := convert(-24.*y^6*(y-1.)^7*(y+1.)^7*(4.+6.*y^8-22.*y^6+30.*y^4-18.*y^2)/(4.*y^18-28.*y^16+84.*y^14+4.-136.*y^12+116.*y^10-24.*y^8-52.*y^6+56.*y^4-24.*y^2)^2, fraction);

simplify(expr);
eval(%, y=1.00001);
9
-7.500675015 10
```

## The method is described in the help page...

The method is described in the help pages, please look to the attached file (the green texts are clickable) for an exampleDownload hyperlink.mw

## Even if I'm not familiar with this p...

Even if I'm not familiar with this package, the Physics[Setup] help page says that vectordisplay should do the job:

vectordisplay   none, arrow, bold, or halfarrow.
When mathematicalnotation is set to true, the vectordisplay setting causes the Maple Standard GUI to display non-projected vectors with an arrow or halfarrow on top, or in bold, as specified.

## An examplerestart:CountPrimes := proc(p:...

An example (Maple 2015)

```restart:
CountPrimes := proc(p::integer, q::integer)
local k := 0:
local i := nextprime(p):
while i < q do
k := k+1:
i := nextprime(i):
end do:
return k
end proc:

start := 1:
for p in [seq(1+1000*k, k=0..9)] do
printf("range %4d..%5d : nb of primes = %d\n", p, p+999, CountPrimes(p, p+999))
end do:

range    1.. 1000 : nb of primes = 168
range 1001.. 2000 : nb of primes = 135
range 2001.. 3000 : nb of primes = 127
range 3001.. 4000 : nb of primes = 119
range 4001.. 5000 : nb of primes = 118
range 5001.. 6000 : nb of primes = 114
range 6001.. 7000 : nb of primes = 117
range 7001.. 8000 : nb of primes = 106
range 8001.. 9000 : nb of primes = 110
range 9001..10000 : nb of primes = 111
```

Concerning the plot, here is a suggestion

```res := NULL:
start := 1:
for p in [seq(1+1000*k, k=0..9)] do
res := res, plottools:-rectangle([p, 0], [p+999, CountPrimes(p, p+999)], transparency=0.7)
end do:
plots:-display(res)
```

To conclude:
"Can i make a procedure what calculates the latest mersenne prime number ?"  what does "latest" mean?

## I believe you misinterpreted the phrase ...

I believe you misinterpreted the phrase "This routine returns the "normalized" form of a linear differential equation, a differential operator list,...".

As written below it a differential operator list is not a list of odes but the list of the coefficients of the successive derivatives of the dependent variable of an ode.

As written in the DEnormal help page this list can be provided directly from the user, or derived from the ode by using convertAlg.
See the code bellow which is just a a commented version of the one given in this help page

```restart:
with(DEtools):

# case of an ode
DE := 21*(-2*x^3)/(3*x^2-5*x+2)*y(x) + 42*(x^2)/(x+1)*x*(x-1)*D(y)(x) +
50*x^3/(x-1)^3*(D@@2)(y)(x) = x*sin(x);
DEnormal(DE,x,y(x));

# case of an operator list (here the operator list which corresponds to DE)
DE2 := convertAlg(DE,y(x));
DEnormal(DE2,x);
```

In the  convertAlg help page it's said that it "returns the coefficient list form for a linear ODE" (not of system of linear odes).
You can apply convertAlg and DEnormal for each ode in L this way

```L := [diff(z(t), t, t)*m = 0, diff(x(t), t, t)*m - B*diff(y(t), t)*q = 0, diff(y(t), t, t)*m + B*diff(x(t), t)*q = 0] ;
V := [z(t), x(t), y(t)];
A := [seq(convertAlg(L[i], V[i]), i=1..3)];
N := DEnormal~(A, t);
```

and finally obtain the normal form of each ode this way

```map(i -> add(N[i][j]*~(D@@(j-1))(op(0, V[i]))(t), j=1..nops(N[i])) = N[i], [\$1..3]):
convert~(%, diff)
[                                       / d      \
[                                     B |--- y(t)| q
[ d  / d      \       d  / d      \     \ dt     /
[--- |--- z(t)| = 0, --- |--- x(t)| = --------------,
[ dt \ dt     /       dt \ dt     /         m

/ d      \  ]
B |--- x(t)| q]
d  / d      \       \ dt     /  ]
--- |--- y(t)| = - --------------]
dt \ dt     /           m       ]
```

But it's much simpler to do this

````Normal form of L`:= DEnormal~(L, t, V);
```

DEnormal.mw

﻿