CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Scheme Executable Terminating Prematurely

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   April 5, 2015, 07:34
Default Scheme Executable Terminating Prematurely
New Member
Join Date: Apr 2015
Posts: 1
Rep Power: 0
ec44 is on a distinguished road
The following program is my first scheme program that I designed to calculate the values of the variables in the compound interest formula and the compounded continuously formula. I used DrRacket to create an executable, but when I run it in Terminal (Mac), it ends after only the introduction (the part that displays the syntax) and doesn't allow the user to actually use the defined functions. How can I allow the executable to continue and allow the user to actually use the functions without simply stopping after the introduction?

#lang scheme


(display " a = balance, p = principle, r = rate,")
(display " m = compounding periods, t = time")
(display "Compound Interest Formula:")
(display "(solve-for-balance p r m t)")
(display "(solve-for-principle a r m t)")
(display "(solve-for-rate p a m t)")
(display "(solve-for-time p a r m)")
(display "(solve-for-principle a r m t)")
(display "Interest Compounded Continuously:")
(display "(solve-for-balance-cont p r t)")
(display "(solve-for-principle-cont a r t)")
(display "(solve-for-rate-cont p a t)")
(display "(solve-for-time-cont p a r)")


;Solve for Balance
(define (solve-for-balance p r m t)
(define part1
(+ 1 (/ r m)))
(define part2
(expt part1 (* m t)))
(display "$ ")
(display (* part2 p)))

;Solve for Principle
(define (solve-for-principle a r m t)
(define part1
(+ 1 (/ r m)))
(define part2
(expt part1 (* m t)))
(display "$ ")
(/ a part2))

;Solve for Rate
(define (solve-for-rate p a m t)
(define part1
(expt (/ a p) (/ 1 (* m t))))
(display (* 100 (* m (- part1 1))))
(display " %"))

;Solve for Time
(define (solve-for-time p a r m)
(define part1
(log (expt (/ a p) (/ 1 m))))
(define part2
(log (+ 1 (/ r m))))
(display (/ part1 part2))
(display " years"))


;Defining Euler's Number (e)
(define e 2.7182818284590452353602874713527)

;Solve for Balance (Compounded Continuously)
(define (solve-for-balance-cont p r t)
(display "$ ")
(expt (* p e) (* r t)))

;Solve for Principle (Compounded Continuously)
(define (solve-for-principle-cont a r t)
(display "$ ")
(/ a (expt e (* r t))))

;Solve for Rate (Compounded Continuously)
(define (solve-for-rate-cont p a t)
(display (*(/ (log (/ a p)) t) 100))
(display " %"))

;Solve for Time (Compounded Continuously)
(define (solve-for-time-cont p a r)
(display (/ (log (/ a p)) r))
(display " years"))
ec44 is offline   Reply With Quote

Old   April 6, 2015, 03:34
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 16
`e` is on a distinguished road
Try simplifying your code and seeing exactly which line is not being executed. Should the define commands have trailing brackets?

Does this code have any relevance to Fluent? Why are you using Scheme, why not simply use Excel?
`e` is offline   Reply With Quote


executable, first program, programming, scheme, troubleshoot

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to understand high resolution scheme and high order scheme iilw1314 Main CFD Forum 7 April 12, 2022 12:29
[] mpirun not working in paralleö with OpenMPI zordiack OpenFOAM Installation 15 October 5, 2017 21:45
AUSM scheme ? Central Scheme boling Main CFD Forum 7 January 7, 2016 02:41
2nd order upwind scheme (Fluent and CFX) Far FLUENT 0 May 22, 2011 01:50
extrapolation in MUSCL scheme Chandra Main CFD Forum 6 February 14, 2007 11:21

All times are GMT -4. The time now is 22:07.