MaplePrimes Questions

How to insert pagebreak using code itself where I want as i run code 

As if I get more lines of output difficut to run through output give ctrl+Enter each place later 

Kind help

Considered a list of this type 

L:=[["O",3.85090000,0.45160000,0.00120000],
["O",−2.59990000,1.40410000,−0.00180000],
["N",−1.57050000,−0.71710000,0.00010000],
["C",−0.20660000,−0.42310000,−0.00020000],
["C",0.22050000,0.90470000,0.00040000],
["C",0.72980000,−1.45700000,−0.00070000],
["C",1.58410000,1.19860000,0.00020000],
["C",2.09330000,−1.16290000,−0.00070000],
["C",2.52040000,0.16480000,−0.00030000],
["C",−2.64850000,0.17820000,0.00090000],
["C",−3.97350000,−0.54200000,0.00100000],
["H",−0.44360000,1.75770000,0.00120000],
["H",0.41130000,−2.49630000,−0.00100000],
["H",−1.80100000,−1.70860000,0.00010000],
["H",1.90530000,2.23700000,0.00090000],
["H",2.81800000,−1.97260000,−0.00080000],
["H",−4.06550000,−1.14630000,−0.90580000],
["H",−4.79040000,0.18440000,0.02880000],
["H",−4.04450000,−1.18860000,0.88020000],
["H",3.96500000,1.41760000,0.00170000]];

Find out the indexs of the list within the list where "H" is their and to store is set S.

Here we can say 12th list have "H"

Similarly 13th list has "H" and so on

So it will output a set

{11,12,13,...}

A function which takes a list like above as input and outputs the set which give index positions of lists containing "H"

Is their anyway in by which given a molecule I can code to get the hydrogen depleted form of the molecule using Maplesoft quantum chemistry toolbox

After hydrogen depleted get the BondDistances table of that depleted molecule structure

 

 

Dear all

I have a third order equations, I would like to know the sign of its roots, not necessary to find the roots since the equations contains some parameters. All parameters used are positives. 

roots.mw

thank you

Here is the full code with output and errors.

restart; with(plots): with(plottools):
w:=-Ps/2*(Hk*cos(theta)^2+2*H*cos(theta-psi));
             1    /             2                        \
      w := - - Ps \Hk cos(theta)  + 2 H cos(-theta + psi)/
             2                                            

dw:=diff(w,theta);
        1                                                         
dw := - - Ps (-2 Hk cos(theta) sin(theta) + 2 H sin(-theta + psi))
        2                                                         

equ:=dw=0;
                    1                                
           equ := - - Ps (-2 Hk cos(theta) sin(theta)
                    2                                

              + 2 H sin(-theta + psi)) = 0


Hg:=(sin(psi)^(2/3)+cos(psi)^(2/3))^(-3/2);
                                  1                  
           Hg := ------------------------------------
                                                (3/2)
                 /        (2/3)           (2/3)\     
                 \sin(psi)      + cos(psi)     /     

psi:=35.0*Pi/180;H:=0.1;Ps:=1.0;Hk:=1.0;
                      psi := 0.6108652383

                            H := 0.1

                           Ps := 1.0

                           Hk := 1.0

Hc:=evalf(Hk*Hg); theta:='theta';
                       Hc := 0.5103773339

                         theta := theta

theta_s:=evalf(Pi-arctan(tan(psi)^1/3));
                     theta_s := 2.912295114

H:='H';np:=100;H_max:=1.0;
                             H := H

                           np := 100

                          H_max := 1.0

h_p:=array(1..np):
h_n:=array(1..np):
m_p:=array(1..np):
m_n:=array(1..np):
h_p[1]:=0.0;m_p[1]:=cos(psi);
                          h_p[1] := 0.

                     m_p[1] := 0.8191520442


for i from 2 to np do
   h_p[i]:=(i-1)*H_max/(np-1):
   H:=h_p[i]:
   theta_plus:=fsolve(equ,theta,0..Pi/2):
   m_p[i]:=evalf(cos(theta_plus-psi)):
end do:

h_n[1]:=0.0; m_n[1]:=evalf(cos(Pi-psi));
                          h_n[1] := 0.

                    m_n[1] := -0.8191520446


for i from 2 to np-1 do
   h_n[i]:=(i-1)*Hc/(np-1):
   H:=h_n[i]:
   theta_minus:=fsolve(equ,theta,theta_s..Pi);
   m_n[i]:=evalf(cos(theta_minus-psi)):
end do:

