feat: add some electricity
This commit is contained in:
parent
c2141ad4f6
commit
83a024e72e
3
.obsidian/app.json
vendored
Normal file
3
.obsidian/app.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"legacyEditor": false
|
||||||
|
}
|
3
.obsidian/appearance.json
vendored
Normal file
3
.obsidian/appearance.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"baseFontSize": 16
|
||||||
|
}
|
1
.obsidian/community-plugins.json
vendored
Normal file
1
.obsidian/community-plugins.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
15
.obsidian/core-plugins.json
vendored
Normal file
15
.obsidian/core-plugins.json
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
"file-explorer",
|
||||||
|
"global-search",
|
||||||
|
"switcher",
|
||||||
|
"graph",
|
||||||
|
"backlink",
|
||||||
|
"page-preview",
|
||||||
|
"note-composer",
|
||||||
|
"command-palette",
|
||||||
|
"editor-status",
|
||||||
|
"markdown-importer",
|
||||||
|
"word-count",
|
||||||
|
"open-with-default-app",
|
||||||
|
"file-recovery"
|
||||||
|
]
|
1
.obsidian/hotkeys.json
vendored
Normal file
1
.obsidian/hotkeys.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
525
.obsidian/plugins/obsidian-latex-environments/main.js
vendored
Normal file
525
.obsidian/plugins/obsidian-latex-environments/main.js
vendored
Normal file
@ -0,0 +1,525 @@
|
|||||||
|
/*
|
||||||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
||||||
|
var __export = (target, all) => {
|
||||||
|
__markAsModule(target);
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __reExport = (target, module2, desc) => {
|
||||||
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
||||||
|
for (let key of __getOwnPropNames(module2))
|
||||||
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
||||||
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
var __toModule = (module2) => {
|
||||||
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||||
|
};
|
||||||
|
var __async = (__this, __arguments, generator) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
var fulfilled = (value) => {
|
||||||
|
try {
|
||||||
|
step(generator.next(value));
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var rejected = (value) => {
|
||||||
|
try {
|
||||||
|
step(generator.throw(value));
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
||||||
|
step((generator = generator.apply(__this, __arguments)).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/main.ts
|
||||||
|
__export(exports, {
|
||||||
|
default: () => LatexEnvironments
|
||||||
|
});
|
||||||
|
var import_obsidian3 = __toModule(require("obsidian"));
|
||||||
|
|
||||||
|
// src/settings.ts
|
||||||
|
var LatexEnvironmentsSettings = class {
|
||||||
|
constructor() {
|
||||||
|
this.defaultEnvironment = "multline";
|
||||||
|
this.customEnvironments = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function ensureSettings(loaded) {
|
||||||
|
var _a, _b;
|
||||||
|
const settings = new LatexEnvironmentsSettings();
|
||||||
|
settings.defaultEnvironment = (_a = loaded.defaultEnvironment) != null ? _a : settings.defaultEnvironment;
|
||||||
|
settings.customEnvironments = (_b = loaded.customEnvironments) != null ? _b : settings.customEnvironments;
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
// src/search.ts
|
||||||
|
var SearchCursor = class {
|
||||||
|
constructor(text, regex, _originalCaret) {
|
||||||
|
this.text = text;
|
||||||
|
this._originalCaret = _originalCaret;
|
||||||
|
if (regex instanceof RegExp) {
|
||||||
|
this.regex = regex;
|
||||||
|
} else {
|
||||||
|
this.regex = new RegExp(regex);
|
||||||
|
}
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
reset() {
|
||||||
|
this._from = this._originalCaret;
|
||||||
|
this._to = this._originalCaret;
|
||||||
|
this._caret = this._originalCaret;
|
||||||
|
}
|
||||||
|
findNext() {
|
||||||
|
const text = this.text.slice(this._caret);
|
||||||
|
const match = text.match(this.regex);
|
||||||
|
if ((match == null ? void 0 : match.index) == null) {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
this._from = this._caret + match.index;
|
||||||
|
this._to = this._caret + match.index + match[0].length;
|
||||||
|
this._caret = this._to;
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
findPrevious() {
|
||||||
|
const reverseRegex = new RegExp(`(?<full>${this.regex.source})(?!.*[\\r\\n]*.*\\k<full>)`, this.regex.flags);
|
||||||
|
const text = this.text.slice(0, this._caret);
|
||||||
|
const lastMatch = text.match(reverseRegex);
|
||||||
|
if ((lastMatch == null ? void 0 : lastMatch.index) == null || (lastMatch == null ? void 0 : lastMatch.groups) == null) {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
this._from = lastMatch.index;
|
||||||
|
this._to = lastMatch.index + lastMatch.groups.full.length;
|
||||||
|
this._caret = this._from;
|
||||||
|
return lastMatch;
|
||||||
|
}
|
||||||
|
to() {
|
||||||
|
return this._to;
|
||||||
|
}
|
||||||
|
from() {
|
||||||
|
return this._from;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/mathblock.ts
|
||||||
|
var MathBlock = class {
|
||||||
|
constructor(text, cursor) {
|
||||||
|
this.text = text;
|
||||||
|
const searchCursor = new SearchCursor(text, "\\$\\$", cursor);
|
||||||
|
this.startPosition = searchCursor.findPrevious() != null ? searchCursor.to() : 0;
|
||||||
|
searchCursor.reset();
|
||||||
|
this.endPosition = searchCursor.findNext() != null ? searchCursor.from() : text.length;
|
||||||
|
}
|
||||||
|
getEnclosingEnvironment(cursor) {
|
||||||
|
const beginEnds = new BeginEnds(this.text, this.startPosition, this.endPosition);
|
||||||
|
const environments = Array.from(beginEnds);
|
||||||
|
if (beginEnds.isOpen) {
|
||||||
|
throw new Error("unclosed environments in block");
|
||||||
|
}
|
||||||
|
const start = environments.filter((env) => env.type === "begin" && env.from < cursor).pop();
|
||||||
|
if (start === void 0) {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
const after = environments.filter((env) => env.from > start.to);
|
||||||
|
let open = 1;
|
||||||
|
let end;
|
||||||
|
for (const env of after) {
|
||||||
|
if (env.type === "begin") {
|
||||||
|
open++;
|
||||||
|
} else {
|
||||||
|
open--;
|
||||||
|
if (open === 0) {
|
||||||
|
end = env;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (end === void 0) {
|
||||||
|
throw new Error("current environment is never closed");
|
||||||
|
}
|
||||||
|
if (end.to < cursor) {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
name: start.name,
|
||||||
|
begin: start,
|
||||||
|
end,
|
||||||
|
contents: this.text.slice(start.to, end.from)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
static isMathMode(_cursor, _editor) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var BeginEnds = class {
|
||||||
|
constructor(text, start, end) {
|
||||||
|
this.text = text;
|
||||||
|
this.start = start;
|
||||||
|
this.end = end;
|
||||||
|
this.openEnvs = [];
|
||||||
|
this.search = this.getEnvCursor(this.start);
|
||||||
|
}
|
||||||
|
reset() {
|
||||||
|
this.search = this.getEnvCursor(this.start);
|
||||||
|
}
|
||||||
|
getEnvCursor(start) {
|
||||||
|
return new SearchCursor(this.text, /\\(?<beginEnd>begin|end){\s*(?<name>[^}]+)\s*}/m, start);
|
||||||
|
}
|
||||||
|
get isOpen() {
|
||||||
|
return this.openEnvs.length > 0;
|
||||||
|
}
|
||||||
|
[Symbol.iterator]() {
|
||||||
|
this.reset();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
next() {
|
||||||
|
const match = this.search.findNext();
|
||||||
|
const to = this.search.to();
|
||||||
|
if ((match == null ? void 0 : match.groups) == null || to > this.end) {
|
||||||
|
return { done: true, value: null };
|
||||||
|
}
|
||||||
|
switch (match.groups.beginEnd) {
|
||||||
|
case "begin": {
|
||||||
|
const current = {
|
||||||
|
name: match.groups.name,
|
||||||
|
type: "begin",
|
||||||
|
from: this.search.from(),
|
||||||
|
to: this.search.to()
|
||||||
|
};
|
||||||
|
this.openEnvs.push(current);
|
||||||
|
return {
|
||||||
|
done: false,
|
||||||
|
value: current
|
||||||
|
};
|
||||||
|
}
|
||||||
|
case "end": {
|
||||||
|
const current = this.openEnvs.pop();
|
||||||
|
if (current === void 0) {
|
||||||
|
throw new Error("closing environment which was never opened");
|
||||||
|
}
|
||||||
|
if (current.name !== match.groups.name) {
|
||||||
|
throw new Error("environment not closed properly");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
done: false,
|
||||||
|
value: {
|
||||||
|
name: match.groups.name,
|
||||||
|
type: "end",
|
||||||
|
from: this.search.from(),
|
||||||
|
to: this.search.to()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`regex returned unexpected result ${match[1]}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/envmodal.ts
|
||||||
|
var import_obsidian = __toModule(require("obsidian"));
|
||||||
|
|
||||||
|
// src/environmentNames.ts
|
||||||
|
var DISPLAY_EQUATIONS = [
|
||||||
|
"equation",
|
||||||
|
"equation*",
|
||||||
|
"gather",
|
||||||
|
"gather*",
|
||||||
|
"multline",
|
||||||
|
"multline*",
|
||||||
|
"split",
|
||||||
|
"align",
|
||||||
|
"align*",
|
||||||
|
"flalign",
|
||||||
|
"flalign*",
|
||||||
|
"alignat",
|
||||||
|
"alignat*"
|
||||||
|
];
|
||||||
|
var MATRICES = [
|
||||||
|
"matrix",
|
||||||
|
"pmatrix",
|
||||||
|
"bmatrix",
|
||||||
|
"Bmatrix",
|
||||||
|
"vmatrix",
|
||||||
|
"Vmatrix",
|
||||||
|
"smallmatrix"
|
||||||
|
];
|
||||||
|
var SUB_ENVIRONMENTS = ["multlined", "gathered", "aligned", "cases"];
|
||||||
|
var DEFAULT_ENVIRONMENTS = [
|
||||||
|
...DISPLAY_EQUATIONS,
|
||||||
|
...MATRICES,
|
||||||
|
...SUB_ENVIRONMENTS
|
||||||
|
];
|
||||||
|
|
||||||
|
// src/envmodal.ts
|
||||||
|
var EnvModal = class extends import_obsidian.FuzzySuggestModal {
|
||||||
|
constructor(app, settings, name, callback) {
|
||||||
|
super(app);
|
||||||
|
this.settings = settings;
|
||||||
|
this.name = name;
|
||||||
|
this.callback = callback;
|
||||||
|
this.matched = false;
|
||||||
|
this.setInstructions([
|
||||||
|
{ command: "\u2191\u2193", purpose: "to navigate" },
|
||||||
|
{ command: "\u21B5", purpose: "to select" },
|
||||||
|
{ command: "esc", purpose: "to dismiss" }
|
||||||
|
]);
|
||||||
|
this.setPlaceholder("environment name");
|
||||||
|
}
|
||||||
|
getItems() {
|
||||||
|
return Array.from(new Set([this.settings.defaultEnvironment].concat(this.settings.customEnvironments, DEFAULT_ENVIRONMENTS)));
|
||||||
|
}
|
||||||
|
getItemText(item) {
|
||||||
|
this.matched = true;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
onNoSuggestion() {
|
||||||
|
this.matched = false;
|
||||||
|
}
|
||||||
|
onChooseItem(item, _evt) {
|
||||||
|
if (this.matched) {
|
||||||
|
this.callback(item);
|
||||||
|
} else {
|
||||||
|
this.callback(this.inputEl.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static callback(app, settings, defaultName, call) {
|
||||||
|
new EnvModal(app, settings, defaultName, call).open();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/latexEnvironmentsSettingsTab.ts
|
||||||
|
var import_obsidian2 = __toModule(require("obsidian"));
|
||||||
|
var LatexEnvironmentsSettingTab = class extends import_obsidian2.PluginSettingTab {
|
||||||
|
constructor(app, plugin) {
|
||||||
|
super(app, plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
display() {
|
||||||
|
const { containerEl } = this;
|
||||||
|
containerEl.empty();
|
||||||
|
containerEl.createEl("h2", { text: "Settings for latex environments" });
|
||||||
|
new import_obsidian2.Setting(containerEl).setName("Default environment").setDesc("The default environment to insert").addText((text) => text.setPlaceholder("environment").setValue(this.plugin.settings.defaultEnvironment).onChange((value) => __async(this, null, function* () {
|
||||||
|
this.plugin.settings.defaultEnvironment = value;
|
||||||
|
yield this.plugin.saveData(this.plugin.settings);
|
||||||
|
})));
|
||||||
|
new import_obsidian2.Setting(containerEl).setName("Extra environments").setDesc("Environment names to be suggested for completion (one per line)").addTextArea((area) => {
|
||||||
|
area.setValue(this.plugin.settings.customEnvironments.join("\n")).onChange((value) => __async(this, null, function* () {
|
||||||
|
this.plugin.settings.customEnvironments = value.split("\n").map((x) => x.trim()).filter((x) => x.length > 0);
|
||||||
|
yield this.plugin.saveData(this.plugin.settings);
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/actions/action.ts
|
||||||
|
var Action = class {
|
||||||
|
constructor(doc) {
|
||||||
|
this.doc = doc;
|
||||||
|
}
|
||||||
|
suggestName() {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
get needsName() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/environment.ts
|
||||||
|
function newEnvironment(name, cursor, contents = "") {
|
||||||
|
const pad = getPad(contents);
|
||||||
|
return {
|
||||||
|
replaceSelection: `\\begin{${name}}${pad}${contents}${pad}\\end{${name}}`,
|
||||||
|
selection: {
|
||||||
|
from: {
|
||||||
|
ch: 0,
|
||||||
|
line: cursor.line + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function unwrapEnvironment(environment, doc) {
|
||||||
|
return {
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
text: trim(environment.contents),
|
||||||
|
from: doc.offsetToPos(environment.begin.from),
|
||||||
|
to: doc.offsetToPos(environment.end.to)
|
||||||
|
}
|
||||||
|
],
|
||||||
|
selection: { from: doc.getCursor() }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function changeEnvironment(environment, doc, name) {
|
||||||
|
const change = {
|
||||||
|
text: `\\begin{${name}}${environment.contents}\\end{${name}}`,
|
||||||
|
from: doc.offsetToPos(environment.begin.from),
|
||||||
|
to: doc.offsetToPos(environment.end.to)
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
changes: [change],
|
||||||
|
selection: { from: doc.getCursor() }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function getPad(text) {
|
||||||
|
if (text.length > 0 && text.match(/^[ \t]*$/) != null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "\n";
|
||||||
|
}
|
||||||
|
function trim(text) {
|
||||||
|
if (text.length === 0)
|
||||||
|
return text;
|
||||||
|
const start = text.startsWith("\n") ? 1 : 0;
|
||||||
|
const end = text.endsWith("\n") ? text.length - 1 : text.length;
|
||||||
|
return text.slice(start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
// src/actions/wrapAction.ts
|
||||||
|
var WrapAction = class extends Action {
|
||||||
|
constructor(doc, addWhitespace = true) {
|
||||||
|
super(doc);
|
||||||
|
this.addWhitespace = addWhitespace;
|
||||||
|
}
|
||||||
|
prepare() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
transaction(envName) {
|
||||||
|
return newEnvironment(envName, this.doc.getCursor(), this.doc.getSelection());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/actions/insertAction.ts
|
||||||
|
var InsertAction = class extends Action {
|
||||||
|
prepare() {
|
||||||
|
if (this.doc.somethingSelected()) {
|
||||||
|
return new WrapAction(this.doc).prepare();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
transaction(envName) {
|
||||||
|
return newEnvironment(envName, this.doc.getCursor());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/actions/changeAction.ts
|
||||||
|
var ChangeAction = class extends Action {
|
||||||
|
suggestName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
prepare() {
|
||||||
|
const cursor = this.doc.posToOffset(this.doc.getCursor());
|
||||||
|
const block = new MathBlock(this.doc.getValue(), cursor);
|
||||||
|
this.current = block.getEnclosingEnvironment(cursor);
|
||||||
|
if (this.current === void 0) {
|
||||||
|
return new WrapAction(this.doc, block.startPosition === block.endPosition);
|
||||||
|
}
|
||||||
|
this.name = this.current.name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
transaction(envName) {
|
||||||
|
if (this.current !== void 0) {
|
||||||
|
return changeEnvironment(this.current, this.doc, envName);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/actions/deleteAction.ts
|
||||||
|
var DeleteAction = class extends Action {
|
||||||
|
get needsName() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
prepare() {
|
||||||
|
const cursor = this.doc.getCursor();
|
||||||
|
const block = new MathBlock(this.doc.getValue(), this.doc.posToOffset(cursor));
|
||||||
|
this.current = block.getEnclosingEnvironment(this.doc.posToOffset(cursor));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
transaction(_envName) {
|
||||||
|
if (this.current !== void 0) {
|
||||||
|
return unwrapEnvironment(this.current, this.doc);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/main.ts
|
||||||
|
var LatexEnvironments = class extends import_obsidian3.Plugin {
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
this.settings = new LatexEnvironmentsSettings();
|
||||||
|
}
|
||||||
|
onload() {
|
||||||
|
return __async(this, null, function* () {
|
||||||
|
const settings = yield this.loadData();
|
||||||
|
if (settings !== null) {
|
||||||
|
this.settings = ensureSettings(settings);
|
||||||
|
}
|
||||||
|
this.addCommand({
|
||||||
|
id: "insert-latex-env",
|
||||||
|
name: "Insert LaTeX environment",
|
||||||
|
checkCallback: this.mathModeCallback(InsertAction)
|
||||||
|
});
|
||||||
|
this.addCommand({
|
||||||
|
id: "change-latex-env",
|
||||||
|
name: "Change LaTeX environment",
|
||||||
|
checkCallback: this.mathModeCallback(ChangeAction)
|
||||||
|
});
|
||||||
|
this.addCommand({
|
||||||
|
id: "delete-latex-env",
|
||||||
|
name: "Delete LaTeX environment",
|
||||||
|
checkCallback: this.mathModeCallback(DeleteAction)
|
||||||
|
});
|
||||||
|
this.addSettingTab(new LatexEnvironmentsSettingTab(this.app, this));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
mathModeCallback(ActionType) {
|
||||||
|
return (checking) => {
|
||||||
|
const leaf = this.app.workspace.activeLeaf;
|
||||||
|
if (leaf.view instanceof import_obsidian3.MarkdownView) {
|
||||||
|
const editor = leaf.view.editor;
|
||||||
|
const cursor = editor.posToOffset(editor.getCursor());
|
||||||
|
if (!MathBlock.isMathMode(cursor, editor)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!checking) {
|
||||||
|
try {
|
||||||
|
const action = new ActionType(editor.getDoc()).prepare();
|
||||||
|
this.withPromptName(editor, action);
|
||||||
|
} catch (e) {
|
||||||
|
new import_obsidian3.Notice(e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
withPromptName(editor, action) {
|
||||||
|
const call = (envName) => {
|
||||||
|
editor.transaction(action.transaction(envName));
|
||||||
|
editor.focus();
|
||||||
|
};
|
||||||
|
if (action.needsName) {
|
||||||
|
const suggested = action.suggestName();
|
||||||
|
EnvModal.callback(this.app, this.settings, suggested !== void 0 ? suggested : this.settings.defaultEnvironment, call);
|
||||||
|
} else {
|
||||||
|
call("*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
10
.obsidian/plugins/obsidian-latex-environments/manifest.json
vendored
Normal file
10
.obsidian/plugins/obsidian-latex-environments/manifest.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "obsidian-latex-environments",
|
||||||
|
"name": "Latex Environments",
|
||||||
|
"version": "0.3.0",
|
||||||
|
"description": "Allows to quickly insert and change latex environments within math environments.",
|
||||||
|
"author": "Zach Raines",
|
||||||
|
"authorUrl": "https://github.com/raineszm/obsidian-latex-environments",
|
||||||
|
"minAppVersion": "0.11.11",
|
||||||
|
"isDesktopOnly": false
|
||||||
|
}
|
1
.obsidian/plugins/obsidian-latex-environments/styles.css
vendored
Normal file
1
.obsidian/plugins/obsidian-latex-environments/styles.css
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Not Found
|
112
.obsidian/workspace
vendored
Normal file
112
.obsidian/workspace
vendored
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
{
|
||||||
|
"main": {
|
||||||
|
"id": "b5edcffa82772ae7",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "bc097db78015bcba",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "markdown",
|
||||||
|
"state": {
|
||||||
|
"file": "Areas/electricity/led.md.md",
|
||||||
|
"mode": "source",
|
||||||
|
"source": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cabeee83977cea84",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "markdown",
|
||||||
|
"state": {
|
||||||
|
"file": "Areas/electricity/led.md.md",
|
||||||
|
"mode": "preview",
|
||||||
|
"source": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "vertical"
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"id": "960bd0ae12708602",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "240323277b6ea277",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "018891641805eabd",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "file-explorer",
|
||||||
|
"state": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "180e37f00da590d0",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "search",
|
||||||
|
"state": {
|
||||||
|
"query": "",
|
||||||
|
"matchingCase": false,
|
||||||
|
"explainSearch": false,
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"id": "c57c7700d46038dd",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "aa758b15486a27c3",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "a47b8cf2ccebc103",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "backlink",
|
||||||
|
"state": {
|
||||||
|
"file": "Areas/electricity/led.md.md",
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical",
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": "",
|
||||||
|
"backlinkCollapsed": false,
|
||||||
|
"unlinkedCollapsed": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300,
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"active": "bc097db78015bcba",
|
||||||
|
"lastOpenFiles": [
|
||||||
|
"Areas/electricity/led.md.md",
|
||||||
|
"Areas/electricity/glossary.md",
|
||||||
|
"Untitled 1.md",
|
||||||
|
"Areas/electricity/basics.md",
|
||||||
|
"Areas/electricity/voltage-dividers.md",
|
||||||
|
"Areas/electricity/index.md",
|
||||||
|
"Areas/electricity/voltage-divider.svg"
|
||||||
|
]
|
||||||
|
}
|
@ -10,7 +10,12 @@ Electrons can escape the atom and bind to a new Atom.
|
|||||||
|
|
||||||
Copper is used in wires because it has 29 Electrons, with one in the outer (Valence) Shell. This Atom can easily escape and switch places.
|
Copper is used in wires because it has 29 Electrons, with one in the outer (Valence) Shell. This Atom can easily escape and switch places.
|
||||||
|
|
||||||
Normally an atom has the same amount of protons and electrons, when this is not the case the atoms has a charge.
|
|
||||||
|
## Ohms Law
|
||||||
|
|
||||||
|
V = I * R;
|
||||||
|
|
||||||
|
I = V / R;
|
||||||
|
|
||||||
## Voltage
|
## Voltage
|
||||||
is like the pressure in Cable, it forces the Electrons to move.
|
is like the pressure in Cable, it forces the Electrons to move.
|
||||||
@ -23,19 +28,63 @@ When the current is to high, the cable breaks
|
|||||||
## Circuit
|
## Circuit
|
||||||
A electric circuit is a closed loop through which electrons flow.
|
A electric circuit is a closed loop through which electrons flow.
|
||||||
|
|
||||||
Normally in a copper wire the atoms randomly exchange electrons.
|
## How to find resistance of resistors in series?
|
||||||
|
Just add them up
|
||||||
|
|
||||||
When there is a force applied to some side, the electrons move in a specific way
|
## How to find the resistance of resistors in parallel?
|
||||||
|
|
||||||
## Voltage is how much these electrons want to move
|
When each of the resistors provides a new way to reach ground, then
|
||||||
## Resistance is how hard it is for them to move
|
|
||||||
## Current is how many electrons are moving in a specified time
|
1/R = 1/R1 + 1/R2 + 1/R3;
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
R1 = 4 Ohm
|
||||||
|
R2 = 5 Ohm
|
||||||
|
R3 = 20 Ohm
|
||||||
|
|
||||||
|
1/R = 1/4 + 1/5 + 1/20;
|
||||||
|
1/R = 0.5 | * R;
|
||||||
|
1 = 0.5R | * 2;
|
||||||
|
2 = R;
|
||||||
|
|
||||||
|
10 Ohm
|
||||||
|
23 Ohm
|
||||||
|
17 Ohm
|
||||||
|
|
||||||
|
1/R = 0.20230179 | * R
|
||||||
|
1 = 0.20230179R | / 0.20230179
|
||||||
|
4.94 = R;
|
||||||
|
|
||||||
|
## Test
|
||||||
|
|
||||||
|
Input: 50v
|
||||||
|
Current: 2A
|
||||||
|
Resistors: 19Ohm
|
||||||
|
|
||||||
|
Ohms Law = V = I*R;
|
||||||
|
50 = 2*(19+R);
|
||||||
|
50 = 38+2R | - 38;
|
||||||
|
12 = 2R;
|
||||||
|
6 = R;
|
||||||
|
|
||||||
|
R = V / I;
|
||||||
|
|
||||||
|
Ohms law only works for D/C and NOT A/C;
|
||||||
|
|
||||||
|
5V in
|
||||||
|
|
||||||
|
1/R = 1/100+1/1000;
|
||||||
|
1/R = 0.011;
|
||||||
|
1 = 0.011R;
|
||||||
|
90.90909 = R;
|
||||||
|
|
||||||
|
I = V / R;
|
||||||
|
I = 5 / 90.909090
|
||||||
|
I = 0.055;
|
||||||
|
I = 5.5mA
|
||||||
|
|
||||||
## Ohms Law
|
|
||||||
|
|
||||||
Voltage = Current * Resistance
|
|
||||||
Resistance = Voltage / Current
|
|
||||||
Current = Voltage / Resistance
|
|
||||||
|
|
||||||
## Watts
|
## Watts
|
||||||
## Volts
|
## Volts
|
||||||
|
1
Areas/electricity/current-voltage-characteristic.svg
Normal file
1
Areas/electricity/current-voltage-characteristic.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 19 KiB |
65
Areas/electricity/diode-voltage-graph.svg
Normal file
65
Areas/electricity/diode-voltage-graph.svg
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="394.715" height="253.012" viewBox="0, 0, 877.143, 562.25">
|
||||||
|
<g id="Layer_1">
|
||||||
|
<path d="M140.643,441.452 C349.114,444.779 388.779,274.004 473.643,44.457" fill-opacity="0" stroke="#000000" stroke-width="3"/>
|
||||||
|
<path d="M181.643,441.452 C439.571,444.779 488.646,274.004 593.643,44.457" fill-opacity="0" stroke="#FB0000" stroke-width="3"/>
|
||||||
|
<path d="M257.643,441.452 C543.743,444.779 598.178,274.004 714.643,44.457" fill-opacity="0" stroke="#F78400" stroke-width="3"/>
|
||||||
|
<path d="M359.643,441.452 C658.89,444.779 715.826,274.004 837.643,44.457" fill-opacity="0" stroke="#002AD6" stroke-width="3"/>
|
||||||
|
<path d="M140.643,9.5 L140.643,441.5 L868.643,441.5" fill-opacity="0" stroke="#656565" stroke-width="5"/>
|
||||||
|
<path d="M275.143,441 L285.818,465.5 L295.639,441 L275.143,441" fill="#656565"/>
|
||||||
|
<path d="M420.143,441 L430.818,465.5 L440.639,441 L420.143,441" fill="#656565"/>
|
||||||
|
<path d="M562.143,441 L572.818,465.5 L582.639,441 L562.143,441" fill="#656565"/>
|
||||||
|
<path d="M705.143,441 L715.818,465.5 L725.639,441 L705.143,441" fill="#656565"/>
|
||||||
|
<path d="M140.143,359.002 L115.643,369.677 L140.143,379.498 L140.143,359.002" fill="#656565"/>
|
||||||
|
<path d="M140.143,287.002 L115.643,297.677 L140.143,307.498 L140.143,287.002" fill="#656565"/>
|
||||||
|
<path d="M140.143,214.752 L115.643,225.427 L140.143,235.248 L140.143,214.752" fill="#656565"/>
|
||||||
|
<path d="M140.143,141.752 L115.643,152.427 L140.143,162.248 L140.143,141.752" fill="#656565"/>
|
||||||
|
<path d="M140.143,72.505 L115.643,83.179 L140.143,93 L140.143,72.505" fill="#656565"/>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 79.823, 369.25)">
|
||||||
|
<tspan x="-16.68" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">10</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 285.391, 494.25)">
|
||||||
|
<tspan x="-8.34" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">1</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 430.391, 494.25)">
|
||||||
|
<tspan x="-8.34" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">2</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 572.391, 494.25)">
|
||||||
|
<tspan x="-8.34" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">3</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 715.391, 494.25)">
|
||||||
|
<tspan x="-8.34" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">4</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 723.751, 538.75)">
|
||||||
|
<tspan x="-133.665" y="6.5" font-family="Avenir-Medium" font-size="30" fill="#656565">Forward voltage (V)</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 419.643, 32.5)">
|
||||||
|
<tspan x="-53.625" y="6.5" font-family="Avenir-Medium" font-size="30" fill="#656565">Infrared</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 567.643, 32.5)">
|
||||||
|
<tspan x="-26.67" y="6.5" font-family="Avenir-Medium" font-size="30" fill="#656565">Red</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 691.143, 32.5)">
|
||||||
|
<tspan x="-51.66" y="6.5" font-family="Avenir-Medium" font-size="30" fill="#656565">Orange</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 807.643, 32.5)">
|
||||||
|
<tspan x="-29.73" y="6.5" font-family="Avenir-Medium" font-size="30" fill="#656565">Blue</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(0, -1, 1, 0, 24.751, 193.637)">
|
||||||
|
<tspan x="-147.3" y="5.249" font-family="Avenir-Medium" font-size="30" fill="#656565">Cathode current (mA)</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 79.823, 225)">
|
||||||
|
<tspan x="-16.68" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">30</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 79.823, 152)">
|
||||||
|
<tspan x="-16.68" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">40</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 79.823, 82.752)">
|
||||||
|
<tspan x="-16.68" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">50</tspan>
|
||||||
|
</text>
|
||||||
|
<text transform="matrix(1, 0, 0, 1, 79.823, 297.25)">
|
||||||
|
<tspan x="-16.68" y="9" font-family="Avenir-Medium" font-size="30" fill="#656565">20</tspan>
|
||||||
|
</text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
32
Areas/electricity/glossary.md
Normal file
32
Areas/electricity/glossary.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Glossary
|
||||||
|
|
||||||
|
## Volts
|
||||||
|
Voltage
|
||||||
|
|
||||||
|
## Amperes
|
||||||
|
Current
|
||||||
|
|
||||||
|
## Ohms
|
||||||
|
Resistance
|
||||||
|
|
||||||
|
## Ohms Law
|
||||||
|
$$
|
||||||
|
V = \frac{I}{R}
|
||||||
|
$$
|
||||||
|
|
||||||
|
## Impedance
|
||||||
|
## Polarity
|
||||||
|
Means if a component is symmetric or not
|
||||||
|
Polarised means that a component is not symmetric
|
||||||
|
|
||||||
|
## Voltage Divider
|
||||||
|
## LED
|
||||||
|
|
||||||
|
Anode - The shorter Leg
|
||||||
|
Cathode - The longer Leg
|
||||||
|
|
||||||
|
## Diode
|
||||||
|
## Anode
|
||||||
|
The positive end of a diode
|
||||||
|
## Cathode
|
||||||
|
The negative end of a diode
|
11
Areas/electricity/led.md.md
Normal file
11
Areas/electricity/led.md.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Led
|
||||||
|
|
||||||
|
Leds have polarity, that means they only allow current to flow in one direction. That means LED's are diodes.
|
||||||
|
|
||||||
|
While in resistors the relations of voltage to current is linear:
|
||||||
|
|
||||||
|
![](./current-voltage-characteristic.svg)
|
||||||
|
|
||||||
|
that is not the case for leds
|
||||||
|
|
||||||
|
![](./diode-voltage-graph.svg)
|
1
Areas/electricity/voltage-divider-load-example-2.svg
Normal file
1
Areas/electricity/voltage-divider-load-example-2.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="339" height="292"><defs><linearGradient id="zUpuIzzSVzkU" x1="0px" x2="32px" y1="0px" y2="0px" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#01fd01"/><stop offset="1" stop-color="#51ae51"/></linearGradient><linearGradient id="NmXbVRLkxUMB" x1="0px" x2="32px" y1="0px" y2="0px" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#51ae51"/><stop offset="1" stop-color="#807f7f"/></linearGradient></defs><g><rect fill="#000000" stroke="none" x="0" y="0" width="339" height="292"/><g transform="scale(1,1) translate(13,-110)"><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 256 160 L 256 192" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#51ae51" paint-order="fill stroke markers" d=" M 256 224 L 256 256" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g transform="matrix(0,1,-1,0,256,192)"><path fill="none" stroke="url(#zUpuIzzSVzkU)" paint-order="fill stroke markers" d=" M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="266" y="214" text-anchor="start" dominant-baseline="alphabetic">100</text><path fill="none" stroke="#51ae51" paint-order="fill stroke markers" d=" M 256 256 L 256 288" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 256 320 L 256 352" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g transform="matrix(0,1,-1,0,256,288)"><path fill="none" stroke="url(#NmXbVRLkxUMB)" paint-order="fill stroke markers" d=" M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="266" y="310" text-anchor="start" dominant-baseline="alphabetic">60</text><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 112 160 L 256 160" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="184" y="154" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 112 352 L 256 352" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="184" y="346" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 112 352 L 112 260" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 112 252 L 112 160" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 102 260 L 122 260" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 96 252 L 128 252" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g><text fill="#c0c0c0" stroke="none" font-family="sans-serif" font-size="24px" font-style="normal" font-weight="normal" text-decoration="normal" x="205" y="313" text-anchor="start" dominant-baseline="alphabetic">Re</text></g><g><text fill="#c0c0c0" stroke="none" font-family="sans-serif" font-size="24px" font-style="normal" font-weight="normal" text-decoration="normal" x="205" y="216" text-anchor="start" dominant-baseline="alphabetic">R1</text></g><g><text fill="#c0c0c0" stroke="none" font-family="sans-serif" font-size="24px" font-style="normal" font-weight="normal" text-decoration="normal" x="57" y="263" text-anchor="start" dominant-baseline="alphabetic">V5</text></g></g></g></svg>
|
After Width: | Height: | Size: 4.5 KiB |
1
Areas/electricity/voltage-divider-load-example.svg
Normal file
1
Areas/electricity/voltage-divider-load-example.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 6.7 KiB |
1
Areas/electricity/voltage-divider-load.svg
Normal file
1
Areas/electricity/voltage-divider-load.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 6.8 KiB |
1
Areas/electricity/voltage-divider.svg
Normal file
1
Areas/electricity/voltage-divider.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="412" height="324"><defs><linearGradient id="khIQGTmnrxSM" x1="0px" x2="32px" y1="0px" y2="0px" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#01fd01"/><stop offset="1" stop-color="#40be40"/></linearGradient><linearGradient id="TuOqVhZtRuod" x1="0px" x2="32px" y1="0px" y2="0px" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#40be40"/><stop offset="1" stop-color="#807f7f"/></linearGradient></defs><g><rect fill="#000000" stroke="none" x="0" y="0" width="412" height="324"/><g transform="scale(1,1) translate(-106,-30)"><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 176 304 L 176 196" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 176 188 L 176 80" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 166 196 L 186 196" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 160 188 L 192 188" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 176 80 L 336 80" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="239" y="74" text-anchor="start" dominant-baseline="alphabetic">2.5mA</text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 336 304 L 176 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="239" y="298" text-anchor="start" dominant-baseline="alphabetic">2.5mA</text><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 336 80 L 336 120" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#40be40" paint-order="fill stroke markers" d=" M 336 152 L 336 192" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g transform="matrix(0,1,-1,0,336,120)"><path fill="none" stroke="url(#khIQGTmnrxSM)" paint-order="fill stroke markers" d=" M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="346" y="142" text-anchor="start" dominant-baseline="alphabetic">1k</text><path fill="none" stroke="#40be40" paint-order="fill stroke markers" d=" M 336 192 L 336 232" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 336 264 L 336 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g transform="matrix(0,1,-1,0,336,232)"><path fill="none" stroke="url(#TuOqVhZtRuod)" paint-order="fill stroke markers" d=" M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="346" y="254" text-anchor="start" dominant-baseline="alphabetic">1k</text><g><g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="14px" font-style="normal" font-weight="normal" text-decoration="normal" x="448" y="192" text-anchor="middle" dominant-baseline="central">2.5 V</text></g><path fill="none" stroke="#40be40" paint-order="fill stroke markers" d=" M 336 192 L 424 192" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><path fill="#ffffff" stroke="none" paint-order="stroke fill markers" d=" M 339 192 A 3 3 0 1 1 338.99999999995777 191.99998407846124 Z"/></g></g></svg>
|
After Width: | Height: | Size: 4.3 KiB |
66
Areas/electricity/voltage-dividers.md
Normal file
66
Areas/electricity/voltage-dividers.md
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# Voltage Divider
|
||||||
|
|
||||||
|
## Simple Voltage Divider
|
||||||
|
|
||||||
|
This is sort of unrealistic because there is no current flowing out of the voltage divider on the right side:
|
||||||
|
|
||||||
|
![Voltage Divider](./voltage-divider.svg)
|
||||||
|
|
||||||
|
#### Equation
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{flalign}
|
||||||
|
Vout & =\text{Vin }x*(\frac{R2}{R1+R2})&\\
|
||||||
|
\end{flalign}
|
||||||
|
$$
|
||||||
|
|
||||||
|
## Voltage Divider with Load
|
||||||
|
|
||||||
|
When the output of the voltage divider is connected to something the current drops on the output, as that something uses some of it.
|
||||||
|
|
||||||
|
![Voltage Divider](./voltage-divider-load.svg)
|
||||||
|
|
||||||
|
The load is connected in parallel to R2, so we can calculate it as a parallel resistor.
|
||||||
|
|
||||||
|
The new Equation:
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{flalign}
|
||||||
|
Vout & =\text{Vin }x*(\frac{R2 || RL}{R1+R2 || RL})&\\
|
||||||
|
\end{flalign}
|
||||||
|
$$
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Lets calculate the current in this circuit:
|
||||||
|
|
||||||
|
![Voltage Divider Load Example](./voltage-divider-load-example.svg)
|
||||||
|
|
||||||
|
1. We calculate the Resistance in the subcircuit (R2 and RL) as they are connected in parallel which means
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{align}
|
||||||
|
\frac{1}{Re}&=\frac{1}{R2}+\frac{1}{RL} &\textit{Replace Variables}\\
|
||||||
|
\frac{1}{Re}&=\frac{1}{100}+\frac{1}{150} &\textit{Add Fractions}\\
|
||||||
|
\frac{1}{Re}&=\frac{1}{60} &\textit{* Re}\\
|
||||||
|
1&=\frac{Re}{60} &\textit{* 60}\\
|
||||||
|
60&=Re \\
|
||||||
|
\end{align}
|
||||||
|
$$
|
||||||
|
|
||||||
|
The simplified circuit now looks like this;
|
||||||
|
|
||||||
|
![Voltage Divider Load Example](./voltage-divider-load-example-2.svg)
|
||||||
|
|
||||||
|
Now we can easily calculate the Resistance in the circuit
|
||||||
|
|
||||||
|
With the resistance we can now calculate the current inside the load circuit by using the simple voltage divider equation:
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{flalign}
|
||||||
|
Vout &=\text{Vin }x*(\frac{Re}{R1+Re})&\\
|
||||||
|
Vout &=5*(\frac{60}{100+60})&\\
|
||||||
|
Vout &=5*(\frac{60}{100+60})&\\
|
||||||
|
Vout &=1.875v
|
||||||
|
\end{flalign}
|
||||||
|
$$
|
5
Areas/films/index.md
Normal file
5
Areas/films/index.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Movies
|
||||||
|
|
||||||
|
To Watch:
|
||||||
|
|
||||||
|
https://en.wikipedia.org/wiki/Roma_(2018_film)
|
Loading…
Reference in New Issue
Block a user