MaplePrimes Questions

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

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


Hello. Here is my question.

 

#GIVEN:

ST := [`162` = Record(mu = 475, sigma = 41), `70` = Record(mu = 480, sigma = 42),
       `168` = Record(mu = 448, sigma = 103)]

[`162` = Record(mu = 475, sigma = 41), `70` = Record(mu = 480, sigma = 42), `168` = Record(mu = 448, sigma = 103)]

(1)

Games:=[[`162`, `70`], [`70`, `168`], [`168`, `162`]]

[[`162`, `70`], [`70`, `168`], [`168`, `162`]]

(2)

#I need Maple commands to follow the order of Games to auto create STO please

STO:=[`162` = Record(mu = 475, sigma = 41),`70` = Record(mu = 480, sigma = 42),
       `70` = Record(mu = 480, sigma = 42),`168` = Record(mu = 448, sigma = 103),
     `168` = Record(mu = 448, sigma = 103),`162` = Record(mu = 475, sigma = 41)]

`Non-fatal error while reading data from kernel.`

(3)

 


 

Download ORDERED.mw

Good day.

My question involves a set of prescribed points in the Cartesian plane. The x and y ranges are fixed. The points are connected by (imaginary) horizontal and vertical lines to produce a fixed number of blocks / grids.

An example is given in the attached file.  Grid_Example.mw

Now, I wish to reduce the intervals between these points by a scaling factor, n, so as to generate more blocks within the plane that is constrained by the x and y-ranges.

In doing so, I need to find the (x,y)-location of these points in the plane and it would also be great if I could obtain a simple plot.  

As I have several scaling factors to investigate, I was hoping someone may be able to guide me towards a simple routine to help obtain these solutions.

Once again, thanks for taking the time to read this.

 

Dear Maple Users, 

 

First of all I would like to thank for your great support and hints on making a package for Maple. It has made possible for me to construct this package here: 

 

restart; 
MyMat:=module()
description "My Package";
option package; 
export RegModelPlot,RegModel;
RegModelPlot :=proc(c::algebraic,xd::list,yd::list,x::algebraic)
    uses Statistics, plots:
     display
                            (  [ plot
                                 ( Fit(c, xd, yd, x),
                                   x=min(xd)..max(xd),
                                   color=blue,gridlines,
                                   title=typeset("Regressionformula\n f(x) = ", evalf[4](Fit(c, xd, yd, x))),caption=typeset("Residuals = ", Fit(c, xd, yd, x, output = residuals) ))                    
                                 ,
                            
                                 plot
                                 ( xd, yd,
                                   style=point,
                                   symbol=solidcircle,
                                   symbolsize=10,
                                   color=red
                                 )
                               ],
                               size=[800,600]
                            );
                           
                           end proc; 

    RegModel:=proc(c::algebraic,xd::list,yd::list,x::algebraic)
            uses Statistics, plots:
return  Fit(c, xd, yd, x);
end proc; 
    end module

 

My question is now. How do I make it installable ? Meaning, making it so I can be accessed using with the with() argument alene? I have tried to convert it to into an MLA-file and place it in the lib folder. 
 

But if I type with(MyMat) it gives me the error: 

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received MyMat 
 

So anyone with an idea/hint on what I need to add to make the package installable? 

 

Thanks in advance :)

Hi 

I was wondering someone could help me with something.

Basically I've got a function of f(x,z) that I have plotted which comes from an integration that was taken over a large number of small steps. I have been able to plot this function to determine a Potential Field as a function of x and z. (No Problems so far)

However the next step that I want to be able to do is compute a field form this potential. apologies for my lack of knowing how to input into here as I am fairly new to this. To do this I have:

Field = - Nabla * Potential 

Again no problem, I can plot a gradient field from it which is great using the gradplot command. I beleive this comes as a result of the following:

gradplot = [diff(f,x), diff(f,z)]

HOWEVER I want to be able to plot a Field Strength plot (In essence a Gradient Field Strength) where it takes the magnitude of the vectors at each point. Firstly am I correct in saying that this should be:

Magnitude Field = |F| = sqrt( Fx^2+Fz^2)      where Fx is diff(f,x) and Fz is diff(f,z)

 

However when I try to compute this, it takes an age to evaluate and doesn't seem to make much progress. I think this may come as a result of computing square roots of large numbers/large decimal places? I was wondering whether there is any command that anyones knows of that would calculate Gradient Field Strength/Magnitude that may solve this issue? Or even who to just compute this Square root?

Hi,

i have a problem with this code ?

CodeVectorCalculus.mw

ideas ?

Thanks

