Re: Why is Mathematica assuming k==l and how do I make it
- To: mathgroup at smc.vnet.net
- Subject: [mg92724] Re: Why is Mathematica assuming k==l and how do I make it
- From: "sjoerd.c.devries at gmail.com" <sjoerd.c.devries at gmail.com>
- Date: Sat, 11 Oct 2008 06:46:09 -0400 (EDT)
- References: <gci2il$td$1@smc.vnet.net> <gcn4a5$75e$1@smc.vnet.net>
First of all you should put your question as a new posting and not hijack a thread that has nothing to do with it. Secondly, you really should try to read some basic documentation on Mathematica. Just looking at someone's code and starting a newsgroup discussion for every element your unfamiliar with is rather inefficient, to say the least. Anyway, to answer your question: [[ .. ]] are used to indicate array indices. Single brackets [ .. ] are used for function arguments. Sjoerd On Oct 10, 10:38 am, mariam <mariamsaleh.k... at gmail.com> wrote: > On Oct 8, 12:38 pm, Bob Hanlon <hanl... at cox.net> wrote: > > > > > Integrate[Cos[k alpha] Cos[l alpha], {alpha, -Pi, Pi}, > > Assumptions -> {l == k, Element[{l, k}, Integers]}] > > > Pi > > > Integrate[Cos[k alpha] Cos[l alpha], {alpha, -Pi, Pi}, > > Assumptions -> {l != k, Element[{l, k}, Integers]}] > > > 0 > > > Assuming[{l == k, Element[{k, l}, Integers]}, > > Integrate[Cos[k alpha] Cos[l alpha], {alpha, -Pi, Pi}]] > > > Pi > > > Assuming[{l != k, Element[{k, l}, Integers]}, > > Integrate[Cos[k alpha] Cos[l alpha], {alpha, -Pi, Pi}]] > > > 0 > > > Bob Hanlon > > > ---- Aaron Fude <aaronf... at gmail.com> wrote: > > > ============= > > As in > > > Assuming[Element[{k, l}, Integers] , > > Integrate[Cos[k alpha] Cos[l alpha], {alpha, -Pi, Pi}]] > > > I get 0 whereas the answer is Pi if k=l; > > > Thanks! > > > Aaron > > > -- > > > Bob Hanlon > > hi all, > i found your group via web-search. > i am new to mathematica and learning about some codes needed in my > projects. > i want to know that: > 1) > > Do[{ > amplist[i1]= Read[StringJoin[jproc,"/",QCD[i1],"diagram= s.amp"]], > ileng[i1] = Length[amplist[i1]], > > Do[{ > Print["Processing amp[",i1,",",i2,"]"], > If[i1===2,{amp[i1,i2] = amplist[i1][[i2]][[3]]}, = {amp[i1,i2] = > amplist[i1][[i2]][[2]] > = = }], > ---------------------------------- and so on. > What does amp[i1,i2] = amplist[i1] [[i2]] [[3]] mean? I mean any > f[i.j]=g[i] [[j]] [[k]] > I am confused about the double-brackets used [[----]]. > > 2) in another expression, > itwo = StringPosition[jproc,"2"][[1,1]] > > what for [[ x, y]] is used? > > I'll be very grateful for your help.