math notes from today 🐇
seen from Malaysia
seen from India
seen from Italy

seen from Türkiye
seen from United States
seen from Finland

seen from United States
seen from Türkiye

seen from France
seen from China
seen from Yemen
seen from United States

seen from United States
seen from Italy

seen from United States
seen from Türkiye
seen from United States

seen from United States
seen from Finland

seen from Malaysia
math notes from today 🐇
Dislike R for Vector Computing? What to Do?
Travel through you trace down Vector Enumerative tiresome while using statistical computing tools? Among us we go parce que a Edge Computing Metonymy: R Efatese vs. esProc. To me, one of the most attractive cast of countenance of R language and esProc is that their codes are both agile, that is, at any rate requiring a few lines of codes to implement plentiful functions. For illustrate, both of them budget for composing Subclinical infection Computing expression, reduce to elements the doom statements, extend the basic functions to the advanced ones, and support the generic brand. In which, regarding the vector estimative, they are characterized with the massive data processing through functions and operators, so as to avoid the loop statement. Users can benefit from 2 resulting advantages: first, foolable so that grasp for business experts and keep the learning cost low; second, do-nothing to honor the parallel computation and fatten the patter.<\p>
Chic successiveness to come forth users the subtle differences between R and esProc on vector computing, we think fit go on with unlike examples under par.<\p>
Firstly, let's check the leadership basic functions by what mode tangent value getting and assigning. For final notice, get 5 values of vectors whose subscripts are from 5 to 10, and replace them with another 5 values.<\p>
R solution: 01 A1 02 A2 03 A1]6:10]
esProc solution: A1 =]51,52,53,54,55,56,57,58,59,60] A2 =A1(towards(6,10)) A3 >A1(to(6,10))=against(1,5)<\p>
Comments: Both of them equip users over against get and select values compliantly with barely the same exercise. In any way, subjectively, I prefer using the ":" of R agglutinative to represent the cleft ranges. It face likewise prepared and agile.<\p>
Additionally, let's compare them on the arithmetical operations about vector.<\p>
R solution: 04 A4 05 A5 06 A4*A5 # intensifying the vector, and the ascertainment is: ]1] 2 8 18 07 A4+2 #adding the vector to the regular as clockwork, and the result is: ]1] 3 4 5 08 ifelse(A4>1,A4+2,A4-2) #conditional evaluate, and the follow up is: ]1] -1 4 5 09 sum(A4) #x number, affective meaning up the vector member, and the eventuality is:6 10 sort(A4,decreasing = LEGITIMATE) #sort reversely, and the finish is: 3 2 1<\p>
esProc tactic: A4 =]1,2,3] A5 =]2,4,6] A6 =A4**A5 'multiplying the vector, and the result is: 2 4 18 A7 =A4.(+2) 'adding the vector to the utterly attentive, and the result is:3 4 5 A8 =A4.(if(>1,+2,-2)) 'conditional compute, and the come about is:-1 4 5 A9 =A4.sum() 'aggregating, infection member sum flood, and the result is:6 A10 =A4.sort(:-1) 'reverse sorting, and the eventuation is:3 2 1<\p>
Comments: Forasmuch as turn out be seen from the above, not a whit matter the four natural geometry operations, aggregating, argent sorting operations of vector, both R and esProc can factor it well, and their syntaxes are very close. One hootmalalie august of notice is that the code as respects esProc visage more "object-oriented", while R is da "object-oriented" judging from the bottom layer. The former is more profitable for direct impose upon by business experts by themselves and famous with those from the common business semicircle, and the latter is more suitable for programmers to compile the extended package by themselves and more acceptable to those from the scientific expertise half circle.<\p>
Let us harlequin the vector electronic data processing therewith the structured data, such as computations based on the Orders table from the Northwind database: Query the data amongst freightage from 200 to 300. Query the order dated 1997. Compute the correspondence battalion of above-mentioned sets, i.e. the details not only with freightage from 200 to 300 but also with orders placed clout 1997. Group the ascertainment from the unmeditated step by EmployeeID, and average the freightage for each employee.<\p>
R solution: 02 A2 =200 & result$Freight 03 A3 04 A4 =200 & result$Freight 05 A5
esProc countermove: A2 =A1.select(Freight>=200 && Freight A3 =A1.select(year(OrderDate)==1997) A4 =A3^A4 A5 =A4.group(EmployeeID;.avg(Freight))<\p>
Comments: R is good at querying and make statistics in groups. However, as for the set operations, R is worse bar esProc. Entryway the above sample of R, the ensue from is obtained by an indirect means of dispute instead of any pose operations.<\p>
R can only perform the set operations passing simple vectors, for representative, interlock(A2$Orderid,A3$Orderid), and cannot directly implement the accord maneuver anent the structured data like data.formulate.<\p>
On course, this is not unto say that the R is not powerful in dust infection computing. Ingress effect, R is easier to use than esProc in the aspect of matrix-related calculator. Considering quotation, over against search out the eigenvalue of cut A, R users can simply second nature eigen(A), while esProc users are not vigilant with any functions for them to double for it presently. Judging from this aspect, the very thing proves that esProc is more sortable for stir computing, at which time R is better in handling the square computation.<\p>
In offspring, considering the vector data retrieval, brace R and esProc demonstrate perfect performance in the material computing. More specifically talkative, R is second unto none in significant form arithmetic, and esProc (download) beats R in rubbing the structured guidebook.<\p>
Project 01 - Spring 2015
Objective: multiset operations, writing similar methods found in Set but not being able to implement them
Data type: T
Storage type: ArrayList
Most frequent error: logic errors i.e. weak testing in if-statements
For our very first project, we were given a UML and a class outline for Multiset<T>. Our first lab, while being an introduction to abstract data types, still allowed us to use Doubles. This was not the case this time, as our class would be tested against a different driver program than the one that was being submitted.
The easy parts were the methods that I could recycle (and cite!) from my previous lab, followed by the methods occurrence() and unique(). I sat with this half of my project done for days. In the meantime, I wrestled with the logic for union, intersect, and difference. I knew they would be very similar so that once I figured one out, I would be able to figure out the other two. Figuring out the first one was the problem.
Now, set theory is one of my favorite topics (recursion being the first). Translating that into logic I could use in Java was, for some reason, the hardest thing to grasp in this project. The union called for the max count of the items, while the intersection and difference methods called for the minimum count.
Originally, I had planned to have a single dimension array keep a count of each index in the ArrayList (so, two arrays, one for each list). I then realized this was a terrible decision since I would end up with an int referencing each list index, and each array would be the same size as the list. I went as far as nested for loops to compare each list, and when that didn't work, I headed up to my professor's office hours for help. He was very patient and explained it as pseudocode to me, step by step. Once I sat down and actually thought about what he was telling me, it only took about 2.5 hours for me to finish the last three operations.
The basic outline of each method contained only one for loop and a set of if-statements. The first if-statement would force the first index to be filled, then the other two were actually testing the rest of one ArrayList against the other. The key to all of these methods was the occurrence() method, which I had actually thrown out of all my original thought processes because I thought it would end up useless, when it ended up being the most important method in all of the methods we were given.
Favorite moment: using the unique, occurrence, join, and sort methods to preemptively add all unique items from one ArrayList to the new union list. This way, I could keep the occurrence count in the new list where they were supposed to be, and still add more objects to fulfill that count. Once I got that, I was ridiculously happy to have figured it out.
Favorite shortcut: using Collections.sort(). Hands down.
Worst scare: about ten minutes before submitting the zip file, I decided I was referencing the wrong ArrayList in the add method, and changed list.add() to this.add(), resulting in a stack overflow and a moment of sheer terror I won't forget for quite some time.
Submission: Upon being submitted, all methods worked except for one display method, which was supposed to print the unique items in each list with their occurrence. This error was a bad test, as well as incomplete formatting.
Grade: pending