Removed references to the the graphics submodule due to the mysterious submodule error
This commit is contained in:
parent
0ee88d6310
commit
37bb90af0b
|
@ -1,5 +1,26 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
|
#;(module bracket-graphics racket
|
||||||
|
(require "../graphics/graphics.rkt")
|
||||||
|
|
||||||
|
(define-syntax (declare/provide-vars stx)
|
||||||
|
(syntax-case stx ()
|
||||||
|
[(_ id ...)
|
||||||
|
#'(begin
|
||||||
|
(define id 'id) ...
|
||||||
|
(provide id) ...)]))
|
||||||
|
|
||||||
|
(provide Graphics)
|
||||||
|
|
||||||
|
(declare/provide-vars
|
||||||
|
Blend Darker Hue Lighter
|
||||||
|
Circle Disk Line Point Rectangle
|
||||||
|
Text Thickness
|
||||||
|
; Colors
|
||||||
|
Red Blue Green Black White Yellow
|
||||||
|
; Options
|
||||||
|
ImageSize PlotRange))
|
||||||
|
|
||||||
;;; An ATOMIC EXPRESSION is an
|
;;; An ATOMIC EXPRESSION is an
|
||||||
; - number (integer, real, complex)
|
; - number (integer, real, complex)
|
||||||
; - reserved symbol (pi, e, i, inf, true, false)
|
; - reserved symbol (pi, e, i, inf, true, false)
|
||||||
|
@ -112,22 +133,22 @@
|
||||||
; This version prevents duplication of args.
|
; This version prevents duplication of args.
|
||||||
; But uses apply in place of #%app
|
; But uses apply in place of #%app
|
||||||
#;(define-syntax (sym-app stx)
|
#;(define-syntax (sym-app stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ op arg ...)
|
[(_ op arg ...)
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
(let ([o op]
|
(let ([o op]
|
||||||
[as (λ () (list arg ...))])
|
[as (λ () (list arg ...))])
|
||||||
; TODO: 1. If o is Flat, then flattened nested expression with o.
|
; TODO: 1. If o is Flat, then flattened nested expression with o.
|
||||||
; TODO: 2. If o is Listable, then ...
|
; TODO: 2. If o is Listable, then ...
|
||||||
; TODO: 3. If o is Orderless then ...
|
; TODO: 3. If o is Orderless then ...
|
||||||
; TODO: 4. If o has associated rules ...
|
; TODO: 4. If o has associated rules ...
|
||||||
; TODO:
|
; TODO:
|
||||||
; REF: http://reference.wolfram.com/mathematica/tutorial/Evaluation.html
|
; REF: http://reference.wolfram.com/mathematica/tutorial/Evaluation.html
|
||||||
(if (procedure? o)
|
(if (procedure? o)
|
||||||
#,(syntax/loc stx (apply o (as)))
|
#,(syntax/loc stx (apply o (as)))
|
||||||
(if (holdable? o)
|
(if (holdable? o)
|
||||||
(cons o '(arg ...))
|
(cons o '(arg ...))
|
||||||
(cons o (as))))))])))
|
(cons o (as))))))])))
|
||||||
|
|
||||||
(module expression-core racket
|
(module expression-core racket
|
||||||
(require (submod ".." identifiers)
|
(require (submod ".." identifiers)
|
||||||
|
@ -204,7 +225,7 @@
|
||||||
(when compound?
|
(when compound?
|
||||||
(hash-set! recent-compound-expressions e #t))
|
(hash-set! recent-compound-expressions e #t))
|
||||||
compound?)))
|
compound?)))
|
||||||
|
|
||||||
(define (construct operator operands)
|
(define (construct operator operands)
|
||||||
(cons operator operands))
|
(cons operator operands))
|
||||||
|
|
||||||
|
@ -258,7 +279,7 @@
|
||||||
(submod ".." undefined)
|
(submod ".." undefined)
|
||||||
(submod ".." identifiers))
|
(submod ".." identifiers))
|
||||||
(require (planet dherman/memoize:3:1))
|
(require (planet dherman/memoize:3:1))
|
||||||
|
|
||||||
(provide simplify
|
(provide simplify
|
||||||
simplify-plus
|
simplify-plus
|
||||||
simplify-minus
|
simplify-minus
|
||||||
|
@ -323,7 +344,7 @@
|
||||||
[(1) (first vs)]
|
[(1) (first vs)]
|
||||||
[(0) 0]
|
[(0) 0]
|
||||||
[else (construct 'Plus vs)]))])]))
|
[else (construct 'Plus vs)]))])]))
|
||||||
|
|
||||||
(define (simplify-plus-rec us)
|
(define (simplify-plus-rec us)
|
||||||
; a list of terms is received,
|
; a list of terms is received,
|
||||||
; a list of simplified terms is returned.
|
; a list of simplified terms is returned.
|
||||||
|
@ -369,9 +390,9 @@
|
||||||
(λ (u2i)
|
(λ (u2i)
|
||||||
(let ([us (simplify-plus-rec (cons u1 (list u2i)))])
|
(let ([us (simplify-plus-rec (cons u1 (list u2i)))])
|
||||||
; If length(us)>=2 wrap with Plus
|
; If length(us)>=2 wrap with Plus
|
||||||
(if (empty? (rest us))
|
(if (empty? (rest us))
|
||||||
(first us)
|
(first us)
|
||||||
(construct 'Plus us))))
|
(construct 'Plus us))))
|
||||||
(operands u2)))]
|
(operands u2)))]
|
||||||
[(before? u2 u1) (list u2 u1)]
|
[(before? u2 u1) (list u2 u1)]
|
||||||
[else (list u1 u2)])]
|
[else (list u1 u2)])]
|
||||||
|
@ -407,7 +428,7 @@
|
||||||
(cons q1 (merge-sums p (rest q)))
|
(cons q1 (merge-sums p (rest q)))
|
||||||
(cons p1 (merge-sums (rest p) q)))]
|
(cons p1 (merge-sums (rest p) q)))]
|
||||||
[else (error)])]))
|
[else (error)])]))
|
||||||
|
|
||||||
(define/memo (simplify-times ops)
|
(define/memo (simplify-times ops)
|
||||||
;(displayln (list 'simplify-times ops))
|
;(displayln (list 'simplify-times ops))
|
||||||
; the operands os are simplified
|
; the operands os are simplified
|
||||||
|
@ -530,106 +551,106 @@
|
||||||
; See [Cohen] for the complete algorithm and explanation.
|
; See [Cohen] for the complete algorithm and explanation.
|
||||||
(define result
|
(define result
|
||||||
(cond
|
(cond
|
||||||
[(and (number? u) (number? v))
|
[(and (number? u) (number? v))
|
||||||
; straightforward for two real numbers,
|
; straightforward for two real numbers,
|
||||||
; but complex numbers must be handled too.
|
; but complex numbers must be handled too.
|
||||||
(if (= u v)
|
(if (= u v)
|
||||||
#t
|
#t
|
||||||
(if (real? u)
|
(if (real? u)
|
||||||
(if (real? v) (< u v) v)
|
(if (real? v) (< u v) v)
|
||||||
(if (real? v)
|
(if (real? v)
|
||||||
v
|
v
|
||||||
(if (= (imag-part u) (imag-part v))
|
(if (= (imag-part u) (imag-part v))
|
||||||
(< (real-part u) (real-part v))
|
(< (real-part u) (real-part v))
|
||||||
(< (imag-part u) (imag-part v))))))]
|
(< (imag-part u) (imag-part v))))))]
|
||||||
; Number always come first
|
; Number always come first
|
||||||
[(number? u) #t]
|
[(number? u) #t]
|
||||||
[(number? v) #f]
|
[(number? v) #f]
|
||||||
; Symbols are sorted in alphabetical order
|
; Symbols are sorted in alphabetical order
|
||||||
[(and (symbol? u) (symbol? v))
|
[(and (symbol? u) (symbol? v))
|
||||||
(string<? (symbol->string u) (symbol->string v))]
|
(string<? (symbol->string u) (symbol->string v))]
|
||||||
; For products and sums order on the last different
|
; For products and sums order on the last different
|
||||||
; factor or term. Thus x+y < y+z.
|
; factor or term. Thus x+y < y+z.
|
||||||
[(or (and (times-expression? u) (times-expression? v))
|
[(or (and (times-expression? u) (times-expression? v))
|
||||||
(and (plus-expression? u) (plus-expression? v)))
|
(and (plus-expression? u) (plus-expression? v)))
|
||||||
(define first-non-equal
|
(define first-non-equal
|
||||||
(for/first ([ui (in-list (reverse (operands u)))]
|
(for/first ([ui (in-list (reverse (operands u)))]
|
||||||
[vi (in-list (reverse (operands v)))]
|
[vi (in-list (reverse (operands v)))]
|
||||||
#:unless (equal? ui vi))
|
#:unless (equal? ui vi))
|
||||||
(list ui vi)))
|
(list ui vi)))
|
||||||
(if first-non-equal
|
(if first-non-equal
|
||||||
(apply before? first-non-equal)
|
(apply before? first-non-equal)
|
||||||
(< (length (operands u)) (length (operands v))))]
|
(< (length (operands u)) (length (operands v))))]
|
||||||
; When comparing a product with something else, use the last factor.
|
; When comparing a product with something else, use the last factor.
|
||||||
; Thus x*y < z and y < x*z.
|
; Thus x*y < z and y < x*z.
|
||||||
; Note: This is consistent with comparisons of two products since
|
; Note: This is consistent with comparisons of two products since
|
||||||
; x*y < 1*z and 1*y < x*z.
|
; x*y < 1*z and 1*y < x*z.
|
||||||
[(and (times-expression? u)
|
[(and (times-expression? u)
|
||||||
(or ;(power-expression? v)
|
(or ;(power-expression? v)
|
||||||
;(plus-expression? v)
|
;(plus-expression? v)
|
||||||
(symbolic-id? v)
|
(symbolic-id? v)
|
||||||
(compound-expression? v)))
|
(compound-expression? v)))
|
||||||
(let ([un (last-operand u)])
|
(let ([un (last-operand u)])
|
||||||
(or (equal? un v) (before? un v)))]
|
(or (equal? un v) (before? un v)))]
|
||||||
[(and (times-expression? v)
|
[(and (times-expression? v)
|
||||||
(or ;(power-expression? v)
|
(or ;(power-expression? v)
|
||||||
;(plus-expression? v)
|
;(plus-expression? v)
|
||||||
(symbolic-id? u)
|
(symbolic-id? u)
|
||||||
(compound-expression? u)))
|
(compound-expression? u)))
|
||||||
(define vn (last-operand v))
|
(define vn (last-operand v))
|
||||||
(or (equal? vn u) (before? u vn))]
|
(or (equal? vn u) (before? u vn))]
|
||||||
; Powers with smallest base are first. 2^z < 3^y
|
; Powers with smallest base are first. 2^z < 3^y
|
||||||
[(and (power-expression? u) (power-expression? v))
|
[(and (power-expression? u) (power-expression? v))
|
||||||
(if (equal? (base u) (base v))
|
(if (equal? (base u) (base v))
|
||||||
(before? (exponent u) (exponent v))
|
(before? (exponent u) (exponent v))
|
||||||
(before? (base u) (base v)))]
|
(before? (base u) (base v)))]
|
||||||
; When comparing a product with something else, pretend
|
; When comparing a product with something else, pretend
|
||||||
; the else part is a power with exponent 1.
|
; the else part is a power with exponent 1.
|
||||||
; Thus x^2 > x.
|
; Thus x^2 > x.
|
||||||
[(and (power-expression? u)
|
[(and (power-expression? u)
|
||||||
(or ; (plus-expression? v)
|
(or ; (plus-expression? v)
|
||||||
(symbolic-id? v)
|
(symbolic-id? v)
|
||||||
(compound-expression? v)))
|
(compound-expression? v)))
|
||||||
(before? u (construct 'Power (list v 1)))]
|
(before? u (construct 'Power (list v 1)))]
|
||||||
[(and (power-expression? v)
|
[(and (power-expression? v)
|
||||||
(or ; (plus-expression? v)
|
(or ; (plus-expression? v)
|
||||||
(symbolic-id? u)
|
(symbolic-id? u)
|
||||||
(compound-expression? u)))
|
(compound-expression? u)))
|
||||||
(before? (construct 'Power (list u 1)) v)]
|
(before? (construct 'Power (list u 1)) v)]
|
||||||
; Same trick with sums. Thus x+(-1) < x (+0)
|
; Same trick with sums. Thus x+(-1) < x (+0)
|
||||||
[(and (plus-expression? u)
|
[(and (plus-expression? u)
|
||||||
(or (symbolic-id? v)
|
(or (symbolic-id? v)
|
||||||
(compound-expression? v)))
|
(compound-expression? v)))
|
||||||
(before? u (construct 'Plus (list v)))]
|
(before? u (construct 'Plus (list v)))]
|
||||||
[(and (plus-expression? v)
|
[(and (plus-expression? v)
|
||||||
(or (symbolic-id? u)
|
(or (symbolic-id? u)
|
||||||
(compound-expression? u)))
|
(compound-expression? u)))
|
||||||
(before? (construct 'Plus (list u)) v)]
|
(before? (construct 'Plus (list u)) v)]
|
||||||
; Here only function applications are left.
|
; Here only function applications are left.
|
||||||
; Sort after name.
|
; Sort after name.
|
||||||
[(and (compound-expression? u) (compound-expression? v))
|
[(and (compound-expression? u) (compound-expression? v))
|
||||||
(if (not (equal? (kind u) (kind v)))
|
(if (not (equal? (kind u) (kind v)))
|
||||||
(before? (kind u) (kind v))
|
(before? (kind u) (kind v))
|
||||||
(let ()
|
(let ()
|
||||||
; If the names are equal, sort after the first
|
; If the names are equal, sort after the first
|
||||||
; non-equal operand.
|
; non-equal operand.
|
||||||
(define first-non-equal
|
(define first-non-equal
|
||||||
(for/first ([ui (in-list (operands u))]
|
(for/first ([ui (in-list (operands u))]
|
||||||
[vi (in-list (operands v))]
|
[vi (in-list (operands v))]
|
||||||
#:unless (equal? ui vi))
|
#:unless (equal? ui vi))
|
||||||
(list ui vi)))
|
(list ui vi)))
|
||||||
(if first-non-equal
|
(if first-non-equal
|
||||||
(apply before? first-non-equal)
|
(apply before? first-non-equal)
|
||||||
(< (length (operands u)) (length (operands v))))))]
|
(< (length (operands u)) (length (operands v))))))]
|
||||||
[(compound-expression? u)
|
[(compound-expression? u)
|
||||||
#f]
|
#f]
|
||||||
[(compound-expression? v)
|
[(compound-expression? v)
|
||||||
#t]
|
#t]
|
||||||
[else
|
[else
|
||||||
(error 'before? "Internal error: A case is missing, got ~a and ~a" u v)]
|
(error 'before? "Internal error: A case is missing, got ~a and ~a" u v)]
|
||||||
; TODO : This isn't done
|
; TODO : This isn't done
|
||||||
; some rules are missing ... functions????
|
; some rules are missing ... functions????
|
||||||
))
|
))
|
||||||
;(displayln (format " => ~a" result))
|
;(displayln (format " => ~a" result))
|
||||||
result
|
result
|
||||||
)
|
)
|
||||||
|
@ -743,35 +764,35 @@
|
||||||
(kind u)
|
(kind u)
|
||||||
(map (λ (ui) (concurrent-substitute ui ts rs))
|
(map (λ (ui) (concurrent-substitute ui ts rs))
|
||||||
(operands u))))])))
|
(operands u))))])))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#;(module pattern-matching racket
|
#;(module pattern-matching racket
|
||||||
(require (submod ".." expression))
|
(require (submod ".." expression))
|
||||||
(define (linear-form u x)
|
(define (linear-form u x)
|
||||||
; u expression, x a symbol
|
; u expression, x a symbol
|
||||||
(if (eq? u x)
|
(if (eq? u x)
|
||||||
(list 1 0)
|
(list 1 0)
|
||||||
(case (kind u)
|
(case (kind u)
|
||||||
[(symbol-id integer fraction real complex)
|
[(symbol-id integer fraction real complex)
|
||||||
(list 0 u)]
|
(list 0 u)]
|
||||||
[(Times)
|
[(Times)
|
||||||
(if (free-of u x)
|
(if (free-of u x)
|
||||||
(list 0 u)
|
(list 0 u)
|
||||||
(let ([u/x (Quotient u x)])
|
(let ([u/x (Quotient u x)])
|
||||||
(if (Free-of u/x x)
|
(if (Free-of u/x x)
|
||||||
(list u/x 0)
|
(list u/x 0)
|
||||||
#f)))]
|
#f)))]
|
||||||
[(Plus)
|
[(Plus)
|
||||||
(let ([f (linear-form (operand u 1) x)])
|
(let ([f (linear-form (operand u 1) x)])
|
||||||
(and f
|
(and f
|
||||||
(let ([r (linear-form (Minus u (operand u 1)))])
|
(let ([r (linear-form (Minus u (operand u 1)))])
|
||||||
(and r
|
(and r
|
||||||
(list (+ (operand f 0) (operand r 0))
|
(list (+ (operand f 0) (operand r 0))
|
||||||
(+ (operand f 1) (operand r 1)))))))]
|
(+ (operand f 1) (operand r 1)))))))]
|
||||||
[else
|
[else
|
||||||
(and (free-of u x)
|
(and (free-of u x)
|
||||||
(list 0 u))]))))
|
(list 0 u))]))))
|
||||||
|
|
||||||
(module equation-expression racket
|
(module equation-expression racket
|
||||||
(require (submod ".." expression))
|
(require (submod ".." expression))
|
||||||
|
@ -785,68 +806,50 @@
|
||||||
(values (map (curryr operand 0) (operands t=r-List))
|
(values (map (curryr operand 0) (operands t=r-List))
|
||||||
(map (curryr operand 1) (operands t=r-List)))))
|
(map (curryr operand 1) (operands t=r-List)))))
|
||||||
|
|
||||||
(module bracket-graphics racket
|
|
||||||
(require "../graphics/graphics.rkt")
|
|
||||||
|
|
||||||
(define-syntax (declare/provide-vars stx)
|
|
||||||
(syntax-case stx ()
|
|
||||||
[(_ id ...)
|
|
||||||
#'(begin
|
|
||||||
(define id 'id) ...
|
|
||||||
(provide id) ...)]))
|
|
||||||
|
|
||||||
(provide Graphics)
|
|
||||||
(declare/provide-vars
|
|
||||||
Blend Darker Hue Lighter
|
|
||||||
Circle Disk Line Point Rectangle
|
|
||||||
Text Thickness
|
|
||||||
; Colors
|
|
||||||
Red Blue Green Black White Yellow
|
|
||||||
; Options
|
|
||||||
ImageSize PlotRange
|
|
||||||
))
|
|
||||||
|
|
||||||
(module bracket racket
|
(module bracket racket
|
||||||
(require (submod ".." number-theory)
|
(require (submod ".." number-theory)
|
||||||
(submod ".." expression)
|
(submod ".." expression)
|
||||||
(submod ".." undefined)
|
(submod ".." undefined)
|
||||||
(submod ".." equation-expression)
|
(submod ".." equation-expression)
|
||||||
(submod ".." bracket-graphics))
|
;(submod ".." bracket-graphics)
|
||||||
|
)
|
||||||
(provide ; (all-from-out (submod ".." symbolic-application))
|
(provide ; (all-from-out (submod ".." symbolic-application))
|
||||||
(rename-out [free-of Free-of]
|
(rename-out [free-of Free-of]
|
||||||
[base Base]
|
[base Base]
|
||||||
[const Const]
|
[const Const]
|
||||||
[term Term]
|
[term Term]
|
||||||
[exponent Exponent]
|
[exponent Exponent]
|
||||||
[before? Before?]
|
[before? Before?]
|
||||||
[kind Kind])
|
[kind Kind])
|
||||||
(all-from-out (submod ".." bracket-graphics))
|
;(all-from-out (submod ".." bracket-graphics))
|
||||||
Operand
|
Operand
|
||||||
Operands
|
Operands
|
||||||
Hold
|
Hold
|
||||||
Complete-sub-expressions
|
Complete-sub-expressions
|
||||||
Substitute
|
Substitute
|
||||||
Sequential-substitute
|
Sequential-substitute
|
||||||
Concurrent-substitute
|
Concurrent-substitute
|
||||||
Cons
|
Cons
|
||||||
List
|
List
|
||||||
List-ref
|
List-ref
|
||||||
Plus Minus Times Quotient Power
|
Plus Minus Times Quotient Power
|
||||||
Equal
|
Equal
|
||||||
Expand
|
Expand
|
||||||
Set Member?
|
Set Member?
|
||||||
Variables
|
Variables
|
||||||
Map
|
Map
|
||||||
Apply
|
Apply
|
||||||
Append
|
Append
|
||||||
AppendStar
|
AppendStar
|
||||||
Sin Cos Tan Sqrt
|
Sin Cos Tan Sqrt
|
||||||
Solve-quadratic
|
Solve-quadratic
|
||||||
Solve-linear
|
Solve-linear
|
||||||
List->Set
|
List->Set
|
||||||
Define
|
Define
|
||||||
Range
|
Range
|
||||||
Plot)
|
Plot)
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; INVARIANT
|
;;; INVARIANT
|
||||||
|
@ -888,7 +891,7 @@
|
||||||
|
|
||||||
(define (Cons u1 u2)
|
(define (Cons u1 u2)
|
||||||
(construct 'List (cons u1 (List->list u2))))
|
(construct 'List (cons u1 (List->list u2))))
|
||||||
|
|
||||||
(define (Set . us)
|
(define (Set . us)
|
||||||
(construct 'Set (set->list (list->set us))))
|
(construct 'Set (set->list (list->set us))))
|
||||||
|
|
||||||
|
@ -1108,12 +1111,12 @@
|
||||||
(define (List? u)
|
(define (List? u)
|
||||||
(and (list? u)
|
(and (list? u)
|
||||||
(eq? (Kind u) 'List)))
|
(eq? (Kind u) 'List)))
|
||||||
|
|
||||||
(define-listable (Sqr u)
|
(define-listable (Sqr u)
|
||||||
(cond
|
(cond
|
||||||
[(real? u) (sqr u u)]
|
[(real? u) (sqr u u)]
|
||||||
[else (Power u 2)]))
|
[else (Power u 2)]))
|
||||||
|
|
||||||
(define-syntax (define-real-function stx)
|
(define-syntax (define-real-function stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ new old)
|
[(_ new old)
|
||||||
|
@ -1141,7 +1144,7 @@
|
||||||
(define-real-function Ceiling ceiling)
|
(define-real-function Ceiling ceiling)
|
||||||
(define-real-function Truncate truncate)
|
(define-real-function Truncate truncate)
|
||||||
(define-real-function Sgn sgn)
|
(define-real-function Sgn sgn)
|
||||||
|
|
||||||
(define (Solve-quadratic a b c)
|
(define (Solve-quadratic a b c)
|
||||||
; return List of all solutions to ax^2+bx+c=0
|
; return List of all solutions to ax^2+bx+c=0
|
||||||
(define d (Minus (Power b 2) (Times 4 a c)))
|
(define d (Minus (Power b 2) (Times 4 a c)))
|
||||||
|
@ -1192,7 +1195,7 @@
|
||||||
(define (N u)
|
(define (N u)
|
||||||
; TODO: Improve this
|
; TODO: Improve this
|
||||||
(eval u ns))
|
(eval u ns))
|
||||||
|
|
||||||
(define (Plot f range [options '(List)])
|
(define (Plot f range [options '(List)])
|
||||||
; TODO: Implement options
|
; TODO: Implement options
|
||||||
(displayln (list f range))
|
(displayln (list f range))
|
||||||
|
@ -1206,23 +1209,23 @@
|
||||||
(λ (x) (N (Substitute f (Equal var x)))))
|
(λ (x) (N (Substitute f (Equal var x)))))
|
||||||
x-min x-max y-min y-max excluded?)]
|
x-min x-max y-min y-max excluded?)]
|
||||||
[else (error)]))
|
[else (error)]))
|
||||||
|
|
||||||
#;(and (real? x-min) (real? x-max) (real? y-min) (real? y-max)
|
#;(and (real? x-min) (real? x-max) (real? y-min) (real? y-max)
|
||||||
(< x-min x-max) (< y-min y-max))
|
(< x-min x-max) (< y-min y-max))
|
||||||
|
|
||||||
; (define (Monomial-gpe u v)
|
; (define (Monomial-gpe u v)
|
||||||
; (define s (if (eq? (Kind v) 'set) (list v) v))
|
; (define s (if (eq? (Kind v) 'set) (list v) v))
|
||||||
; (cond
|
; (cond
|
||||||
; [(Member? u (operands s)) #t]
|
; [(Member? u (operands s)) #t]
|
||||||
; [else
|
; [else
|
||||||
; (if(power-expression? u)
|
; (if(power-expression? u)
|
||||||
; (define base (Operand u 0))
|
; (define base (Operand u 0))
|
||||||
; (define exponent (Operand u 1))
|
; (define exponent (Operand u 1))
|
||||||
; (if (and (Member? base s)
|
; (if (and (Member? base s)
|
||||||
; (eq? (Kind exponent) 'integer)
|
; (eq? (Kind exponent) 'integer)
|
||||||
; (> exponent 1))
|
; (> exponent 1))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(module test racket
|
(module test racket
|
||||||
(require (submod ".." symbolic-application)
|
(require (submod ".." symbolic-application)
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
(strip-context
|
(strip-context
|
||||||
#'(module anything bracket-lang
|
#'(module anything bracket-lang
|
||||||
(require (submod bracket.rkt bracket)
|
(require (submod bracket.rkt bracket)
|
||||||
(submod bracket.rkt symbolic-application))
|
(submod bracket.rkt symbolic-application)
|
||||||
|
#;(submod bracket.rkt bracket-graphics))
|
||||||
(define-syntax (#%infix stx)
|
(define-syntax (#%infix stx)
|
||||||
(syntax-case stx () [(_ expr) #'expr]))
|
(syntax-case stx () [(_ expr) #'expr]))
|
||||||
; This lists the operators used by the parser.
|
; This lists the operators used by the parser.
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
1 0 32 #"(lib \"text-snipclass.ss\" \"xml\")\0"
|
1 0 32 #"(lib \"text-snipclass.ss\" \"xml\")\0"
|
||||||
1 0 15 #"test-case-box%\0"
|
1 0 15 #"test-case-box%\0"
|
||||||
2 0 1 6 #"wxloc\0"
|
2 0 1 6 #"wxloc\0"
|
||||||
0 0 63 0 1 #"\0"
|
0 0 65 0 1 #"\0"
|
||||||
0 75 1 #"\0"
|
0 75 1 #"\0"
|
||||||
0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9
|
0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9
|
||||||
#"Standard\0"
|
#"Standard\0"
|
||||||
|
@ -236,7 +236,13 @@
|
||||||
-1 -1 2 1 #"\0"
|
-1 -1 2 1 #"\0"
|
||||||
0 71 1 #"\0"
|
0 71 1 #"\0"
|
||||||
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1
|
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1
|
||||||
-1 0 4352 0 26 3 12 #"#lang racket"
|
-1 4 1 #"\0"
|
||||||
|
0 -1 1 #"\0"
|
||||||
|
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
|
||||||
|
-1 -1 45 1 #"\0"
|
||||||
|
0 -1 1 #"\0"
|
||||||
|
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
|
||||||
|
-1 -1 0 4335 0 26 3 12 #"#lang racket"
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 1 #"("
|
0 0 22 3 1 #"("
|
||||||
0 0 14 3 7 #"require"
|
0 0 14 3 7 #"require"
|
||||||
|
@ -2361,8 +2367,7 @@
|
||||||
0 0 22 3 1 #" "
|
0 0 22 3 1 #" "
|
||||||
0 0 14 3 1 #"r"
|
0 0 14 3 1 #"r"
|
||||||
0 0 22 3 3 #")) "
|
0 0 22 3 3 #")) "
|
||||||
0 0 17 3 10 #"; relative"
|
0 0 17 3 34 #"; relative to hor. range "
|
||||||
0 0 17 3 24 #" to hor. range "
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 13 #" ("
|
0 0 22 3 13 #" ("
|
||||||
0 0 15 3 12 #"parameterize"
|
0 0 15 3 12 #"parameterize"
|
||||||
|
@ -2394,8 +2399,7 @@
|
||||||
0 0 22 3 1 #" "
|
0 0 22 3 1 #" "
|
||||||
0 0 14 3 1 #"r"
|
0 0 14 3 1 #"r"
|
||||||
0 0 22 3 3 #")) "
|
0 0 22 3 3 #")) "
|
||||||
0 0 17 3 10 #"; relative"
|
0 0 17 3 34 #"; relative to hor. range "
|
||||||
0 0 17 3 24 #" to hor. range "
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 15 #" ("
|
0 0 22 3 15 #" ("
|
||||||
0 0 15 3 12 #"parameterize"
|
0 0 15 3 12 #"parameterize"
|
||||||
|
@ -3218,8 +3222,7 @@
|
||||||
0 0 14 3 5 #"Style"
|
0 0 14 3 5 #"Style"
|
||||||
0 0 22 3 1 #" "
|
0 0 22 3 1 #" "
|
||||||
0 0 19 3 1 #"\""
|
0 0 19 3 1 #"\""
|
||||||
0 0 19 3 7 #"Unknown"
|
0 0 19 3 16 #"Unknown spec ~a\""
|
||||||
0 0 19 3 9 #" spec ~a\""
|
|
||||||
0 0 22 3 2 #" ("
|
0 0 22 3 2 #" ("
|
||||||
0 0 14 3 5 #"first"
|
0 0 14 3 5 #"first"
|
||||||
0 0 22 3 1 #" "
|
0 0 22 3 1 #" "
|
||||||
|
@ -3242,8 +3245,7 @@
|
||||||
0 0 22 3 1 #" "
|
0 0 22 3 1 #" "
|
||||||
0 0 19 3 1 #"\""
|
0 0 19 3 1 #"\""
|
||||||
0 0 19 3 8 #"Internal"
|
0 0 19 3 8 #"Internal"
|
||||||
0 0 19 3 1 #" "
|
0 0 19 3 12 #" error: ~a \""
|
||||||
0 0 19 3 11 #"error: ~a \""
|
|
||||||
0 0 22 3 1 #" "
|
0 0 22 3 1 #" "
|
||||||
0 0 14 3 1 #"p"
|
0 0 14 3 1 #"p"
|
||||||
0 0 22 3 7 #")])])))"
|
0 0 22 3 7 #")])])))"
|
||||||
|
@ -4019,8 +4021,7 @@
|
||||||
0 0 17 3 2 #") "
|
0 0 17 3 2 #") "
|
||||||
0 0 17 3 1 #","
|
0 0 17 3 1 #","
|
||||||
0 0 17 3 1 #"("
|
0 0 17 3 1 #"("
|
||||||
0 0 17 3 1 #"/"
|
0 0 17 3 14 #"/ x (* 2 pi)))"
|
||||||
0 0 17 3 13 #" x (* 2 pi)))"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
|
@ -4033,8 +4034,7 @@
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 1 #" "
|
||||||
0 0 17 3 1 #"1"
|
0 0 17 3 1 #"1"
|
||||||
0 0 17 3 2 #" ("
|
0 0 17 3 2 #" ("
|
||||||
0 0 17 3 1 #"/"
|
0 0 17 3 15 #"/ x (* 2 pi))))"
|
||||||
0 0 17 3 14 #" x (* 2 pi))))"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 50 #"; (Rotate (Rectangle) ,x)))"
|
0 0 17 3 50 #"; (Rotate (Rectangle) ,x)))"
|
||||||
|
@ -4047,16 +4047,14 @@
|
||||||
0 0 17 3 1 #"0"
|
0 0 17 3 1 #"0"
|
||||||
0 0 17 3 2 #" ("
|
0 0 17 3 2 #" ("
|
||||||
0 0 17 3 1 #"*"
|
0 0 17 3 1 #"*"
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 20 #" 4 pi) (* 2/24 pi)))"
|
||||||
0 0 17 3 19 #"4 pi) (* 2/24 pi)))"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
0 0 17 3 3 #" "
|
0 0 17 3 3 #" "
|
||||||
0 0 17 3 1 #"'"
|
0 0 17 3 1 #"'"
|
||||||
0 0 17 3 2 #"(("
|
0 0 17 3 2 #"(("
|
||||||
0 0 17 3 5 #"Range"
|
0 0 17 3 24 #"Range ((-2 2) (-2 2)))))"
|
||||||
0 0 17 3 19 #" ((-2 2) (-2 2)))))"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
|
@ -4265,8 +4263,7 @@
|
||||||
0 0 17 3 3 #"0.0"
|
0 0 17 3 3 #"0.0"
|
||||||
0 0 17 3 1 #","
|
0 0 17 3 1 #","
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 1 #" "
|
||||||
0 0 17 3 3 #"1.0"
|
0 0 17 3 33 #"1.0]>; given: -0.0416666666666663"
|
||||||
0 0 17 3 30 #"]>; given: -0.0416666666666663"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
|
@ -4386,8 +4383,7 @@
|
||||||
0 0 17 3 1 #","
|
0 0 17 3 1 #","
|
||||||
0 0 17 3 2 #" {"
|
0 0 17 3 2 #" {"
|
||||||
0 0 17 3 1 #"x"
|
0 0 17 3 1 #"x"
|
||||||
0 0 17 3 2 #", "
|
0 0 17 3 10 #", 0, 10}]]"
|
||||||
0 0 17 3 8 #"0, 10}]]"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 2 #"; "
|
0 0 17 3 2 #"; "
|
||||||
|
@ -5086,8 +5082,7 @@
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 16 #";Graphics[Table["
|
||||||
0 0 17 3 15 #"Graphics[Table["
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
|
@ -5099,8 +5094,7 @@
|
||||||
0 0 17 3 1 #"0"
|
0 0 17 3 1 #"0"
|
||||||
0 0 17 3 1 #","
|
0 0 17 3 1 #","
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 1 #" "
|
||||||
0 0 17 3 3 #"0.5"
|
0 0 17 3 28 #"0.5]}], ; black, opacity 50%"
|
||||||
0 0 17 3 25 #"]}], ; black, opacity 50%"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
|
@ -5117,8 +5111,7 @@
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 1 #" "
|
||||||
0 0 17 3 1 #"1"
|
0 0 17 3 1 #"1"
|
||||||
0 0 17 3 1 #","
|
0 0 17 3 1 #","
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 7 #" 0.6], "
|
||||||
0 0 17 3 6 #"0.6], "
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
|
@ -5143,8 +5136,7 @@
|
||||||
0 0 17 3 1 #","
|
0 0 17 3 1 #","
|
||||||
0 0 17 3 2 #" ("
|
0 0 17 3 2 #" ("
|
||||||
0 0 17 3 3 #"8-r"
|
0 0 17 3 3 #"8-r"
|
||||||
0 0 17 3 1 #")"
|
0 0 17 3 7 #")/3]}, "
|
||||||
0 0 17 3 6 #"/3]}, "
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
|
@ -5154,8 +5146,7 @@
|
||||||
#" {"
|
#" {"
|
||||||
) 0 0 17 3 1 #"r"
|
) 0 0 17 3 1 #"r"
|
||||||
0 0 17 3 1 #","
|
0 0 17 3 1 #","
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 5 #" 6}, "
|
||||||
0 0 17 3 4 #"6}, "
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 17 3 1 #";"
|
0 0 17 3 1 #";"
|
||||||
|
@ -5163,8 +5154,7 @@
|
||||||
(
|
(
|
||||||
#" "
|
#" "
|
||||||
#" {"
|
#" {"
|
||||||
) 0 0 17 3 1 #"q"
|
) 0 0 17 3 8 #"q, 12}]]"
|
||||||
0 0 17 3 7 #", 12}]]"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0 22 3 2 #" "
|
0 0 22 3 2 #" "
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
|
@ -5443,7 +5433,6 @@
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 1 #" "
|
||||||
0 0 17 3 1 #"0"
|
0 0 17 3 1 #"0"
|
||||||
0 0 17 3 1 #" "
|
0 0 17 3 1 #" "
|
||||||
0 0 17 3 1 #"0"
|
0 0 17 3 7 #"0) 5)))"
|
||||||
0 0 17 3 6 #") 5)))"
|
|
||||||
0 0 22 29 1 #"\n"
|
0 0 22 29 1 #"\n"
|
||||||
0 0
|
0 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user