Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% hw5_steepdes.m | |
% | |
% Math 571 HW 5 Q1. | |
% | |
% Script to compute and plot objective function value, norm of gradient of f(x), number of function and gradient evaluations, and runtime of using steepest descent method with backtracking line search to minimize | |
% f(x) = e^T* (e + A_1*(D_1*x + d_1).^2) + A_2*(D_2*x + d_2).^2).^1/2) | |
load 'MinSurfProb.mat' | |
tic; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% hw5_newtoncg.m | |
% | |
% Math 571 HW 5 Q1. | |
% | |
% Script to compute and plot objective function value, norm of gradient of f(x), number of function and gradient evaluations, and runtime of using Newton CG to minimize | |
% f(x) = e^T* (e + A_1*(D_1*x + d_1).^2) + A_2*(D_2*x + d_2).^2).^1/2) | |
% CG finds descent direction p_i that are conjugate to each other when | |
% iterating x_k+1 = x_k + alpha*p_k | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First we get our data. | |
mydata <- read.table("usparty.txt") | |
names(mydata) # Lets us see all the variable names. | |
#attach(mydata) # This puts the variable names in memory. We will not be using this. | |
mysubsetdata<-subset(mydata, select=c(YEAR, MTOTCONG)) #This keeps only the two variables that we need. | |
summary(mysubsetdata) # Since no variables are listed, a summary for all variables in the data frame is printed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"YEAR" "RCONG" "DCONG" "RPRES" "DPRES" "G" "PRCONT" "PDCONT" "TOTPRES" "TOTCONG" "RREP" "DREP" "TR" "INFLAT" "PREVINFL" "PREVGNP" "GNP" "TOTPOP18" "ELIGIBLE" "MRCONG" "MDCONG" "MRPRES" "MDPRES" "MTOTCONG" "MTOTPRES" "MTR" "VRCONG" "VDCONG" "VRPRES" "VDPRES" "VTOTCONG" "VTOTPRES" "VTR" "LMRCONG" "LMDCONG" "LRREP" "LDREP" "REPRATIO" "DRATIO" "RRATIO" "REPSHIFT" "MRATIO1" "MRATIO2" "ON" "ONR1" "ONR2" "OND1" "OND2" "ON1" "ON2" "OFF" "OFF1" "OFF2" "PRESDIF" "RPRESDIF" "LRPDIF" "LPRESDIF" "LMTCONG" "DIFOYTC" "SHIFT" "FDR" "CPOINT" "CPCGNP" "CGNP" "LGNP" "LINFLAT" | |
"1" 1896 6845000 6339000 7102246 6492599 1 1 0 13907000 14652000 244 105 0 25 25 62.6 61.3 40981000 19332000 0.354076143182288 0.327901924270639 0.367382888475067 0.335847248086075 0.757914338919926 0.719377198427478 0 0.467171717171717 0.432637182637183 0.484728774228774 0.443120324870325 1 0.9491536991537 0 NA NA NA NA 0.398280802292264 0.300859598853868 0.699140401146132 NA 0.757914338919926 0 1 1 0 1 0 1 0 0 0 0 1.63126631434887e-09 1.63126631434887e-0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 与同学写的二叉搜索树(Binary Search Tree), 只是一部分用来做一个类似facebook的terminal程序。课程期末项目。 | |
public class BSTFaceIndex { | |
Node root; //represents the first Profile in the BST | |
//constructor to initialize BST | |
public BSTFaceIndex() { | |
root = null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ACM 比赛 https://open.kattis.com/problems/secretmessage | |
import sys | |
import math | |
strings = [s.strip() for s in sys.stdin.readlines()] | |
for i in range(1,int(strings[0]) + 1): | |
# find input size for matrix and number of characters for each word in sentence | |
s = strings[i] |