Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

How to find all occurrences with Fibonacchi numbers?
100=89+8+2+1=89+5+3+1=55+34+8+2+1 etc...

fib := proc(n::nonnegint) option remember; if n <= 1 then n; else fib(n - 1) + fib(n - 2); end if; end proc;
zeck := proc(n::posint) local k, d; k := 2; while fib(k) <= n do k := k + 1; end do; d := n - fib(k - 1); if d = 0 then k - 1; else k - 1, zeck(d); end if; end proc;
zeck(100);
E := [fib(11), fib(6), fib(4)]; add(E[i], i = 1 .. nops(E));

Hi,

For optimal display, I would like to enlarge the size of numbers in the TextArea. Any ideas? Thank you.

S4ThalèsAnimation.mw

Hello

I have a list N with i elements, for example N:=[7,2,4] with i = 3. From another list L I know, that all the elements of N are also elements of L, but I don't know if they are in the same order. For example:

In L1=[2,6,5,7,3,2,9,4] the elements are in the same order, but they are not in L1=[2,1,4,2,6,7,3,9]. 

How to write a program that can say wether the elements are in the correct order or not?

Thanks for your help!

restart

with(VectorCalculus); SetCoordinates('cartesian[x, y, z]')

with(ScientificConstants)

"with(Units[Simple]):"

``

g := evalf(Constant(g, units))

9.80665*Units:-Unit(m/s^2)

(1)

`#mover(mi("\`v__0\`"),mo("&rarr;"))` := `<,>`(v[0]*Unit('m'/'s'), 0*Unit('m'/'s'), 0*Unit('m'/'s'))

Vector(3, {(1) = v[0]*Units:-Unit(m/s), (2) = 0, (3) = 0})

(2)

`#mover(mi("a"),mo("&rarr;"))` := `<,>`(0*Unit('m'/'s'^2), g, 0*Unit('m'/'s'^2))

Vector(3, {(1) = 0, (2) = 9.80665*Units:-Unit(m/s^2), (3) = 0})

(3)

int(`#mover(mi("a"),mo("&rarr;"))`, t)

Vector(3, {(1) = 0, (2) = 9.80665*t*Units:-Unit(m/s^2), (3) = 0})

(4)

As you can see in (4) units are wrong. I have tried to insert them in int expression but nothing has work. Moreover using Units[Standard] packecge i get

Error, (in int) wrong number (or type) of arguments: wrong type of integrand passed to indefinite integration.

Thanks

Download Units_and_Integrals.mw

Hi,

I can't understand the error message generated during this animation. Any ideas? Thanks

TriagleSemblablesTest.mw

I want to have a 14 larger font instead of Times New Roman 12 for the whole worksheet or else a different font later. 
Can't make sense of how this is all organized in Maple 
You would say set a template , but ?

Hello. Can anybody point out to me what I am doing wrong below? I'm trying to solve the online model 4.1 of the book "An introduction to infectious disease modelling" by E. Vynnycky & R.G. White (2010). But all the information is below. 

Where I get errors from the code below is right at the bottom, in dsolve:

# My Maple 2023 code:

restart;

# Initial values:

Sus_0 := total_popn - Infectious_0 - Immune_0:
Preinfectious_0 := 0:
Infectious_0 := 1:
Immune_0 := total_popn*prop_immune_0:

# Transmission- and infection-related parameters:

preinfectious_period := 8:
infectious_period := 7:
R_zero := 13:
f := 1/preinfectious_period:
r := 1/infectious_period:
beta := R_zero/(total_popn*infectious_period):
prop_immune_0 := 0:

# Demography-related parameters:

total_popn := 100000:

# Useful statistics:

new_infns := beta*Susc*Infe:
new_infectious := Prei*f:
prop_sus = Susc/total_popn:
R_n := R_zero*prop_sus:
propn_imm := 1 - prop_sus:
sum_pop := Susc + Prei + Infe + Immu:
ln_infectious := ln(Infe):
ln_cum_infe := ln(Cum_Infe):
ln_new_infectious := ifelse(0 < t, ln(new_infectious), 0):

# Defining the system of ODEs:

sys_ode:={
diff(Susc(t),t)=-beta*Susc(t)*Infe(t), 
diff(Prei(t),t)=beta*Susc(t)*Infe(t)- Prei(t)*f, 
diff(Immu(t),t)=Infe(t)*r, 
diff(Cum_Infe(t),t)= Prei(t)*f, 
diff(Infe(t),t)=Prei(t)*f-Infe(t)*r,
}:

ics:={
Susc(0)=Sus_0,
Infe(0)=Infectious_0,
Immu(0)=Immune_0,
Prei(0)=Preinfectious_0,
Cum_Infe(0)=Infectious_0
}:

Solution1:=dsolve({sys_ode,ics},type=numeric);
# HERE I GET THIS ERROR MESSAGE: "Error, (in dsolve/numeric/process_input) system must be entered as a set/list of

# expressions/equations"

 

Solution2:=dsolve({sys_ode,ics});
# HERE I GET THIS ERROR MESSAGE: "Error, (in dsolve) invalid arguments; expected an equation, or a set or list of them,

# received: {{diff(Immu(t),t) = 1/7*Infe(t), diff(Infe(t),t) = # 1/8*Prei(t)-1/7*Infe(t), diff(Prei(t),t) =

# 13/700000*Susc(t)*Infe(t)-1/8*Prei(t), diff(Susc(t),t) = -13/700000*Susc(t)*Infe(t), diff(Cum_Infe(t),t) = # 1/8*Prei(t)}}"

 

