[数式処理][Scheme] 算術式を簡単にする

微分などで複雑になった算術式を簡素化するには次のようにする。 (define (simple exp) (define (flat lst op) (append-map! (lambda (x) (if (and (pair? x) (eq? (car x) op)) (flat (cdr x) op) (list x))) lst)) (define (constant-fold args init op) (define (cf args num acc) (cond ((null? args) (values Continue reading [数式処理][Scheme] 算術式を簡単にする


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply

[数式処理][Scheme] 微分する

複雑な微分をするときは計算機に任せた方が良いように思う。 Scheme で微分するには次のようにする。 (define (deriv exp var) (cond ((eq? exp var) 1) ((not (pair? exp)) 0) ((eq? (car exp) ‘-) `(- ,(deriv (cadr exp) var))) ((eq? (car exp) ‘+) `(+ ,(deriv (cadr exp) var) ,(deriv (caddr exp) var))) ((eq? (car Continue reading [数式処理][Scheme] 微分する


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply