Showing posts with label Programming languages. Show all posts
Showing posts with label Programming languages. Show all posts

Sunday, November 8, 2026

Python Programming Language - Tutorials



The principal disadvantage of MATLAB against Python are the costs. Python is completely free, whereas MATLAB can be very expensive. Python is a very attractive alternative of MATLAB: Python is not only free of costs, but its code is open source. Python is continually becoming more powerful by a rapidly growing number of specialized modules.


Python tutorial: https://www.tutorialspoint.com/python/index.htm

--------------

http://www.python-course.eu/course.php


http://www.python-course.eu/python3_course.php


http://www.python-course.eu/advanced_topics.php

http://www.python-course.eu/numerical_programming.php

http://www.python-course.eu/python_tkinter.php


Ud 1 June 2021
Pub 12.6.2016

Friday, May 13, 2016

R Language - Matrix and Array Related Commands



Array has dimensions. A vector is an array with  only one dimension. An array with two dimensions is a matrix.
Anything with more than two dimensions is simply called an array.

Technically, a vector has no dimensions at all in R. If you use the functions dim(), nrow(), or ncol(),  with a vector as argument, R returns NULL as a result.



Creating matrix

use the matrix() function.

The matrix() function has arguments to specify the matrix.
data is a vector of values you want in the matrix.
ncol takes a single number that tells R how many columns you want.
nrow takes a single number that tells R how many rows you want.
byrow takes a logical value that tells R whether you want to fill the matrix rowwise
(TRUE) or column-wise (FALSE). Column-wise is the default.

You don’t have to specify both ncol and nrow. If you specify one, R will know automatically what the other needs to be.

You can look at the structure of an object using the str() function.

If you want the number of rows and columns without looking at the structure, you can use the
dim() function.

You can find the total number of values in a matrix exactly the same way as
you do with a vector, using the length() function:

To see all the attributes of an object, you can use the attributes() function

You can combine both vectors as two rows of a matrix with the rbind() function,

The cbind() function does something similar. It binds the vectors as columns of a matrix,

you have the functions rownames() and colnames().  Both functions work much like the names() function you use when naming vector values.



Calculating with Matrices


You add a scalar to a matrix simply by using the addition operator, +,

With the addition operator, you can add both matrices together,  if the
dimensions of both matrices are not the same, R will complain and refuse to carry
out the operation

By default, R fills matrices column-wise. Whenever R reads a matrix, it also
reads it column-wise.

Transposing a matrix
The t() function (which stands for transpose) will do  the work

To
invert a matrix, you use the solve() function

The multiplication operator (*) works element-wise on matrices. To calculate
the inner product of two matrices,  use the special operator %*%,



Reference

R for Dummies by Vries and Meys
chap 7

R Language - Date and Time Related Commands

Working with dates in R

R has a range of functions that allow you to work with dates and times. The
easiest way of creating a date is to use the as.Date( ) function.

The default format for dates in as.Date( ) is YYYY-MM-DD
— four digits for year, and two digits for month and day, separated by a
hyphen.

To find out what day of the week this is, use weekdays():

You can add or subtract numbers from dates to create new dates.

use the seq( ) function to create sequences of dates in a far more
flexible way. As with numeric vectors, you have to specify at least three of the
arguments (from, to, by, and length.out).

In addition to weekdays( ), you also can get R to report on months() and
quarters( ):

Functions with Dates

Function
Description
as.Date()
Converts character string to Date
weekdays()
Full weekday name in the current locale (for example, Sunday, Monday, Tuesday)
months()
Full month name in the current locale (for example, January, February, March)
quarters()
Quarter numbers (Q1, Q2, Q3, or Q4)
seq()
Generates dates sequences if you pass it a Date object as its first argument


Objects that represent time series data.

ts: In R, you use the ts() function to create time series objects. These
are vector or matrix objects that contain information about the observations,
together with information about the start, frequency, and end of each
observation period. With ts class data you can use powerful R functions to do
modeling and forecasting — for example, arima() is a general model for time
series data.


Reference Book

R for Dummies, Vries and Meys
Chap 6

Thursday, May 12, 2016

R Language Commands - Input and Display



