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
# -*- coding: utf-8 -*- | |
#Stephen Krol | |
#Funciona con Python 2.6.x | |
#Metodo de secante | |
#Lab 3 | |
c=0 # contador | |
# Asumiendo que la entrada debe de ser menor que 250 °C |
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
/** | |
* @author Stephen Krol | |
*/ | |
package org.mlea; | |
import android.app.Activity; | |
import android.location.Location; | |
import android.location.LocationManager; | |
import android.os.Bundle; | |
import android.view.View; |
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
/** | |
* @author Stephen Krol (mlea) | |
*/ | |
package org.mlea; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.location.GpsSatellite; |
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
import stamp.core.*; | |
/** PWM Controller class | |
* in main: enter to a mainloop , command from the serial | |
* is using pwm to control a dc motor | |
*/ | |
class PwmMotorController { | |
PWM pwm; | |
char command; |
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
int pin = 11; | |
int val = 255; | |
int command; | |
void printMsg(){ | |
Serial.println("Welcome to speed controller"); | |
Serial.println(" type "); | |
Serial.println(" - z : to speed up "); | |
Serial.println(" - x : to speed down"); | |
Serial.println(" - s : set manually(submenu)"); |
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
function y = f(x,m) | |
% f esta funcion la funcion impulso rectangulo respresentado en sus serie | |
% de fourier y consta de M componentes, para llamar esta funcion f(x,m) | |
% donde x es el valor en la funcion y m el numero de componentes. | |
% Si quiere ver la funcion con sus cuatros componentes seria f(x,4) | |
% ejemplo, para graficar con 4 componentes: | |
% x = 0: .001 : 10; | |
% plot(x, f(x,4); | |
y = 0; | |
for i =1:m |
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
using System; | |
using System.Reflection; | |
using System.Data; | |
using System.Linq; | |
using System.Collections.Generic; | |
namespace DataTableTools | |
{ | |
static class DataTableTools | |
{ |
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
//Levenshtein distance. ->. "HolA".EditDifferences("Hola").Count() | |
//Optimal edit operations ->. "HolA".EditDifferences("Hola").Reverse() | |
// returns the list of operations as a 2-tuple (op_string, item) | |
// where op_string is "+" for insert, "-" deletions and "~" substitution | |
public static IEnumerable<(string, TSource)> EditDifferences<TSource>(this IEnumerable<TSource> input, IEnumerable<TSource> old){ | |
TSource[] s1 = input.ToArray(), s2 = old.ToArray(); //cache for random access | |
int[,] matrix = new int[s1.Count()+1, s2.Count()+1]; |
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
class AdjListStorage : Dictionary<uint, List<uint>> { | |
public static AdjListStorage Random(int nodes, float density = .5f){ | |
AdjListStorage storage = new AdjListStorage(); | |
List<uint> nodeIds = Enumerable.Range(0, nodes - 1).Select(Convert.ToUInt32).ToList(); | |
Random random = new Random(); | |
foreach(var nodeId in nodeIds) { | |
var edges = nodeIds.OrderBy(x => random.Next()).Take((int)(nodes*density)).ToList(); | |
storage.Add(nodeId, edges); |
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
// adj list graph representation: | |
const g = { | |
1: [2,3], | |
2: [4,3], | |
3: [5], | |
4: [1], | |
5: [] | |
}; |
OlderNewer