Tree walking - inconsistency or design Given some algebraic expression y, I can do y[[3,2,5,1,..]] to walk the tree (or the full form) to a particular node.I can also do y[[0]] which is the same as y//Head. However, y[[0,2]], for example, is an error in my notebook, though presumably it should be the same as y[[2]]. This seems to me an inconsistency, but perhaps it is that way on purpose???? (In y[[3,2,5,1,..]], presumably the "0" is implicit.) This is probably not a big deal, but I am bothered by stuff like this - a sort-of reflection edge condition that doesn't seem sensible.
|
|
I don't think that this is an inconsistency: if you do extract a head with [[0]] , that head does not have some internal structure that you can probe by asking to get its parts. What is the second part of Graphics ?
|
|
It seems to me the Head is just a node. I don't understand why it should be different from any other node. If it doesn't have a structure, why should any other node have a structure? I suppose there is something in the engine which interprets the head node differently from other nodes.
|
|
I think I see what you mean; I think that that's fair enough if you're thinking about it in terms of TreeForm . The discrepancy, such as it is, exists because technically Part is always "reaching into" an expression (cf. the reason you can't [""] use Part on atoms is because they don't have an "inside" to reach into). That is: whenever you say expr[[n]] , you are going into expr and extracting something. If you have not just a single n , but exprp[[m,n,...]] then the number of elements in that sequence specifies the Depth at which you are accessing the structure of expr . The issue here is that expr[[0]] does indeed not work like this: because indexing in Wolfram Language starts at 1 , this is not "getting a part" of expr in the same sense that expr[[n]] for n≥1 is, but is "special case", manually-implemented extra behavior. I do see why one might consider this inconsistent, but my personal sense is that [[0]] is simply used as a convenient syntax shortcut for Head@ . If we didn't have it, the behavior of Part would indeed be more consistent, but it would also be less functional for some particular uses... my perhaps-frustrating advice is to do a bit of compartmentalization about the meaning of Part , here. We're already doing that when using Part on SparseArray or Dataset atoms, so why not add one more case where Part is doing something which is maybe a little bit misleading... Finally, I do want to clarify something: because this [[0]] is a special behavior which does not give you the 0th part in the technical sense (as there is no 0th part in a language which indexes from 1), it is not the case that there is an implicit 0 which starts off any Part sequence. Moreover, there's nothing in any given expr that you cannot access because of this: the entirety of the internal structure of expr (if it has any) is accessible without making any reference to any 0th part. It's just that if you would like to get not the internal structure, but the thing that wraps around that internal structure—which in the strict sense is not a part—then we allow you to do that with Part[expr,0] as a convenience. The succinct version is maybe:
Part is really only intended to talk about the parts of a compound expression, and the "parts" of an expression are always internal to the expression.
- Because you could already access everything about an expression but its head with
Part , we added a special case of asking for """the zeroth part""" so that you could get that last bit of information without having to leave Part -world.
|
|
Thanks. That's really helpful.
|
|
In the "Check Your Understanding" exercise for pure functions we are told that Function[u, 3+#][x] is the correct syntax for returning 3+x given x as an argument. I think that's incorrect (?)
|
|
Good catch! I've fixed this in our repo and it will be fixed in our next deployment.
|
|
I asked in the BigMarker Q&A panel how to upload a WL Notebook to my Wolfram Cloud account. The reply was to use the "upload" button in the upper right corner of the Wolfram Cloud window. This doesn't work; I get the error message, "To access this feature, subscribe to a plan." Apparently, the Basic plan isn't good enough. I can upload files through Mathematica on another machine through the File->Save to Cloud function. I don't understand why that works but simply doing an "upload" in cloud does not. Is there a good reason for keeping a random user from uploading any notebook to a Wolfram Cloud account through the web? If not, please file this as a bug. One note for the staff answering questions: when they are answering a question like this, they should try to perform the function with the same level of privilege/access as a normal customer. In this case, the Wolfram Cloud "upload" function should have been tried on a Basic plan.
|
|
Hello Phil, Thank you for letting me know. I apologize for the confusion created. Upon a detailed look, the behavior described seems to be related to the fact that Wolfram Cloud and Wolfram Desktop are two separate products. The basic plan for Cloud grants users the basic functionalities needed for a smooth Desktop operation, but it does not grant access to the Wolfram Cloud as a product in and of itself. Basic Plan restrictions This is why the direct dynamic interaction within Wolfram Cloud is not available but the use of CloudPublish from Desktop, either programmatically or through the menu tool, works as expected. I will try to improve my Q&A support with your feedback. I have already setup a basic account for testing of future questions. Thank you!
|
|
Hi Everybody! I would like to produce documents effectively (so programmatically) and I need to find help about producing cells, sometimes cells within cells (within cells?). Can anybody give a good reference? Such things as TextData, BoxData, ToBoxes, ToString and similar.
|
|
Yes, I also found that I couldn't use the code output by those boxes in situ. Entering it into a new code cell works fine.
|
|
To produce cells look at Cell, TextCell and ExpressionCell. Here's my little experiment on WolframCloud to programmatically produce Hierarchical Textcells with Section and Subsection styling and CellGroup function. and the result is this Cheers.
|
|
I'd highly recommend Professor Richard J. Gaylord's Wolfram Language Fundamentals
|
|
Hate to redundant, I still can't get by this. If this is a real error, other errors I get may be me or Mathematica - can't tell. Btw, $Version returns: 14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023).
|
|
Please see the answers downthread—the easiest way I know to explain this is that if you say ax , how is Wolfram Language to know that you actually, truly, really meant a*x ? It can't. If you were to type myVar^2 , you ostensibly would not expect to get m^2 * y^2 * V^2 * a^2 * r^2 , so why expect differently for ax^2 ? (Since tone is never conveyed well over text, I want to be clear that the intended tone here is "Socratic" rather than "snippy" ;).)
|
|
ax is on variable not two variables
a * x is and expression equal to a space x
|
|
I think the best way to see what is going on, on your own machine, is to look at y//FullForm and z//FullForm. They are quite different. However if you insert a space between a and x in your expression for z, then y and z should be the same. [If you are somehow stripping out spaces, then that will cause you problems. Mathematica really uses the spaces as Arben says. I am already finding that when I am getting odd results, using FullForm, TreeForm etc can make things clearer.
|
|
Perfect. I get it, thank you.
|
|
While working with the exercises for Day 3 (Syntax and Expressions), I got the following error message while attempting Exercise 4 (ListLinePlot for airline passenger data), namely
"An improperly formatted option was encountered. The left-hand side of the option was not a symbol or string*
My solution(s) worked fine initially, but then went wonky all of sudden. In fact every plot in the notebook threw the same error message, whether options were specified or not. (Also all of the dynamic Hints and Solutions boxes disappeared, but that's not my main concern right now). Please see attached notebook..
Attachments:
|
|
Hi Michael—I think the issue comes from the formatting that this notebook has for that ListLinePlot input. Ideally, it would just be an input... but when you click into it, you can see that there's a kind of yellow box around it. Basically, this is a text cell formatted as input and so it won't evaluate correctly, if we're seeing the same thing. (I think your specific errors with respect to Dynamic elements here are kernel-specific and thus not "carried with" the notebook that you uploaded when I open it on my end, so I can't see for sure what your issue was.) if you just start typing ListLinePlot in a new cell, you should be able to plot the data without issue. I think what's happening is that on our end, making the Hint/Solution buttons does something unfortunate to the formatting of code blocks that we had intended for you to type into. I'll look into this with our team.
|
|
Arben, Thanks, that makes a lot of sense since both errors occurred at the same time. I'll try out your suggestions and see what happens.
|
|
Yes, I also found that I couldn't use the code output by those boxes in situ. Entering it into a new code cell works fine.
|
|
Arben, Just to let you know I opened this notebook the next day in order to try your suggestions, and it had healed itself overnight. One of those situations you're glad it's fixed without any effort, but not quite sure why. Anyway, all is good for now, and everything is working again as expected. I even entered some new comments and code into the notebook, and nothing seemed to upset it again. Fingers crossed! :<) :<)
|
|
In[84]:= Clear[x, y, a, b, c]
In[85]:= y = a x^2 + b x + c
Out[85]= c + b x + a x^2
In[86]:= Expand[y^2]
Out[86]= c^2 + 2 b c x + b^2 x^2 + 2 a c x^2 + 2 a b x^3 + a^2 x^4
system: Apple M2 Ultra, 14.3 (23D56)
Mathematica: 14.0.0.0 Mac OS X ARM (64-bit)
|
|
Is anyone else experiencing problems with the question submission bar in bigmarker on Chrome? When I go to type, the text box turns white, with white text, rendering the text unreadable.
|
|
I know you touched on this, but in exp = 1 + x^2, exp[[2, 1]] returns x, yet exp[[1, 1]] is longer than the depth of the object, why again?
|
|
exp[[2, 2]] returns 2, the second part of the second part, I'd expect exp[[1, 1]] to return the first and only part of the first.
|
|
In Wolfram Language, the structure of expressions and how they are indexed can sometimes be counterintuitive if you're not familiar with the underlying representation. Let's break down your example to understand it better. Consider the expression exp = 1 + x^2. In Wolfram Language, this is internally represented as Plus[1, Power[x, 2]]. The head of this expression is Plus, and it has two arguments: 1 and Power[x, 2]. exp[[2, 1]] returns x because it's accessing the first part (x) of the second argument (Power[x, 2]) of exp.
exp[[2, 2]] returns 2 because it's accessing the second part (2) of the second argument (Power[x, 2]) of exp.
Now, regarding exp[[1, 1]], the confusion arises because 1 is an atomic expression in Wolfram Language (it does not have a head and arguments structure like Power[x, 2] does). Atomic expressions include things like numbers, symbols, and strings. When you try to access a part of an atomic expression, it results in an error or an unexpected result because atomic expressions are considered as having no parts. So, exp[[1, 1]] is trying to access a part of the atomic expression 1, which doesn't have any parts, hence the issue. In Wolfram Language, the parts of atomic expressions are not accessible in the same way as the parts of composite expressions.
|
|
AtomQ[#] & /@ {exp[[1]], exp[[2]]} returns {True, False}, and Atoms don't have parts (errrrrrr... it's counterintuitive).
|
|
...and this can be seen: AtomQ[exp[[1]]] returns true.
|
|
Yeah, it's just atoms have parts as far as atoms are concerned, as apposed to atomic expressions. The same signifier ("atom") points to different signified concepts depending on the context, hence counterintuitive. Essentially, atomic parts are not the same in the case of the fundamental concept in chemistry and physics and atomic expressions and therefore not covered by Part in the normative sense. So an error message is returned.
|
|
There are sub-atomic parts
|
|
Understanding this helps in navigating subjects that cross disciplinary boundaries.
- GPT4
|
|
Hi Lewis—I understand what you're saying abstractly, but am having trouble understanding how it applies into specific to the discussion of atoms today. Let me offer a few clarifying comments and we can go from there?
- Atoms are the fundamental building blocks of compound expressions in Wolfram Language.
- Any compound expression, when you get to "the bottom of it"—literally, in the sense of
TreeForm —is made up of atoms.
- "Atom", in the context of Wolfram Language, is meant in the original Greek sense: "a thing which cannot be cut". What we mean by "uncuttable" is that
Part /[[ ]] does not fundamentally work on atoms; various functions can pull things out of atomic objects (cf. Numerator and Denominator for Rational atoms, ReIm for Complex atoms, EdgeList for Graph atoms, and so on).
- However—and it's a big "however"—there are some cases where an atomic object might be expected to have its insides accessible via
Part (e.g. Dataset , SparseArray , NumericArray ...). To that end, the front end will automatically "translate" a user request for Part into the correct underlying code to give the "expected" result. This lets you access the parts of a SparseArray "with" Part , for example.
- Ultimately, though, this is a syntactic convenience—just like, in a sense, being able to say
a+b rather than Plus[a,b] or {a,b,c} rather than List[a,b,c] . There exists an underlying "truth" and Part is not part of that truth when it comes to atoms.
|
|
Nice! I hadn't thought (until today!) about the derivation of the word atom. So, 'tom' as in 'tomography'.
|
|
Yes, the very same! It's from τόμος, which I think is from Ï„Îμνω, which is something like "to cut/slice/section/portion".
|
|
The notion of uncuttable is really helpful, thank you. I’ve now learnt to turn to inbuilt functions in order to better understand what’s going on and just the idea of syntactic convenience is helpful in getting over what at times has felt like contradictions in terms. I remember Prof Richard J. Gaylord saying once that Wolfram, at times, behaves strange, and never quite knew what was meant by that (likely the pitfalls of intuition).
|
|
I think the apparent confusion regarding the word atom is as a result of an error in the evolution of our scientific knowledge. It is only relatively recently that we discovered that 'atoms' of, say, radium are not really atoms in the logical sense of the word. Then we repeated the mistake, calling some of the sub-atomic bits "fundamental" only to find... In a parallel universe where the Wolfram language was developed in 1880, the concepts of atoms in Mathematica and Chemistry would have been consistent. Although some physicists maintained that the atoms of the chemical elements were fictional conveniences for the sake of calculation and that, if they even existed they would be too small to ever be known. Then came 1905 and Einstein's analysis of Brownian motion.
|
|
One thing that really attracted me to Wolfram was how the expressions in a book I picked up published in 1988 still computed. Thankful, in this universe there is forward compatibility, even amongst changes in scientific knowledge.
|
|
I'm with you there—I immediately thought that the following image, from this blog post, was very striking:
|
|
Although Show[Graphics3D[Stellate[ Icosahedron[ ]]]] wasn't forward compatible.
|
|
Heh, it's true :). At least in this case it's been superseded by something simpler and clearer!
|
|
I can heartily recommend this. While I am in no position to judge Wolfram's contribution to Physics, the ideas are fascinating and are something I would like to pursue. If I am hearing him correctly, he is attempting to make sense of Physics by looking at it as a system that is computable by the application of rules for re-writing. He seems to be saying the system evolves what look like small black holes and "elementary" particles from vacuum energy. Of course he is talking to a professional physicist here so we hear him respond to some good questions. I am stricken by the similarity of the method Wolfram is proposing and the spirit of the the approach we seem to be taking in grappling with Mathematica. Very stimulating! https://www.youtube.com/live/ITJ3AF3TK5M?si=rECCBuBAAVWa_Im4
|
|
Steven/Arben - I too am getting the INCORRECT result. I am also running Mathematica 14.0.0 on Mac silicon. (This might also explain some of the results I have been getting!)
I create a notebook and set y = ax^2 + bx + c. I then try Expand[y^2] and get the following:
ax^4 + 2 ax^2 bx + bx^2 + 2 ax^2 c + 2 bx c + c^2
I have attached my notebook and an image making it clear what element is incorrect in Mathematica's answer.
Attachments:
|
|
PROBLEM PROBLEM PROBLEM When I create a notebook and try y = ax^2 + bx + c, then Expand[y^2] gives ax^4 + 2 ax^2 bx + bx^2 + 2 ax^2 c + 2 bx c + c^2 in my notebook, which is incorrect, while yours has c^2 + 2 b c x + b^2 x^2 + 2 a c x^2 + 2 a b x^3 + a^2 x^4 which is correct. I'm, using Mathematica 14.0.0 on Mac silicon. Here is my notebook
|
|
More info:
When I do "y = ax^2 + bx + c", with explicit asterisk, then Expand[y^2] is correct
c^2 + 2 b c x + b^2 x^2 + 2 a c x^2 + 2 a b x^3 + a^2 x^4 Note: The preview removes the explicit asterisks. What works is
y = a asterisk x^2 + b asterisk x + c
|
|
Write "a x" with a space between a and x. Mathematica interprets the space as a multiplication.
|
|
Addendum to Lara's explanation: "ax" is read as one symbol, as opposed to "a x" which is read (in the example case) as two distinct symbols of a numeric type, so the space is interpreted by Mathematica as an implied multiplication.
|
|
I don't believe this is a space issue. The notebook shows input (w/o spaces) and the incorrect output.
|
|
Hey Coe—I'm not sure what you mean. The attached notebook is missing the spaces between the coefficients and thus produces the incorrect output. You want:
y=a x^2+b x+c
or, explicitly:
y=a*x^2+b*x+c
in order to get the correct polynomial expansion. @ Steve, you can type your code between two backticks to prevent it from formatting via markdown, which is why the asterisks are being used for formatting rather than displaying.
|
|
When I enter everything without spaces I get the wrong answer. When I enter WITH explicit asterisks, I get the right solution. The attached image shows what is entered and the result.
Attachments:
|
|
Steven - I get the correct answer when using explicit multiplication:
y = a*x^2 + b*x + c
Why is this? Arben?
|
|
To be absolutely clear: this is equivalent to asking why var^2 does not return v^2 a^2 r^2 . If you don't type a space or an asterisk between two letters, there's no way for the system to know that you're talking about two separate symbols.
|
|
Bang head with hand. I forgot. Thanks.
|
|
It can happen even after a decade of using the language—I was once thwarted for an entire day by an errant curly/("""smart""") quote breaking a string expression when I first start working here!
|
|
Another way of saying the same thing: Mathematica is taking ax^2 to mean (ax)^2. This can be seen by asking for the FullForm. In terms of today's lesson: AtomQ[ax] returns True , AtomQ[a x] returns False.
|
|
Hi Arben, Would please clarify the following terms: vector, array, matrix, expression?
And regarding the docs, what's the difference between options and properties in a function?
|
|
When I'm using those terms, I mean:
- Vector: something that you can describe with 1 index. It could have a length of 2 or a million, but you could get any singular element out of it by doing
vec[[n]] .
- Matrix: something that needs two indices to get any individual elements from: say, the element at the first row and third column could be accessed with
mat[[1,3]] .
- Tensor: generic term for anything where you'd need more indices to describe the position of a single element. Note that this is not really an appropriate definition in the physics sense, but I'm being a little loose with it. You can think of them as the general case of the special "one-index" and "two-index" cases of "vector" and "matrix", respectively.
- Expression: any sort of singular "thing" in Wolfram Language—that is, anything that's not a sequence like
a,b . a is an expression, Plot[x,{x,0,5}] is an expression, and so on.
You can see more of the fun of conflicting definitions here.
|
|
I thought I understood this material during the lecture; most things made sense. Some parts of Problem 1 however just don't seem right. For example, why does pat3 give the following result?
exprs = {1, h[], h[a], h[b], h[a, b], h[a, a], h[a, b, c], g[h[a, b]]}
pat3 = x_
Cases[ exprs, pat3]
{1, h[], h[a], h[b], h[a, b], h[a, a], h[a, b, c], g[h[a, b]]}
I see no way to get this result. Thanks in advance,
|
|
pat3 is x_ , which means "any one thing—call it x ." Every element of exprs is just a single thing, so they all match. Because we're not using that x anywhere, this pattern is equivalent to just _ , i.e. "any one thing".
We might see a named pattern like x_ in a standard function definition:
f[x_]:=x^3
The x on the LHS has nothing to do implicitly with the "any one thing" denoted by the _ . The x is just a dummy name that we give to that one thing (the one thing that appears in f 's brackets) so that we can refer to it on the RHS. Consider the example:
f[x_]:=5
There's no mention of x on the RHS, so it's pointless to even name it on the LHS (in some sense.) It would be exactly the same to instead say:
f[_]:=5
The point is that "f of any one thing" should be 5 . We don't care about the input here, so why bother to name it if we're never going to use it? In this sense, we are saying that f is a transformation rule that takes anything of the form "f of any one input, and I don't care what that input is" and returns 5 .
|
|
My apologies folks, I mis-wrote the equality that I am asking about. Again -
In today's post-lecture questions "pat2 = _h" Case tells me that pat2 matches the following elements in exprs:
{h[], h[a], h[b], h[a, b], h[a, a], h[a, b, c]}
Does this mean that **pat2 = _h = h_**? It seems like it, but this seems odd to me in that we are PATTERN MATCHING and, it seems to me, elements in one order should not necessarily be equivalent to elements in a different order.
Comment?
|
|
pat2 is _h , which explicitly means: "any one thing with head h ". This is not the same as h_ , which means "any one thing—call it h ". It is (except for perhaps some pathological edge cases) the same as h[_] , which is "h of any one thing."
|
|
In today's post-lecture questions "pat2 = _h"
Case tells me that pat2 matches the following elements in exprs:
{h[], h[a], h[b], h[a, b], h[a, a], h[a, b, c]}
Does this mean that pat2 = h = h? It seems like it, but this seems odd to me in that we are PATTERN MATCHING and, it seems to me, elements in one order should not necessarily be equivalent to elements in a different order. Comment?
|
|
question = "If Mathematica is a term rewriting system, when I write a programme in Mathematica, am I writing a term rewriting rule, and is the programme a function?"; If[question==={"yes", "yes"}, "At what point does a rule become a system?","Help!"]
|
|
Yes! The evaluation system is effectively a huge database of pattern-matching term-rewriting rules. For example, think about:
D[x^3,x]
We know that this is "the derivative of x cubed with respect to x", and we know that when we see this pattern—the derivative of x^n_ , if you will—that we should take the power, drop it to the front, and then subtract 1 from the power. The Wolfram system is effectively doing the same thing: it sees that something matches the pattern D[x^n_,x] and says what we do: "I know what to do when I see that: D[x_n,x] :> n*x^(n-1) and that's what's returned to us. When you write your own functions, you are effectively adding to this database of term-rewriting rules (and are often using those rules as foundations for your own definition). In this way, any program you write is just about matching patterns and transforming the appropriate ones into something new.
|
|
Wonderful explanation! I'm going to give this more thought. I'm trying to get my head around Wolfram engine.
|
|
Anyone grok this list operation: Alphabet[][[;; 10 ;; 4]]
I understand Alphabet[]
I understand Alphabet[] [[;;10]]
I understand Alphabet[] [[;;4]]
I do not grok what's happening when the 2nd and 3rd statements are combined. I thought the ";;" operation acted like a pipe. The solution {a, e, i} isn't what I think a pipe should give.
|
|
Hey Coe, could you be a little clearer in your description of your inputs, their actual outputs, and the outputs you would expect? In the meantime, let me explain the meaning of each line you've included here.
Alphabet[][[;;10;;4]]
This is equivalent to Alphabet[][[1;;10;;4]] . This means "starting with the list of all of the letters in the (Latin) alphabet, take the first through the tenth elements in steps of 4." I.e., that's elements 1,1+4,1+4,+4===1,5,9 . (You don't go to 13 since the initial list only has 10 elements.) And indeed, that's what this code does—cf. MapIndexed[#2[[1]] -> #1 &, Alphabet[]] or Thread[Range@26 -> Alphabet[]] to see it directly. Actually, I see what you were initially asking. I think the above sufficiently clarifies it, but "in order":
Alphabet[] provides a list containing the characters of the Latin alphabet
- Appending
[[;;10]] is the same as appending [[1;;10]] and is extracting the 1 st through 10 th parts of the list containing the alphabet
- Similarly, appending
[[;;4]] is equivalent to appending [[1;;4]] and is extracting the 1 st through 4 th parts of the list containing the alphabet
Doing [[a;;b;;c]] is not the same as doing [[a;;b]][[;;c]] . The "sandwich" construction specifically means "go from a to b in jumps of size c "; it's different from "chaining" ;; /Span commands through [[ ]] /Part .
|
|
Hello Coe! Arben's explanation made me want to see it in color. This is what came of it. I hope it helps.
PLEASE SEE THE NOTEBOOK ATTACHED TO THIS COMMENT
Have fun!
Attachments:
|
|
Thanks for teaching and I look forward to gaining new insight and learning the various facets of the Wolfram Language and learning to code with Mathematica. The course in this series labeled with #34 for the most part was attended, although completion of the course-work is latent. Hastily, without having differentiated or juxtaposed the two sets of files, I'm wondering about the development or difference thereof. Also, is this the appropriate place to provide commentary or share what you are learning or problems that you may be stuck on in the sense of posing a problem that is confounding? For the sake of convenience, I have the following two lines for reference with the time zone set to GMT-8 for current locale the default being +1 given the supposed original temporal datum or original time where it is that the Vatican City state is presently, as well as central Europe and Scandinavia. This is just for contrasting disparate times along the lines of DateObject[] and use of SolarTime[] and MoonPosition[] for scheduling, thinking with respect to calendrical arithmetic or geo-computation for arranging one's day according to a plan in the sense of avoiding scheduling conflicts and slotting time around attendance of the course.
Transpose@{Alphabet["Greek"][[1;;10]]//Capitalize,(QuantityMagnitude/@Table[(a-DateObject[List[1,1,11,0,0,0],"Instant","Gregorian",1.`]),{a,{DateObject[{2024,1,29,9,0,0}],DateObject[{2024,1,30,9,0,0}],DateObject[{2024,1,31,9,0,0}],DateObject[{2024,2,1,9,0,0}],DateObject[{2024,2,2,9,0,0}],DateObject[{2024,2,5,9,0,0}],DateObject[{2024,2,6,9,0,0}],DateObject[{2024,2,7,9,0,0}],DateObject[{2024,2,8,9,0,0}],DateObject[{2024,2,9,9,0,0}]}}])//Ceiling//FactorInteger}//Grid
and also
TableForm[Transpose[List[List["Lists and Associations","Assignments, Rules and Patterns","Syntax and Expressions","Writing a Program","Good Coding Practices","Interfaces and Deployment","Working with Data, Part I","Working with Data, Part II", "Developing Packages","Review Session"],List[DateObject[{2024,1,29,9,0,0},"Instant","Gregorian", -8.`],DateObject[{2024,1,30,9,0,0}, "Instant", "Gregorian", -8.`], DateObject[{2024,1,31,9,0,0}, "Instant","Gregorian",-8.`],DateObject[{2024,2,1,9,0,0},"Instant","Gregorian",-8.`],DateObject[{2024,2,2,9,0,0},"Instant","Gregorian",-8.`],DateObject[{2024,2,5,9,0,0},"Instant","Gregorian",-8.`],DateObject[{2024,2,6,9,0,0}, "Instant", "Gregorian", -8.`],DateObject[{2024,2,7,9,0,0}, "Instant", "Gregorian",-8.`],DateObject[{2024,2,8,9,0,0},"Instant","Gregorian",-8.`],DateObject[{2024,2,9,9,0,0}, "Instant","Gregorian", -8.`]]]]]
With respect to this is the question of how to seamlessly integrate sharing of snippets of code like this in and that within Wolfram|One this was drafted and then the sequence was right click the "cell object delineator" (For lack of the proper term, assuming that is the incorrect phrase or string for a potential association) and then through the "drop down menu" "Plain Text" was selected and then "Alt + Tab" to navigate to Notepad and then "Ctrl + V" in the window after left clicking and then copying again via the aforementioned technique and then tabbing or repeatedly using the "Alt + Tab" macro/technique or combined key-press selecting the Microsoft Edge window and then again (As with Notepad via Windows 11) left-clicking and then pasting or using the "Ctrl + V" key-combination after left-clicking. This is rather cumbersome and tedious in the sense of efficacy with respect to the users resource of time (Avoiding philosophical subtleties with respect to the complexity classes and dichotomy in the sense of Kolmogorov & also the power tower or sequential binary operation, to provide an errant opinion in the mode of assumption). Perhaps accessing this page from within the Mathematica console or the Wolfram|One program such as what was mentioned earlier with external APIs in some way navigating a directory safely and in a maximally efficient manner with respect to augmentations such as keypress (Again, lacking the lingo or appropriate terminology with respect to this programming language or the sequence of expressions in the sense of algorithm). One question is about accessing this course via BigMarker through a secure channel or learning about ports and other nuanced aspects in the sense of being conservative with data and being able to readily upload information through the WDF or contribute in real-time to the Wolfram Function Repository without removing attention from the lecture such as with alternate channels of data in the sense of active execution for formatting and the like. Hopefully, I can provide less loquacious or verbose inquiries, yet the actual procedure of the computer program (I assume algorithm is correct in the sense of encapsulating it lexically or calling it by one word, as I imagine that I may do if there is audio programming and "calling" the server/use of the kernel involves univocal definitions and sensitivity in terms of attenuation) is what I'm curious about and I've deviated from solving the puzzles or producing a solution set, to my own detriment. Given that so much time is spent with low-level calculations in Mathematica such as the above, a curiosity is with more compact functions such as with the pure function or defining the concept parametrically (Only having a vague notion of that at present, in the sense of a region that may be implicit, explicit, or parametric, according with abstract or universal geometry [rudimentary mathematical constructions and later demonstrations is a crucial project at present with developing thinking methodically or discerning the methodology, which I think that the Documentation Center does a good job of as it is worded, that I've noticed up until now, although one curiosity, further still, tangentially, is about the LinkSnooper and modifying the formatting with notebooks for stylesheets and whatnot. CloudDeploy[] was noted at 0713 0750 0203 and APIFunction[] on 0863 that date, although I currently lack knowledge of their utility with respect to rough outline of the aforementioned project, failin to attend/being truent for the course on May 16, 2023 on Programming Fundamentals. There is a wonder from 11439 about notation and Boolean Algebra with nn*ee, b^^nnnn, &&, ||, !, and <> about Element[] for the atomic expressions and use of Distributed[], UndirectedEdge[], DirectedEdge[] for Galois Theory (Which was, FiniteField[] and the related group theoretic constructs, experimental as of version 13.3.0) with there a curiosity about Polynomial Algebra and the S- and K-combinatorics with the Chief Executive Officer expounding work from December 1920 (Find WikipediaData@"Combinatory Logic" for a more concise elaboration) and use of bit-vectors in the aforementioned sense of a directory and efficacious navigation through WolframScript via the command line without a graphical interface. 738904.0199
|
|
Hey Arben, I've not used associations before and I am trying to imagine what is their superpower. I'm not really a software writer, I just play one when I'm trying to study or solve engineering problems. One idea that jumps off the page is using a list of variable value assignments that can be summoned in a program without actually defining the variables outside of the context of the operation using them. That's kind of neat. I'd have to try that out and see if it makes a program easier to write or understand. But I suspect that's just the tip of the iceberg (as is everything else in the Wolfram language). What do you say is the superpower in using associations?
|
|
Hey Carl! Indeed, you can think of associations as constituting some "local map" between keys and values (and indeed, that might be part of the reason why they can be "indexed" with single brackets like functions can, though this is just a wild guess). The primary value of associations in my view comes from the the organizational structure. For example, suppose I have a nested association:
scores=<|"Bob"-><|"Geography"->100,"Mathematics"->80,"Chemistry"->90|>,
"Alice"-><|"Geography"->90,"Mathematics"->100,"Chemistry"->85|>,
"Carol"-><|"Geography"->Missing["Absent"],"Mathematics"->100,"Chemistry"->95|>|>,
Now, without needing to remember which student or score is where, I can do something like:
scores["Bob"]
or:
scores["Bob","Chemistry"]
or:
scores[[All,"Mathematics"]]
This can be very useful for obvious reasons, especially as datasets get larger and more complicated. We'll discuss this more later in the course, but you may recall that pure functions work with numbered, unnamed slots:
#1+#2&[a,b]
returns:
a+b
But this isn't the only way they can work—they can work with slots named by keys as well:
#cat+#dog&[<|"cat"->1,"dog"->2|>]
will return 3 . This lets you write code that not only extracts the appropriate parts very easy, but performs various queries in a super readable and simple way. For example, the following code will select any students who have a chemistry score of 90 or higher:
Select[scores,#Chemistry≥90&]
Finally, from a technical perspective, it is faster to add or remove key-value pairs to an association than to add or remove elements with a list. This doesn't really crop up at the example scales we're talking about here, but can have an effect at larger sizes.
|
|
Hi arben,
Yes this is the tip of iceberg. I suggest you hash table as something to know. O(1) as a search algorithm. Hash tree and topology is a rich context to know
|
|
Hi everybody—I've added today's "filled-out" notebook to the materials folder. See you tomorrow!
|
|
The link in the email I received doesn't work. How do I navigate to the materials folder? I looked around and didn't see an obvious link.
|
|
Arben, how do I post without replying to someone else's post (like I am doing now)? I do have a question about Riffle[ ].
Riffle[{1,2,3}, {x, y}]
outputs {1,x,2,y,3}, understandably. But
Riffle[{x,y}, {1,2,3}]
outputs {x,1,y}. Why? I would have expected to get {x, 1, y, 2}. Thanks.
|
|
Daily recordings will be shared with the group each day, so you can catch up on any sessions you miss. Looking forward to it!
|
|
I can't make it at this time on MWF, but can on TTh.
|
|
Day 7: Found the notebook to download but not the "data" file. Where can I get this?
|
|
Almost missed this down at the bottom of the thread, but the amoeba folder should now have a data folder there!
|
|
Reply to this discussion
in reply to
Group Abstract
|