This file contains 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
/* | |
You can run this file with | |
maxima -b cosine-rule.mac | |
or maybe also using M-x quickrun | |
*/ | |
/* |
This file contains 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
(%i1) eq1: a = b + c /d; | |
c | |
(%o1) a = - + b | |
d | |
(%i2) eq2: e = b - c*d; | |
(%o2) e = b - c d | |
(%i3) eliminate([eq1, eq2], [b]); | |
2 | |
(%o3) [(- d (e - a)) - c d - c] | |
(%i4) expand(%); |
This file contains 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
(%i1) t: matrix([%t^3],[%t^2],[%t],[1]) | |
; | |
[ 3 ] | |
[ %t ] | |
[ ] | |
[ 2 ] | |
(%o1) [ %t ] | |
[ ] | |
[ %t ] | |
[ ] |
This file contains 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
(%i1) eqn:I12 = I11*(((-d)+3)/(pp-4*m2))+I10*((d-2)/((2*m2)*pp-8*m2^2)) | |
I10 (d - 2) I11 (3 - d) | |
(%o1) I12 = --------------- + ----------- | |
2 pp - 4 m2 | |
2 m2 pp - 8 m2 | |
(%i2) sol:solve(eqn,[I10]) | |
2 | |
2 I12 m2 pp - 8 I12 m2 + (2 I11 d - 6 I11) m2 | |
(%o2) [I10 = ----------------------------------------------] | |
d - 2 |
This file contains 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
(%i1) eq1: a = b + c / d; | |
c | |
(%o1) a = - + b | |
d | |
(%i2) eq2: x = b - c*d; | |
(%o2) x = b - c d | |
(%i3) solve([eq1, eq2], [a,b,c,d, x]); | |
(%o3) [[a = %r1, b = %r2, c = (%r1 - %r2) %r3, d = %r3, | |
2 | |
x = (%r2 - %r1) %r3 + %r2]] |
This file contains 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
(%i1) integrate(x^2 * %e ^ (-x ^ 2), x); | |
2 | |
- x | |
sqrt(%pi) erf(x) x %e | |
(%o1) ---------------- - -------- | |
4 2 | |
(%i2) plot2d(%o1, [x, -1.5, 1.5]); |
This file contains 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
declare(bra, nonscalar); | |
declare(ket, nonscalar); | |
dotscrules:true; | |
matchdeclare(m,lambda([t],featurep(t,integer))); | |
matchdeclare(n,lambda([t],featurep(t,integer))); | |
tellsimp(bra(m).ket(n), kron_delta(m,n)); | |
simp:false; | |
matchdeclare(aa, true); |
This file contains 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
anyp(pred, seq) := lreduce(lambda([P, x], P or pred(x)), seq, false); | |
allp(pred, seq) := lreduce(lambda([P, x], P and pred(x)), seq, true); | |
walklength(seq) := (length(seq)-1)/2; | |
walkverts(seq) := makelist(seq[2*i-1], i, 1, walklength(seq)+1); | |
walkedges(seq) := makelist(seq[2*i], i, 1, walklength(seq)); | |
closedp(seq) := is(first(seq) = last(seq)); | |
vertexset(G) := first(G); | |
edgeset(G) := second(G); |
This file contains 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 Chung Chan | |
Copyright (C) 2021 Chung Chan */ | |
/* remove | |
load(descriptive); | |
load(draw); | |
*/ | |
/**************** | |
helper functions | |
****************/ |
This file contains 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
with_slider_draw(k,makelist(i,i,1,7), | |
proportional_axes = xy, | |
xrange = [-3,3], | |
yrange = [-3,3], | |
xaxis=true, | |
yaxis=true, | |
grid = true, | |
title = "animation" , | |
label([sconcat("k=",k-4),-1,2]), | |
point_type=7, |
NewerOlder