h_n[np]:=Hc; m_n[np]:=evalf(cos(theta_minus-psi));
                    h_n[100] := 0.5103773339

    m_n[100] := cos(fsolve(1.000000000 cos(theta) sin(theta)

       + 0.5052220075 sin(theta - 0.6108652383) = 0, theta, 

      2.912295114 .. Pi) - 0.6108652383)

pl_pp:=array(1..np):
pl_pn:=array(1..np):
pl_np:=array(1..np):
pl_nn:=array(1..np):
i:='i';
                             i := i

NULL;


NULL;
NULL;
NULL;
for i from 1 to np do
   pl_pp[i]:=point([h_p[i],m_p[i]],color=red):
   pl_np[i]:=point([h_n[i],m_n[i]],color=blue):
   pl_pn[i]:=point([-h_n[i],-m_n[i]],color=red):
   pl_nn[i]:=point([-h_p[i],-m_p[i]],color=blue):
end do:
Error, (in plottools:-point) incorrect arguments for creating points structure, try providing the dimension option


display([seq(pl_pp[i],i=1..np),seq(pl_np[i],i=1..np),seq(pl_pn[i],i=1..np),seq(pl_nn[i],i=1..np)]);

Error, (in plots:-display) expecting plot structures but received: [pl_pp[60], pl_pp[61], pl_pp[62], pl_pp[63], pl_pp[64], pl_pp[65], pl_pp[66], pl_pp[67], pl_pp[68], pl_pp[69], pl_pp[70], pl_pp[71], pl_pp[72], pl_pp[73], pl_pp[74], pl_pp[75], pl_pp[76], pl_pp[77], pl_pp[78], pl_pp[79], pl_pp[80], pl_pp[81], pl_pp[82], pl_pp[83], pl_pp[84], pl_pp[85], pl_pp[86], pl_pp[87], pl_pp[88], pl_pp[89], pl_pp[90], pl_pp[91], pl_pp[92], pl_pp[93], pl_pp[94], pl_pp[95], pl_pp[96], pl_pp[97], pl_pp[98], pl_pp[99], pl_pp[100], pl_np[59], pl_np[60], pl_np[61], pl_np[62], pl_np[63], pl_np[64], pl_np[65], pl_np[66], pl_np[67], pl_np[68], pl_np[69], pl_np[70], pl_np[71], pl_np[72], pl_np[73], pl_np[74], pl_np[75], pl_np[76], pl_np[77], pl_np[78], pl_np[79], pl_np[80], pl_np[81], pl_np[82], pl_np[83], pl_np[84], pl_np[85], pl_np[86], pl_np[87], pl_np[88], pl_np[89], pl_np[90], pl_np[91], pl_np[92], pl_np[93], pl_np[94], pl_np[95], pl_np[96], pl_np[97], pl_np[98], pl_np[99], pl_np[100], pl_pn[59], pl_pn[60], pl_pn[61], pl_pn[62], pl_pn[63], pl_pn[64], pl_pn[65], pl_pn[66], pl_pn[67], pl_pn[68], pl_pn[69], pl_pn[70], pl_pn[71], pl_pn[72], pl_pn[73], pl_pn[74], pl_pn[75], pl_pn[76], pl_pn[77], pl_pn[78], pl_pn[79], pl_pn[80], pl_pn[81], pl_pn[82], pl_pn[83], pl_pn[84], pl_pn[85], pl_pn[86], pl_pn[87], pl_pn[88], pl_pn[89], pl_pn[90], pl_pn[91], pl_pn[92], pl_pn[93], pl_pn[94], pl_pn[95], pl_pn[96], pl_pn[97], pl_pn[98], pl_pn[99], pl_pn[100], pl_nn[59], pl_nn[60], pl_nn[61], pl_nn[62], pl_nn[63], pl_nn[64], pl_nn[65], pl_nn[66], pl_nn[67], pl_nn[68], pl_nn[69], pl_nn[70], pl_nn[71], pl_nn[72], pl_nn[73], pl_nn[74], pl_nn[75], pl_nn[76], pl_nn[77], pl_nn[78], pl_nn[79], pl_nn[80], pl_nn[81], pl_nn[82], pl_nn[83], pl_nn[84], pl_nn[85], pl_nn[86], pl_nn[87], pl_nn[88], pl_nn[89], pl_nn[90], pl_nn[91], pl_nn[92], pl_nn[93], pl_nn[94], pl_nn[95], pl_nn[96], pl_nn[97], pl_nn[98], pl_nn[99], pl_nn[100]]

NULL;

NULL;
 

@David Mazziotti 

I just purchased the quantum chemistry package

The plotmolecule is not giving the correct structure of the attached xyz file can you please confirm and help 

I am attaching 