# is for comments
R ignores everything that appears after the hash (#).
The assignment operator is symbol for less than followed by hash. (The blogger is creating a problem by giving strange interpretation of the symbol.)
#read files with labels in first row
read.table(filename,header=TRUE)           #read a tab or space delimited file
read.table(filename,header=TRUE,sep=',')   #read csv files

<- a="" c="" create="" data="" elements="" nbsp="" p="" specified="" vector="" with=""><- 1="" a="" c="" create="" data="" elements="" nbsp="" p="" to10="" vector="" with=""><- 10="" p=""><- a="" c="" create="" deviates="" item="" n="" nbsp="" normal="" of="" p="" random="" rnorm="" vector=""><- a="" added="" c="" create="" distribution="" each="" has="" item="" n="" nbsp="" p="" random="" runif="" that="" to="" uniform="" vector=""><- binomial="" create="" from="" n="" nbsp="" of="" p="" prob="" probability="" rbinom="" samples="" size="" the="" with=""><- and="" c="" combine="" into="" length="" nbsp="" of="" one="" p="" vector="" vectors="" x="" y=""><- 2="" a="" and="" cbind="" combine="" into="" matrix="" n="" nbsp="" p="" x="" y="">

mat[4,2]                                   #display the 4th row and the 2nd column
mat[3,]                                    #display the 3rd row
mat[,2]                                    #display the 2nd column


subset(dataset,logical)                    #those objects meeting a logical criterion
subset(data.df,select=variables,logical)   #get those objects from a data frame that meet a criterion
data.df[data.df=logical]                   #yet another way to get a subset
x[order(x$B),]                             #sort a dataframe by the order of the elements in B
x[rev(order(x$B)),]                        #sort the dataframe in reverse order

browse.workspace                           #a Mac menu command that creates a window with information about all variables in the workspace


Details




Input and display
#read files with labels in first row
read.table(filename,header=TRUE)           #read a tab or space delimited file
read.table(filename,header=TRUE,sep=',')   #read csv files

x <- a="" c="" create="" data="" elements="" nbsp="" p="" specified="" vector="" with="">To construct a vector
 > c(1,2,3,4,5)
[1] 1 2 3 4 5

y <- 1="" a="" c="" create="" data="" elements="" nbsp="" p="" to10="" vector="" with="">
> x <- 1:5="" nbsp="" p="">> x
[1] 1 2 3 4 5

assign the values 1:5 to a vector named x:
> x <- 1:5="" p="">> x
[1] 1 2 3 4 5

n <- 10="" p="">x1 <- a="" c="" create="" deviates="" item="" n="" nbsp="" normal="" of="" p="" random="" rnorm="" vector="">y1 <- a="" added="" c="" create="" distribution="" each="" has="" item="" n="" nbsp="" p="" random="" runif="" that="" to="" uniform="" vector="">z <- binomial="" create="" from="" n="" nbsp="" of="" p="" prob="" probability="" rbinom="" samples="" size="" the="" with="">vect <- and="" c="" combine="" into="" length="" nbsp="" of="" one="" p="" vector="" vectors="" x="" y="">

mat <- 2="" a="" and="" cbind="" combine="" into="" matrix="" n="" nbsp="" p="" x="" y="">mat[4,2]                                   #display the 4th row and the 2nd column
mat[3,]                                    #display the 3rd row
mat[,2]                                    #display the 2nd column


subset(dataset,logical)                    #those objects meeting a logical criterion
subset(data.df,select=variables,logical)   #get those objects from a data frame that meet a criterion
data.df[data.df=logical]                   #yet another way to get a subset

x[order(x$B),]                             #sort a dataframe by the order of the elements in B
x[rev(order(x$B)),]                        #sort the dataframe in reverse order

browse.workspace                           #a Mac menu command that creates a window with information about all variables in the workspace


Rules of Names of Variables, Vectors and Matrices in R

Names must start with a letter or a dot. If you start a name with a dot, the
second character can’t be a digit.

Names should contain only letters, numbers, underscore characters (_),
and dots (.). Although you can force R to accept other characters in names, you
shouldn’t, because these characters often have a special meaning in R.
You can’t use the following special keywords as names:
• break
• else
• FALSE
• for
• function
• if
• Inf
• NA
• NaN
• next
• repeat
• return
• TRUE
• while


Sunday, July 15, 2012

C++ Interview Questions and Answers - Collection

Java Interview Questions and Answers - Collection

Monday, April 30, 2012

DART - A New Programming Language for Structured Web Programming



11.9.2011

Google engineers, Lars Bak and Gilad Bracha will make presentations on the new programming language, DART, a language for structured web programming at the international software development conference 2011 at Aarhus during 10-12 October 2011.

Announcement of the presentations in the conference


News items on the presentation

http://news.cnet.com/8301-30685_3-20103843-264/google-to-debut-dart-a-new-language-for-the-web/

http://www.informationweek.com/news/development/web/231601140

Related Information

Programming language rankings
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html


Original knol - 5658

Sunday, April 29, 2012

Saturday, April 28, 2012

The Great Indian Programming League


 
 
 
Show your programming talent
 
___________
 
 
___________
 
Participate today.
Knol - 5029