mmcdara

812 Reputation

12 Badges

3 years, 164 days

MaplePrimes Activity


These are answers submitted by mmcdara

Question 1:Are you looking for a solution for this specific polynomial or for a solution metho for more general polynomials ?
Question 2: Whjat is for you the shortest monomial coefficient among these two: p+q+r and p*q*r ?
Question 3: what about if two monomoal coefficients have the same "length" according to your definition ?

 

For your specific case tou will find an answer in the attached file

ShortestMonomialCoefficient.mw

Just replace 
( Vector[row]
([seq

by
(Matrix(
(3, 2, [seq

I have no solution to propose, only an experience to share.

From my experience cmaple (Windows) and maple (unix/mac OS) have some limitations.
The use of ExcelTools seems effectively to be one of them. 

Some features contained in "recent" packages are not handled too :

  • Using functions from Grid package generate errors (Maple 2015, Maple 2016 with Windows)
  • Some functions from DocumentTools are not supported: this is rather normal when they refer to displays and plots, but RunWorksheet doesn't work.
  • If I'm not mistaken plotdevice  doesn't work too (at least in the situations I used it).


It's rather difficult to find a list of functions (if it even exists) that do not give the expected result when used with cmaple/maple, so, unfortunately, you eventually discover that by yourself when cmaple fails.

I did my grieving of all this: my opinion is that cmaple/maple are historical commands the evolution of which doesn't follow the evolution of xmaple. So I have adopted this pragmatic strategy: replace all the functions that are "not supported" by others which are.

For instance, when I faced a problem with ExcelTools:-Export, I replaced this command by a writedata/write.ImporttMatrix one (depending on the data to export).
Maybe you can do the same for ExcelTools:-Import: open you file with Excel, save it as a text file, and read it with a read/readdata ... command.

I hope someone here will give you better advices than I did
 

You will find in the attached file something that might help you or give you hints to go further.
I do not pretend it's the most elegant way to proceed.
I did not use your worksheet but a notional example gifen in the CodeTools:-Usage help page

CodeToolsUsage.mw

dsolve returns the exact solution but it appears to be definitively untractable.

I propose you the solution obtained after replacing the integer coefficients by floats


MaybeThis.mw

restart:
sqrt(sqrt(p^2+1)-1)*sqrt(sqrt(p^2+1)+1):
combine(%, radical)  assuming p > 0:
simplify(%)   assuming p > 0

restart:
sqrt(sqrt(p^2+1)-1)*sqrt(sqrt(p^2+1)+1):
combine(%, radical)  assuming p < 0:
simplify(%)   assuming p < 0

 

 

Maybe this will suit you if the term "tensor" stands for "a 4 dimensional table"

H := Array(seq(1..3, k=1..4)):
H[1, 1, 1, 1] := 10:
H[1, 2, 2, 1] := 20:

But if you want to use "true" tensors you can have a look to the Physics or DifferentialGeometry packages

 

Please see my other replies.
I've posted 
dsolve({ic, odes, odex}, type = numeric, range = 0 .. 1, events = [[s(tau)-1, halt]])

instead of 
dsolve({ic, odes, odex}, type = numeric, range = 0 .. 1, events = [[s(tau)-const, halt]])

APOLOGIES



About your original question
 [ [ [s(t), a*arcsinh(2/a) < s(t)], halt] ] means : halt dsolve when s(t) = 0 AND a*arcsinh(2/a) < s(t)]

I don't know what is the error Maple returned, but there could be potential conflict between these two conditions.

Is "a" a numerical value ?
If not it can't work until you have used the option parameters (see my first reply)
... or given "a" some value...
Look to attached file after thet "EXTRA MATERIAL" title

a := 3.0:
dsolve({ic, odes, odex}, type = numeric, range = 0 .. 1, events = [ [ [s(tau), s(tau) > a*arcsinh(2/a)] , halt]] )

dsolve.mw

 

Where does this problem come from ?

I suppose u is a function of r and z ?
Is P a constant or not ?
Why do you write r=h(z) and not r=H (H being constant) ? Is the radius r a function of z ? If so some terms seem to be missing in the equations (1) 

Even in the simlest case P is a constant, u a function of r alone and h(z) is a constant H, and provided I did no mistakes in my worksheet, there is no solution to this problem unless P or H = 0 ... 

NS.mw

 

1/ Isaac Newton (1687)

Philosophiae naturalis principia mathematica, Sir Isaac Newton, Londres 1687.

 

French version
Livre Troisième (=Third Book)
http://gallica.bnf.fr/ark:/12148/bpt6k1040150h/f7.image.r=newton%20isaac

pp 120-122


 

2/ Joseph Louis de Lagrancge (1795)

"Leçons élémentaires sur les mathématiques données à l'École Normale en 1795" p.183-288

http://sites.mathdoc.fr/cgi-bin/oetoc?id=OE_LAGRANGE__7

http://gallica.bnf.fr/ark:/12148/bpt6k2299428/f185

Leçon cinquième pp 284-286
 


For a more detailed historical approach of interpolation I recommend you to read the book (in french)
Histoire d'algorithmes, du caillou à la puce
Jean-Luc Chabert et al.
Belin ed. 1994
chapter 10

It seems it has been translated in english under the title
Chabert, A History of Algorithms. From the Pebble to the Microchip, 1999.



Enjoy

First solution : click on the hand right to the exclamation point (it should be red)

Sometimes this doesn't work if the build in function (here fsolve) has run some child process.
In this case the only thing to do is wait, hopping the command will stop correctly ... or to kill the process itself.

Second solution: use kernelopts(cputime=.....).
For instance kernelopts(cputime=15) will stop your active worksheet as soon as the cpu time reaches 15s.
Watch out: kernelopts(cputime=15) is global to the worksheet: if 10 s has already been used for some computations, the remaining ones have to be executed in less than 5 s  to complete entirely.
When cpulimit is reached (I cannot guarantee it'd the same thing on all platforms or systems), you may receive a "kernel connection lost" message. If it so, you will not be able to do any other thing within your worksheet (other worksheets are still operational) and the only thing tou will be able to do is to save the active worksheet, to close it and to open it again.

cpulimit.mw

 

I don't know if Maple offers a softer mechanism to kill a command programatically. 
 

The first part of the attached file is essentially a corrected version of yours
In the second part you will find some improvements that could help you to do the same things in a simpler way

Could_help.mw


 

restart:
with(RealDomain):

solve(1/GAMMA(m)=0.00001):
x := max(%) - 1:
`if`(convert(x, fraction)::integer, n>=round(x), n>floor(x))

8 < n

(1)

solve(1/GAMMA(m)=1/evalf(4!)):
x := max(%) - 1:
`if`(convert(x, fraction)::integer, n>=round(x), n>floor(x))

4 <= n

(2)

 


 

Download YetAnotherAlternative.mw

If I concentrate on your sentence "I am trying to generate a binomial sample", and if you want to use the student package, then the solution is obvious:


with(Student[Statistics]):
N := 50:
P := 0.1:
X := BinomialRandomVariable(N,P):

# S is a sample of size M 
M := 10:
S := Sample(X, M);

But maybe, as Carl Love sugegsted, you want to do something different ?


PS : for my own I prefer to use the Statistics package.
In this case :

restart:
with(Statistics):
N := 50:
P := 0.1:
X := RandomVariable(Binomial(N, P)):
M := 10:
S := Sample(X, M);


WATCH OUT: here S is a vector of floats (not integers as with Student[Statistics]): be aware of this when you use S! 
 

 

restart:
M := 5;
A := Matrix(M+1, M+1, (r,s) -> `if`(type(r+s, odd), 2^(k+1)*sqrt((2*r-1)*(2*s-1)), 0))

 

 

First 6 7 8 9 10 Page 8 of 10