A.xyz    as     A.txt
Please rename it .xyz as maple is not allowing to attach a xyz file.

XYZ  file :       A.txt     Rename as xyz

Image file of the molecule which is expected:
  


Image coming from maple code: 

It can be observed that the bond between yellow (Sulfur ) and carbon missing

Code given below I typed

restart;
with(QuantumChemistry);
molecule := ReadXYZ("A.xyz");
print(PlotMolecule(molecule));

The help page solve/details claims that solve(x^2-1,{x}, useassumptions) assuming x>0; is equivalent to solve({x^2-1, x>0},{x});. But the following example perplexes me again.

Considering a multi-variable polynomial: 

expr := 36*a^3*b^3+8*a^2*b^2*(9*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)+((a-b)^2-2*(a+b)+1)^2*(a+b+1)^5+a*b*((a-b)^2-2*(a+b)+1)*(17*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)^2: # assuming nonnegative

I intend to find the nonnegative real roots of it. 

solve({expr = 0, (a, b) >= ~ 0}, [a, b], allsolutions);
solve(expr = 0., [a, b], useassumptions, allsolutions) assuming (a, b) >= ~ 0;
solve({expr = 0., (a, b) >= ~ 0}, [a, b], allsolutions);

all return six solutions, but curiously, 

solve(expr = 0, [a, b], useassumptions, allsolutions) assuming (a, b) >= ~ 0;

only returns four solutions. Why???

In addition, as you can see, the first output (i.e., sol1) is thoroughly less meaningful. Can't it be more readable?? 
 

restart;

expr := 36*a^3*b^3+8*a^2*b^2*(9*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)+((a-b)^2-2*(a+b)+1)^2*(a+b+1)^5+a*b*((a-b)^2-2*(a+b)+1)*(17*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)^2

sol1 := solve({`~`[`>=`](a, b, ` $`, 0), expr = 0}, [a, b], allsolutions) =
[[a = 0, b = 1], [a = 3^(1/2)-1, b = RootOf((-741235976922591048947725497133370413109846163676281959390560108171291511786260537194814187602376638467882392432305864*3^(1/2)+1283858372427879519277780718816094877088966867890478064541174875107114975191197490158346515516574907111238006510832897)*_Z^8+(542622395505288470330055221682724463979120704214196105150614766935823463404936952963532327914198268643355614078527033*3^(1/2)-939849558339893627565395772584016362240571623138367813630505449406759560167584121426096047290555008292409170786084695)*_Z^7+(27663303262730616171732317130828357033086591952430419833222950914496979987637185645479748907213281840470027913754446250*3^(1/2)-47914246756235321853987379290323009935074722268098020072540300747281044857411765919011355938402797296261231903185833860)*_Z^6+(-36848925451143075385294452437991667121840085487125852139251120381482252862356891660819456375517484560073220737684055360*3^(1/2)+63824211085697719773601999676355867125229886950052051470652732444578522019946850568834704346278726602905590979989005206)*_Z^5+(-361541600067355242269699717707379679953498397064818094940691654358197984962782803819129269994590941790029033835785321091*3^(1/2)+626208420366406708672813369852190896907780666621957659007533759258885959287096424079349105562785060297582745252447270847)*_Z^4+(469917886838763314544262854134623783463102170709338866937842556434901449696233730989733509809486602395675273592523379039*3^(1/2)-813921655390140293483357785790922432834508040979560342164969934794994487106266639300148834412459020073129881509269947685)*_Z^3+(2419091701164731099042357448446421888413075728672522494523180828886450053865285232431099171783692236478370266582727759022*3^(1/2)-4189989734585541679787610388006771626857619186946433018568920261866881451820006582050966407487366628715776067639375659568)*_Z^2+(-276526595929812923186277260098945143564039808175960075417091066631428638512893788855336862569832144723039829695578843580*3^(1/2)+478958113794505090444730274771005660986137994458744274847200001817421835204311147220572248669252963586284164359082018778)*_Z-2241557156236496486338463519192106892320755475146925672942972549523504139162741341146795559700763371271548957041603585449*3^(1/2)+3882490882671219790342097523842232566093205006918585285230133334462570311857306952032638288791685675699575851624588398080, index = real[4])], [a = 1, b = 0], [a = 1, b = 3^(1/2)-1], [a = 1, b = 1], [a = 1/2+(1/2)*3^(1/2), b = RootOf((3265859930834838622581170032695923790177759993209560990735389424723672715638564736*3^(1/2)+5656635330609319983539361351500545583607599001912359529744925502462343818424446992)*_Z^8+(12188355192278997228701701416892393163963118988331481511215704351909689249701576464*3^(1/2)+21110850453723155834822232801088862537748477983453402031696019279095705783764588192)*_Z^7+(-16329299654174193112905850163479618950888799966047804953676947123618363578192823680*3^(1/2)-28283176653046599917696806757502727918037995009561797648724627512311719092122234960)*_Z^6+(-47558033069228748234327710008167261759137556448974526775358049368769421447413364728*3^(1/2)-82372929583945025397186856831061837257531071444955446405553455730528485970812729160)*_Z^5+(71016746435016238932635448066739883738739336153617153345258159361269798232579788444*3^(1/2)+123004613013684064253013423478212462789515684702771043974383244940692061281906669908)*_Z^4+(-539074301591972734261861623983834399153978765971327430710378028630584341753429268*3^(1/2)-933704079412004867600664919608623045951401970711134655767859337789085046795723776)*_Z^3+(-8660811640968922793242100644402781523021841461481655906743406226105766029465794376*3^(1/2)-15000965796942156111966381948246207258139974790596863072851606476670777826354805396)*_Z^2+(-30769734905669303241874027457081560634086527346916553595415452889491557012102176442*3^(1/2)-53294744192044789072581100596045559567736905080848045509547703544202848750472876382)*_Z-3181857373467742490740890760219056890779274438575702235481520595135068397863751433*3^(1/2)-5511138633283790175605724430174371395924969988541134171865969654221197707640077992, index = real[4])]]
NULL

