Skip to content

Commit

Permalink
graph
Browse files Browse the repository at this point in the history
  • Loading branch information
tailuge committed Nov 17, 2024
1 parent 85bad34 commit d5366b0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dist/diagrams/mathaven.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<body>
<h1>mathaven diagrams</h1>

<div id="plotly-div"></div>
<div id="mathaven-div"></div>
<div id="mathaven-impulse"></div>
<div id="mathaven-vel"></div>

<script src="https://cdn.plot.ly/plotly-cartesian-3.0.0-rc.0.min.js"></script>
<script src="../vendor.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dist/mathaven.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 16 additions & 8 deletions src/mathaven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,23 @@ function createTrace(x: number[], y: number[], name: string, color: string) {

const vals = (selector: (s: Mathaven) => number): number[] => extractValues(calc.history, selector)

const impulse = vals(h => h.P).map((_,i)=>i)
const data = [
createTrace(impulse, vals(h=>h.s), 's', color(0)),
createTrace(impulse, vals(h=>h.φ), 'φ', color(1)),
createTrace(impulse, vals(h=>h.), "s'", color(2)),
createTrace(impulse, vals(h=>h.φʹ), "φʹ", color(3)),
];
const impulse = vals(h => h.P)

window.Plotly.newPlot("mathaven-div", data, layout, config)
window.Plotly.newPlot("mathaven-impulse", [
createTrace(impulse, vals(h => h.s), 's', color(0)),
createTrace(impulse, vals(h => h.φ), 'φ', color(1)),
createTrace(impulse, vals(h => h.), "s'", color(2)),
createTrace(impulse, vals(h => h.φʹ), "φʹ", color(3)),
], layout, config)

const index = vals(h => h.P).map((_,i)=>i)

window.Plotly.newPlot("mathaven-vel", [
createTrace(index, vals(h => h.vx), 'vx', color(0)),
createTrace(index, vals(h => h.vy), 'vy', color(1)),
createTrace(index, vals(h => h.ωx), "ωx", color(2)),
createTrace(index, vals(h => h.ωy), "ωy", color(3)),
], layout, config)



3 changes: 3 additions & 0 deletions src/model/physics/claude/qwen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class Mathaven {

public compressionPhase(): void {
const ΔP = ((1 + ee) * M * this.vy) / N;
console.log(ΔP)
while (this.vy > 0) {
this.updateSingleStep(ΔP);
}
Expand All @@ -60,6 +61,7 @@ export class Mathaven {
this.updateAngularVelocity(ΔP);
this.updateWorkDone(ΔP);
this.history.push({ ...this });
console.log(this.vy)
if (this.iter++ > 2000) {
throw "Solution not found"
}
Expand All @@ -79,6 +81,7 @@ export class Mathaven {
private updateWorkDone(ΔP: number): void {
const ΔWzI = ΔP / 2 * (this.vy + this.vy);
this.WzI += ΔWzI;
this.P += ΔP;
}

public solve(): void {
Expand Down

0 comments on commit d5366b0

Please sign in to comment.