Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
MapleEvalhf - evaluate an object using hardware floats in external code
EvalhfMapleProc - evaluate a procedure using hardware floats in external code
Calling Sequence
MapleEvalhf(kv, s)
EvalhfMapleProc(kv, fn, n, args)
Parameters
kv
-
kernel handle returned by StartMaple
s
Maple object object
fn
Maple FUNCTION object
n
number of arguments
args
array of n hardware floats
Description
These functions are part of the OpenMaple interface to Microsoft Visual Basic.
The MapleEvalhf function evaluates an expression to a numerical value using the hardware floating-point of the underlying system. This command is equivalent to the Maple function, evalhf.
The EvalhfMapleProc function evaluates the function, f(args), to a numerical value using evalhf. The n arguments provided are all 64-bit hardware floating-point numbers. The first argument must be inserted at args[1]. For example, to call f(3.14,2.718), set args[1] = 3.14, and args[2] = 2.718. The value at args[0] is not used.
Examples
Function MyNewton(ByVal kv As Long) As Double
Dim i As Long
Dim guess(2) As Double
Dim tolerance As Double
Dim f, fprime, x, initguess As Long
' define a function in x to solve, and find it's derivative
f = EvalMapleStatement(kv, "(x) -> x^3+2*x^2-9*x+2;")
MapleAssign kv, ToMapleName(kv, "f", True), f
fprime = EvalMapleStatement(kv, "unapply(diff(f(x),x),x);")
x = ToMapleName(kv, "x", True)
guess(1) = 1.1
tolerance = 0.0001
' find a root (abort after 500 iterations)
For i = 0 To 500
'test current guess
If Abs(EvalhfMapleProc(kv, f, 1, guess(0))) <= tolerance Then
i = 501 'break
Else
'refine guess
guess(1) = guess(1) - EvalhfMapleProc(kv, f, 1, guess(0)) / _
EvalhfMapleProc(kv, fprime, 1, guess(0))
End If
Next i
If i = 500 Then
MyNewton = -999999 'couldn't find root
MyNewton = guess(1)
End Function
See Also
evalhf, OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples
Download Help Document