sol2 := `assuming`([solve(expr = 0., [a, b], useassumptions, allsolutions)], [`~`[`>=`](a, b, ` $`, 0)]) =
[[a = 0., b = 1.], [a = .7320508076, b = 1.000000000], [a = 1., b = 0.], [a = 1., b = .7320508076], [a = 1., b = 1.], [a = 1.366025404, b = 1.366025404]]
NULL

sol3 := solve({`~`[`>=`](a, b, ` $`, 0), expr = 0.}, [a, b], allsolutions) =
[[a = 0., b = 1.], [a = .7320508076, b = 1.000000000], [a = 1., b = 0.], [a = 1., b = .7320508076], [a = 1., b = 1.], [a = 1.366025404, b = 1.366025404]]
NULL

sol4 := `assuming`([solve(expr = 0, [a, b], useassumptions, allsolutions)], [`~`[`>=`](a, b, ` $`, 0)]) = [[a = 0, b = 1], [a = 1, b = 0], [a = 1, b = 3^(1/2)-1], [a = 1, b = 1]]NULL

_SolutionsMayBeLost;

_SolutionsMayBeLost

(1)

numelems(sol1), numelems(sol2), numelems(sol3), numelems(sol4) = 6, 6, 6, 4NULL

sol5 := [[a = 0, b = 1], [a = sqrt(3)-1, b = 1], [a = 1, b = 0], [a = 1, b = sqrt(3)-1], [a = 1, b = 1], [a = (sqrt(3)+1)*(1/2), b = (sqrt(3)+1)*(1/2)]]

Why did't solve({`~`[`>=`](a, b, ` $`, 0), expr = 0}, [a, b]) return sol5?

map2(evala@eval, expr, sol5);

[0, 0, 0, 0, 0, 0]

(2)

Error, (in type/algext) too many levels of recursion


 

Download solve_details.mw

Hello,

 Can you tell me how I can create the variation tab of a function with Maple 2022?

Thanking you,
 
,DAVID CRESPIL

I have only seen big O show up in series solutions, as in 

series(sin(x),x)

I've never seen it before show up in result of solve

restart;
eq:=x=p*(a*ln(p+sqrt(p^2-2))+2*_C1)/(2*sqrt(p^2-2));
sol:=solve(eq,p);

What does it actually mean when the solution has  O(RootOf(....))?  

Should not result of solve be exact? isn't having big O means an approximation?

Maple 2022.2 on windows 10

Q1: Is it possible to find out where a warning was generated (i.e. which procedure issued the warning)?

Q2: Is a command specific warning suppression possible? Something like that for example: infolevel[int] := 0

Q3: Can warnings be removed form a document before printing it?

Typical warnings I want to suppress are attached
 

Download warnings_to_suppress.mw

Update: for the attached warnings Typesetting:-Settings(parserwarnings = false) is effective, which does not work for warnings discussed bellow.

 

So for my project, I need to be able to do this integral for different values of "l". Here is the integral I need to evaluate:

Where "R", "Xi", and "l" are all constant. When I try to do it, it gives back an imaginary number. The absolute value of this imaginary number seems to be correct but I'm not sure why it's imaginary. This is a plot of what it should give for various values of "l":