Ty4 :=combine(-(chi*omega^2+2*omega)*cos(omega*(Upsilon+b1))*P1*(3*exp(-3*omega)*kappa+exp(-omega)*kappa+exp(-omega*(2*d1+1))*kappa^2+3*exp(-omega*(2*d1+3))*kappa^2-2*exp(-omega*(2*d1+3))*omega-4*exp(-3*omega)*omega^2-2*exp(-omega*(2*d1+3))*d1*kappa*nu__p^2*omega+4*exp(-omega*(2*d1+3))*d1*kappa*nu__p*omega+2*exp(-omega*(2*d1+1))*d1*kappa*nu__p^2*omega+4*exp(-omega*(2*d1+1))*d1*kappa*nu__p*omega-exp(-3*omega)*kappa*nu__p^2+exp(-omega)*kappa*nu__p^2+exp(-omega*(2*d1+1))*kappa^2*nu__p^2-exp(-omega*(2*d1+3))*kappa^2*nu__p^2+2*exp(-omega*(2*d1+1))*d1*kappa*omega-8*exp(-omega*(2*d1+3))*d1*nu__p^2*omega^3-16*exp(-omega*(2*d1+3))*d1*nu__p*omega^3-4*exp(-omega*(2*d1+3))*kappa*nu__p^2*omega^2-8*exp(-omega*(2*d1+3))*kappa*nu__p*omega^2+6*exp(-omega*(2*d1+3))*d1*kappa*omega-4*exp(-3*omega)*kappa*nu__p*omega+4*exp(-3*omega)*d1*nu__p^2*omega^2+8*exp(-3*omega)*d1*nu__p*omega^2-2*exp(-3*omega)*kappa*nu__p^2*omega+2*exp(-3*omega)*kappa*nu__p+2*exp(-omega)*kappa*nu__p+2*exp(-omega*(2*d1+1))*kappa^2*nu__p+2*exp(-omega*(2*d1+3))*kappa^2*nu__p-8*exp(-omega*(2*d1+3))*d1*omega^3-4*exp(-omega*(2*d1+3))*nu__p*omega-2*exp(-omega*(2*d1+3))*nu__p^2*omega-4*exp(-omega*(2*d1+3))*kappa*omega^2-2*exp(-3*omega)*kappa*omega-4*exp(-3*omega)*nu__p^2*omega^2+4*exp(-3*omega)*d1*omega^2-8*exp(-3*omega)*nu__p*omega^2)*exp(-omega*(1-d1-chi))/(omega*(4*exp(-2*omega)*nu__p^2*omega^2+8*exp(-2*omega)*nu__p*omega^2-exp(-4*omega)*nu__p^2+2*exp(-2*omega)*nu__p^2+4*exp(-2*omega)*omega^2+2*exp(-4*omega)*nu__p-4*exp(-2*omega)*nu__p-nu__p^2+3*exp(-4*omega)+10*exp(-2*omega)+2*nu__p+3)*(kappa+1)*Pi),exp);

 

Hey guys, I am looking for a way to translate a maple code to matlab with the resultnames of codegeneration following a rule set by the loop. I tried a few ways, including with printf in the result name but no success.

Basically I need the resultname variables to be KNL(1,1) or KNL[1,1]. It doesn't let me do the way I put in the sheet, it renames the variable automatically.

Please see the sheet attached

Thanks in advance!!

restart

with(CodeGeneration)

with(LinearAlgebra)

A := RandomMatrix(6, 6)

Matrix(%id = 18446746689673050582)

(1)

``

for ii to 6 do for jj to 6 do Matlab(A[ii, jj], resultname = KNL[ii, jj]) end do end do

cg = 67;

 

``

Download Matlab_-_Resultname.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

 

Hi all; 

Given two vectors C1 and C2.
Under what condition on C1 and C2,  the two matrices D1 and D2 are equal.

condition.mw

 

many thanks for your help


I'm trying to evaluate an integral, but after several hours, MAPLE 2019 is unable to return an answer.  My CPU and memory are not being taxed, and the integrand appears well behaved.  Please see below. Any advice?

restart

istar := y*sinh(Pi*y)*exp(-alpha*y^2)*LegendreP(-1/2+I*y, 1+u)

y*sinh(Pi*y)*exp(-alpha*y^2)*LegendreP(-1/2+I*y, 1+u)

(1)

Istar := `assuming`([int(istar, y = 0 .. infinity)], [alpha > 0, u > 0])

int(y*sinh(Pi*y)*exp(-alpha*y^2)*LegendreP(-1/2+I*y, 1+u), y = 0 .. infinity)

(2)

alpha := 1; u := 2

2

(3)

plot(istar, y = 0 .. 40)

 

evalf(Istar)

``


 

Download Istar.mw

 

How I can substitute Eqs1-16) into Eq (17)?

Should I use subs rule?

Thanks 

 

 

A few seconds after calling up Help starts zucking araound and the whole computer then freezes. Ctrl-Alt-Delete doesn't work, hard reset required. Very funny. Am I alone?

First 621 622 623 624 625 626 627 Last Page 623 of 2424