6274 Reputation

17 Badges

7 years, 324 days

MaplePrimes Activity

These are answers submitted by mmcdara

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

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

combine(%, radical)  assuming p > 0:
simplify(%)   assuming p > 0

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]])


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]] )


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 ...


1/ Isaac Newton (1687)

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


French version
Livre Troisième (=Third Book)

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

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.


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.


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



x := max(%) - 1:
`if`(convert(x, fraction)::integer, n>=round(x), n>floor(x))

8 < n


x := max(%) - 1:
`if`(convert(x, fraction)::integer, n>=round(x), n>floor(x))

4 <= n





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:

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 :

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! 


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))



R := ((n1-n2)/(n1+n2))^2:
simplify(subs(n1=xi*n2, R));
plot(%, xi=-1..2, labels=[n1/n2, 'R']);


If you want a symbolic solution just use
dsolve({ode, bcs}, f(x))

But your second bc is not correctly stated : you should write f((4*10^(-8)-rho)^.5)= "some value"

Unfortunately, dsolve will return no result because the ode is not tractable symbolically.

Then you can try dsolve({ode, bcs}, numeric).
In which case you need to fix initial conditions, not "noundary" ones.
More of this, you need to fix the value of rho (unless you use paramerized dsolve : dsolve({ode, bcs}, numeric, parameters=[rho]) )

the correct syntax is a:=a+1  not (a=a+1) (idem for b, c, d)

First 49 50 51 52 53 Page 51 of 53