Here is my maple code copy-pasted from the application (I'm new to Maple and this forum and cannot figure out how to attach the file version of my code sorry):

Digits := 30;
E := 3.83*10^14;
                                            14
                  E := 3.8300000000000000 10  

R := 0.1*E;
                                            13
                  R := 3.8300000000000000 10  

l := 0.01*R;
                                            11
                  l := 3.8300000000000000 10  

A := int((-4*E^2 + r^2)^(1/2)*(R^2 - l^2 + r^2)/((R^2 - (l - r)^2)^(1/2)*((l + r)^2 - R^2)^(1/2)), r = abs(l - R) .. l + R)/(Pi*R^2);
             A := 19.9744824651978825998722703010 I

Max := (1 + 4*(E/R)^2)^(1/2);
             Max := 20.0249843945007857276972121483

NULL;

Here is the code when I exported as maple input:

NULL;
Digits := 30;
E := 3.83*10^14;
R := 0.1*E;
l := 0.01*R;
A := int((-4*E^2 + r^2)^(1/2)*(R^2 - l^2 + r^2)/((R^2 - (l - r)^2)^(1/2)*((l + r)^2 - R^2)^(1/2)), r = abs(l - R) .. l + R)/(Pi*R^2);
Max := (1 + 4*(E/R)^2)^(1/2);
NULL;

Thank you in advance!

Having  Matrix say A of dimensions n×m

Writing a function that 

Will choose k  columns of the matrix at 

At random where one of the column that is column m is the last column of output matrix that is after choosing k columns from the first m-1 column

We append the column m as last column to the new random matrix and the function returns the new matrix M

Kind help

k can be any big number less than m-1

When exporting a maple file containing

pH = 1/2*(pKa - log[10](c)),

I could see that the minus was transformed into a K

Any idea for solving this problem ?

Cheers for Maple anyway

There are two issues I am having with images in Maple Flow 2022.

1. When I need to move an image up or down in the document it instantly flies to the top or off in to the vast corner of the document with the tiniest motion of the mouse. It's utterly ridiculous. Is there a setting to change this behaviour in Maple Flow? I have changed settings on my desktop with no change, so I believe it is Maple Flow's behavior.

2. When I do put an image somewhere and save the document and open it some time later, the images are moved in position on top of text. No amount of moving them and saving them ever changes this and I can't export a document that I need to submit for calculations on a report because of this.

 

Any help would be appreciated.

Could you suggest a more elegent way to remove any entry in piecewise which has undefined in it?

expr:=(s+exp(-Pi*s)-exp(-2*Pi*s))/(s*(s^2+2*s+2));
inttrans:-invlaplace(expr,s,t);
Y:=convert(%,piecewise);
#remove all entries in piecwise which has undefined

To obtain this

I can;t just apply select on piecewise. So currently I convert piecwise to list of lists, each sublist has the 2 entries you see above in each row.

Next apply select. Then use piecewise again on the result. This works, but wondering if there is a better way.

Attached worksheet.

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;
expr:=(s+exp(-Pi*s)-exp(-2*Pi*s))/(s*(s^2+2*s+2));
inttrans:-invlaplace(expr,s,t);
Y:=convert(%,piecewise);
#remove all entries in piecwise which has undefined

expr := (s+exp(-Pi*s)-exp(-2*Pi*s))/(s*(s^2+2*s+2))

exp(-t)*sin(t)+(1/2)*(-1+exp(-t+2*Pi)*(cos(t)+sin(t)))*Heaviside(t-2*Pi)+(1/2)*(1+exp(-t+Pi)*(cos(t)+sin(t)))*Heaviside(t-Pi)

piecewise(t < Pi, exp(-t)*sin(t), t = Pi, undefined, t < 2*Pi, exp(-t)*sin(t)+1/2+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)), t = 2*Pi, undefined+(1/2)*exp(-Pi), 2*Pi < t, exp(-t)*sin(t)+(1/2)*exp(-t+2*Pi)*(cos(t)+sin(t))+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)))

Y:=[op(Y)]:
Y:=seq([Y[n],Y[n+1]],n=1..nops(Y)-1,2):
ListTools:-Flatten(select(not has,[Y],'undefined')):
piecewise(op(%))

piecewise(t < Pi, exp(-t)*sin(t), t < 2*Pi, exp(-t)*sin(t)+1/2+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)), 2*Pi < t, exp(-t)*sin(t)+(1/2)*exp(-t+2*Pi)*(cos(t)+sin(t))+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)))


Download remove_undefined.mw

First 110 111 112 113 114 115 116 Last Page 112 of 2308