Adam Ledger

Mr. Adam Ledger

300 Reputation

11 Badges

3 years, 287 days
unemployed
hobo
Perth, Australia

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are questions asked by Adam Ledger

Basically it spits out the subset of values for which a division by zero error will occur for the function you specify on  range you specify for each of it's arguments, but I get an ambigous error when ever exponentiation features in the function I specify, which of course dramatically reduces the application of the calculator. Division,addition,substraction and multiplication are currently the only available arithmetic operators availble for the function window that I know the error will not occur.

If some one can help it is much appriciated

 

DIVISION_BY_ZERO_CALCULATOR.mw

Is there something I should be doing whenever I use simplify to avoid things like this, or should I stop using the "is" function all together?

 

interface(showassumed = 0):

 

sum(binomial(k+j, k), j = 0 .. n-k) = binomial(n+1, k+1)

(n-k+1)*binomial(n+1, k)/(k+1) = binomial(n+1, k+1)

(1)

#And we have:
is(sum(binomial(k+j, k), j = 0 .. n-k) = binomial(n+1, k+1))

FAIL

(2)

#And since:
is(simplify(convert(sum(binomial(k+j, k), j = 0 .. n-k) = binomial(n+1, k+1), 'factorial')))

true

(3)

is(sum(binomial(k+j, k), j = 0 .. n-k) = binomial(n+1, k+1)) = is(simplify(convert(sum(binomial(k+j, k), j = 0 .. n-k) = binomial(n+1, k+1), 'factorial')))


 

Download main.mw

Why is lamba protected as something it traditionally isnt for this package?

 


 

restart

lambda(n) = (-1)^Omega(n)

 

 

with(numtheory)

lambda(n) = (-1)^Omega(n)

 

[GIgcd, bigomega, cfrac, cfracpol, cyclotomic, divisors, factorEQ, factorset, fermat, imagunit, index, integral_basis, invcfrac, invphi, iscyclotomic, issqrfree, ithrational, jacobi, kronecker, lambda, legendre, mcombine, mersenne, migcdex, minkowski, mipolys, mlog, mobius, mroot, msqrt, nearestp, nthconver, nthdenom, nthnumer, nthpow, order, pdexpand, phi, pi, pprimroot, primroot, quadres, rootsunity, safeprime, sigma, sq2factor, sum2sqr, tau, thue, varphi]

(1)

Omega := proc (n) options operator, arrow; bigomega(n) end proc:

numtheory:-lambda(667)

308

(2)

``


 

Download main.mw

My learning exercise today is the Calkin-Wilf Tree, and the first worksheet I have the issue, due to needing to use a set operator and at that point of computation losing the ordering if it were to be a list (I have tried with a list, and was unsuccessful) none the less my question is, can I alter the ordering condition for Sets in a worksheet produced therein? 

I also encountered a strange result that I would appreciate an explaination for as seen below in the uploaded worksheet

 


 

restart

``

https://en.wikipedia.org/wiki/Calkin–Wilf_tree

 

 

Q := proc (n) options operator, arrow; (`minus`(map(rhs, solve(`union`(seq({q[0] = 1/2, q[1] = 1, q[i+1] = 1/(2*floor(q[i])-q[i]+1)}, i = 1 .. n)))), map(rhs, solve(`union`(seq({q[0] = 1/2, q[1] = 1, q[i+1] = 1/(2*floor(q[i])-q[i]+1)}, i = 1 .. n-1))))))[] end proc

proc (n) options operator, arrow; (`minus`(map(rhs, solve(`union`(seq({q[0] = 1/2, q[1] = 1, q[i+1] = 1/(2*floor(q[i])-q[i]+1)}, i = 1 .. n)))), map(rhs, solve(`union`(seq({q[0] = 1/2, q[1] = 1, q[i+1] = 1/(2*floor(q[i])-q[i]+1)}, i = 1 .. n-1))))))[] end proc

(1)

NULL

delta := proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc

proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc

(2)

 

 

q[1] := 1

1

(3)

q[2] := 1/2

1/2

(4)

q0 := proc (n) options operator, arrow; 1/(2*floor(Q(n)*(1-delta(n, 2))+delta(n, 2)*q[2]+delta(n, 1)*q[1])-Q(n)*(1-delta(n, 2))-delta(n, 2)*q[2]-delta(n, 1)*q[1]+1) end proc

proc (n) options operator, arrow; 1/(2*floor(Q(n)*(1-delta(n, 2))+delta(n, 2)*q[2]+delta(n, 1)*q[1])-Q(n)*(1-delta(n, 2))-delta(n, 2)*q[2]-delta(n, 1)*q[1]+1) end proc

(5)

[seq(q0(k), k = 1 .. 20)][1]

1/(2*floor(()+1)+())

(6)

NULL


 

Download Q1_MP_08112019.mw

My problem is explained with sufficient detail in the below worksheet:

 

restart

Digits := 100:

with(StringTools); with(FileTools); with(ListTools)

``

currentdir("H:\\MAIN DIRECTORY\\ESD-USB\\my_maple_library")

L[1] := ListDirectory(currentdir()):

L[2] := [seq([k, L[1][k]], k = 1 .. nops(L[1]))]:

read L[1][15]:

currentdir("H:\\MAIN DIRECTORY\\ESD-USB\\Computer Science\\MAPLE\\Exponentiation by Squaring"):

 

B := proc (n) options operator, arrow; [seq(d(n, 2, j), j = 0 .. floor(ln(n)/ln(2)))] end proc:

 

 

Identity0 := proc (x, n) options operator, arrow; x^n = piecewise(`mod`(x, 2) = 1, x*(x^2)^((1/2)*n-1/2), `mod`(x, 2) = 0, (x^2)^((1/2)*n)) end proc

NULL

Generate_Equations_List := proc (n) global EquationsList, r, B_n, T; B_n := B(n); T := nops(B_n); r[T] := 1; return [seq(r[u-1] = r[u]^2*x^B_n[u], u = 1 .. T)] end proc:

Exp_by_squares := proc (M, Y) global R; Generate_Equations_List(M); R[1] := max([allvalues(rhs(isolate(F[0](Y, M)[1], r[1])))]); return 'x^n' = R[1]^2*X^B_n[1] end proc:

 

N := (rand(25 .. 33))():

n = 31

 

x = 34

 

x^n = 299120672332806228664106719451209941853702979584

 

x^n = 299120672332806228664106719451209941853702979584

(1)

NULL

st := time[real]():

x^n = 299120672332806228664106719451209941853702979584

 

0.40e-1

(2)

st := time[real]():

x^n = 299120672332806228664106719451209941853702979584

 

0.74e-1

(3)

is(t2 < t1)

false

(4)

``


 

Download slow.mw

 

 

So I know I have obviously done something wrong, but it has proven very difficult to establish where given how little i know about the solve function

 

1 2 3 4 5 6 7 Last Page 1 of 30