MY QUESTION: Can anybody tell me what I'm doing wrong in Solution1 and Solution2?

Best wishes and many thanks!

 

 

Ubuntu 22.04.

I have Maple-202[1-3] and an old installation of maplev-mode. maplev-mode fails to work.

In the emacs messages buffer, I see (typed from memory):

loading maple
maple loaded
maple not running

I removed all of maplev from my system.
I tried installing from the downloaded master.zip (RELEASE-=NOTES says 3.0.5).
make install fails:

> pwd
/tmp/maplev-master
> make install
Makefile:27: MapleLisp.mk: No such file or directory
make: *** No rule to make target 'MapleLisp.mk'.  Stop.

I tried installing from the cloud, but, failed. The error message (even run as root)

Error, (in PackageTools:-Install) permission denied

Will maplev-mode work?

Tom Dean

Hi, 

I am exploring the construction of the recorded table ( Frequency Table) of a statistical series. How can I display only the discrete values, without showing the interval form in the first column 'Range'?  Thank you

TableauRecenséQ.mw

While answering a question on this site I accidentally met expressions of the form binomial(n, min(n, r)+1) where both n and r are positive integers and n is strictly lower than r.

For the record the common definition of the binomial coefficient binomial(n, k) is based on the double inequality 0 <= k <= n  and the only generalized definition where k could be larger than n I know of is the NegativeBinomial distribution where we use
binomial(-n, k) which, with 0 <= k <= n  again makes the first operator lower than the second.

I tried to understand how Maple does this

binomial(n, min(n, r)+1) assuming n < r,  n::posint
                               0

(more generallyn, for any strictly positive integer p, binomial(n, min(n, r)+p) = 0 under the assumptions above)

I guess that the explanationrelies upon what I did to get the output (2) in the attached file.
Can you confirm/infirm this and, as I wasn't capable to find any clue in help(binomial), [Maple 2015], if the way maple computes
these results is documented elsewhere.

Thanks in advence.

restart:

 

Let us start with this result

 

t0 := binomial(n, min(n, r)+1);
eval(t0) assuming n < r;
eval(%) assuming n::posint;

# I didn't find in help(binomial) the argument used to get this last result.

binomial(n, min(n, r)+1)

 

binomial(n, n+1)

 

0

(1)

# What happens if binomial is converted into factorials

t1 := convert(t0, factorial);
eval(t1) assuming n < r;

factorial(n)/(factorial(min(n, r)+1)*factorial(n-min(n, r)-1))

 

Error, (in assuming) when calling '`one of {eval, min, factorial}`'. Received: 'numeric exception: division by zero'

 

# Or into GAMMA function?

t2 := convert(t1, GAMMA);
eval(t2) assuming n < r;

GAMMA(n+1)/(GAMMA(min(n, r)+2)*GAMMA(n-min(n, r)))

 

Error, (in assuming) when calling 'GAMMA'. Received: 'numeric exception: division by zero'

 

# Try to replace min(n, r) = n by n-epsilon and take the limit as epsilon goes to 0
# from the right.

t3 := algsubs(min(n, r) = n-epsilon, t2);
limit(t3, epsilon=0, right)

GAMMA(n+1)/(GAMMA(n-epsilon+2)*GAMMA(epsilon))

 

0

(2)

 

We recover here the result (1), but does Maple really proceed this way?

Download binomial.mw

Maple Transactions frequently gets submissions that contain Maple code.  The papers (or videos, or Maple documents, or Jupyter notebooks) that we get are, if the author wants a refereed submission, sent to referees by a fairly usual academic process.  We look for well-written papers on topics of interest to the Maple community.

But we could use some help in reviewing code, for some of the submissions.  Usually the snippets are short, but sometimes the packages involved are more substantial.

If you would be interested in having your name on the list of potential code reviewers, please email me (or Paulina Chin, or Jürgen Gerhard) and we will gratefully add you.  You might not get called on immediately---it depends on what we have in the queue.

Thank you very much, in advance, for sharing your expertise.

Rob

the maple document is  p151.mw

Hi everyone, I'm trying to do some simple algebraic simplification operations and run into algsubs replacement failures,

 the symbol σ' is typed in this way:  σ +  prime (left Palettes -> Common Symbols -> prime) + (selecting σ'  and  press  Ctrl+Shift+A  make it  a  atomic variable) 

I'm new to this, any help or suggestion is welcome, thanks! 

Good day to all of you friends, just asking for your kind help.

I have been trying to get solution of the next integral but didn't have succes. The goal of the code is to perfom a variable change.

Best regards

restart

r := simplify(rhs(isolate(r+(2*M*`r__\`+\``+a*m/sigma)*log[10](r/`r__\`+\``-1)/(`r__\`+\``-`r__-`)-(2*M*`r__-`+a*m/sigma)*log[10](r/`r__-`-1)/(`r__\`+\``-`r__-`) = `r__&lowast;`, r)))

Delta := -2*M*r+a^2+r^2

omega := sqrt(r^2+a^2+a*m/sigma)NULL

F := simplify(Delta*lambda*m__p/(2*m__p^2*omega^2*r^2*sigma+2*lambda^2*omega^2*sigma))

`r__&prop;` := int(F, `r__&lowast;`)

NULL

Download maple_primes_question.mw

We can see a list of functions for a package in the documentation, for example the package GroupTheory:

Is there a code based way to see all the functions in this package?

How  to make the integration 

 

into the following form:



Thanks in advance,Q1.mw

First 7 8 9 10 11 12 13 Last Page 9 of 2097