| 1 |
# Checking the functions. -*- Autotest -*- |
| 2 |
|
| 3 |
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012, |
| 4 |
# 2013 Free Software Foundation, Inc. |
| 5 |
# |
| 6 |
# This file is part of GNU libmatheval |
| 7 |
# |
| 8 |
# GNU libmatheval is free software: you can redistribute it and/or |
| 9 |
# modify it under the terms of the GNU General Public License as |
| 10 |
# published by the Free Software Foundation, either version 3 of the |
| 11 |
# License, or (at your option) any later version. |
| 12 |
# |
| 13 |
# GNU libmatheval is distributed in the hope that it will be useful, but |
| 14 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
# General Public License for more details. |
| 17 |
# |
| 18 |
# You should have received a copy of the GNU General Public License |
| 19 |
# along with GNU libmatheval. If not, see |
| 20 |
# <http://www.gnu.org/licenses/>. |
| 21 |
|
| 22 |
AT_BANNER([[Checking evaluating functions.]]) |
| 23 |
|
| 24 |
AT_SETUP([Check functions.]) |
| 25 |
|
| 26 |
AT_DATA([function.scm], |
| 27 |
[[ |
| 28 |
(define f (evaluator-create "exp(x)")) |
| 29 |
(display (evaluator-evaluate-x f 1)) |
| 30 |
]]) |
| 31 |
|
| 32 |
AT_CHECK([matheval.sh function.scm], [ignore], [2.71828182845905], [ignore]) |
| 33 |
|
| 34 |
AT_DATA([function.scm], |
| 35 |
[[ |
| 36 |
(define f (evaluator-create "exp(x)")) |
| 37 |
(define f_prim (evaluator-derivative-x f)) |
| 38 |
(display (evaluator-get-string f_prim)) |
| 39 |
]]) |
| 40 |
|
| 41 |
AT_CHECK([matheval.sh function.scm], [ignore], [exp(x)], [ignore]) |
| 42 |
|
| 43 |
AT_DATA([function.scm], |
| 44 |
[[ |
| 45 |
(define f (evaluator-create "log(x)")) |
| 46 |
(display (evaluator-evaluate-x f 1)) |
| 47 |
]]) |
| 48 |
|
| 49 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 50 |
|
| 51 |
AT_DATA([function.scm], |
| 52 |
[[ |
| 53 |
(define f (evaluator-create "log(x)")) |
| 54 |
(define f_prim (evaluator-derivative-x f)) |
| 55 |
(display (evaluator-get-string f_prim)) |
| 56 |
]]) |
| 57 |
|
| 58 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/x)], [ignore]) |
| 59 |
|
| 60 |
AT_DATA([function.scm], |
| 61 |
[[ |
| 62 |
(define f (evaluator-create "sqrt(x)")) |
| 63 |
(display (evaluator-evaluate-x f 1)) |
| 64 |
]]) |
| 65 |
|
| 66 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.0], [ignore]) |
| 67 |
|
| 68 |
AT_DATA([function.scm], |
| 69 |
[[ |
| 70 |
(define f (evaluator-create "sqrt(x)")) |
| 71 |
(define f_prim (evaluator-derivative-x f)) |
| 72 |
(display (evaluator-get-string f_prim)) |
| 73 |
]]) |
| 74 |
|
| 75 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/(2*sqrt(x)))], [ignore]) |
| 76 |
|
| 77 |
AT_DATA([function.scm], |
| 78 |
[[ |
| 79 |
(define f (evaluator-create "sin(x)")) |
| 80 |
(display (evaluator-evaluate-x f 1)) |
| 81 |
]]) |
| 82 |
|
| 83 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.841470984807897], [ignore]) |
| 84 |
|
| 85 |
AT_DATA([function.scm], |
| 86 |
[[ |
| 87 |
(define f (evaluator-create "sin(x)")) |
| 88 |
(define f_prim (evaluator-derivative-x f)) |
| 89 |
(display (evaluator-get-string f_prim)) |
| 90 |
]]) |
| 91 |
|
| 92 |
AT_CHECK([matheval.sh function.scm], [ignore], [cos(x)], [ignore]) |
| 93 |
|
| 94 |
AT_DATA([function.scm], |
| 95 |
[[ |
| 96 |
(define f (evaluator-create "cos(x)")) |
| 97 |
(display (evaluator-evaluate-x f 1)) |
| 98 |
]]) |
| 99 |
|
| 100 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.54030230586814], [ignore]) |
| 101 |
|
| 102 |
AT_DATA([function.scm], |
| 103 |
[[ |
| 104 |
(define f (evaluator-create "cos(x)")) |
| 105 |
(define f_prim (evaluator-derivative-x f)) |
| 106 |
(display (evaluator-get-string f_prim)) |
| 107 |
]]) |
| 108 |
|
| 109 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-sin(x))], [ignore]) |
| 110 |
|
| 111 |
AT_DATA([function.scm], |
| 112 |
[[ |
| 113 |
(define f (evaluator-create "tan(x)")) |
| 114 |
(display (evaluator-evaluate-x f 1)) |
| 115 |
]]) |
| 116 |
|
| 117 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.5574077246549], [ignore]) |
| 118 |
|
| 119 |
AT_DATA([function.scm], |
| 120 |
[[ |
| 121 |
(define f (evaluator-create "tan(x)")) |
| 122 |
(define f_prim (evaluator-derivative-x f)) |
| 123 |
(display (evaluator-get-string f_prim)) |
| 124 |
]]) |
| 125 |
|
| 126 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/(cos(x)^2))], [ignore]) |
| 127 |
|
| 128 |
AT_DATA([function.scm], |
| 129 |
[[ |
| 130 |
(define f (evaluator-create "cot(x)")) |
| 131 |
(display (evaluator-evaluate-x f 1)) |
| 132 |
]]) |
| 133 |
|
| 134 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.642092615934331], [ignore]) |
| 135 |
|
| 136 |
AT_DATA([function.scm], |
| 137 |
[[ |
| 138 |
(define f (evaluator-create "cot(x)")) |
| 139 |
(define f_prim (evaluator-derivative-x f)) |
| 140 |
(display (evaluator-get-string f_prim)) |
| 141 |
]]) |
| 142 |
|
| 143 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(1/(sin(x)^2)))], [ignore]) |
| 144 |
|
| 145 |
AT_DATA([function.scm], |
| 146 |
[[ |
| 147 |
(define f (evaluator-create "sec(x)")) |
| 148 |
(display (evaluator-evaluate-x f 1)) |
| 149 |
]]) |
| 150 |
|
| 151 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.85081571768093], [ignore]) |
| 152 |
|
| 153 |
AT_DATA([function.scm], |
| 154 |
[[ |
| 155 |
(define f (evaluator-create "sec(x)")) |
| 156 |
(define f_prim (evaluator-derivative-x f)) |
| 157 |
(display (evaluator-get-string f_prim)) |
| 158 |
]]) |
| 159 |
|
| 160 |
AT_CHECK([matheval.sh function.scm], [ignore], [(sec(x)*tan(x))], [ignore]) |
| 161 |
|
| 162 |
AT_DATA([function.scm], |
| 163 |
[[ |
| 164 |
(define f (evaluator-create "csc(x)")) |
| 165 |
(display (evaluator-evaluate-x f 1)) |
| 166 |
]]) |
| 167 |
|
| 168 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.18839510577812], [ignore]) |
| 169 |
|
| 170 |
AT_DATA([function.scm], |
| 171 |
[[ |
| 172 |
(define f (evaluator-create "csc(x)")) |
| 173 |
(define f_prim (evaluator-derivative-x f)) |
| 174 |
(display (evaluator-get-string f_prim)) |
| 175 |
]]) |
| 176 |
|
| 177 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(cot(x)*csc(x)))], [ignore]) |
| 178 |
|
| 179 |
AT_DATA([function.scm], |
| 180 |
[[ |
| 181 |
(define f (evaluator-create "asin(x)")) |
| 182 |
(display (evaluator-evaluate-x f 1)) |
| 183 |
]]) |
| 184 |
|
| 185 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.5707963267949], [ignore]) |
| 186 |
|
| 187 |
AT_DATA([function.scm], |
| 188 |
[[ |
| 189 |
(define f (evaluator-create "asin(x)")) |
| 190 |
(define f_prim (evaluator-derivative-x f)) |
| 191 |
(display (evaluator-get-string f_prim)) |
| 192 |
]]) |
| 193 |
|
| 194 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/sqrt((1-(x^2))))], [ignore]) |
| 195 |
|
| 196 |
AT_DATA([function.scm], |
| 197 |
[[ |
| 198 |
(define f (evaluator-create "acos(x)")) |
| 199 |
(display (evaluator-evaluate-x f 1)) |
| 200 |
]]) |
| 201 |
|
| 202 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 203 |
|
| 204 |
AT_DATA([function.scm], |
| 205 |
[[ |
| 206 |
(define f (evaluator-create "acos(x)")) |
| 207 |
(define f_prim (evaluator-derivative-x f)) |
| 208 |
(display (evaluator-get-string f_prim)) |
| 209 |
]]) |
| 210 |
|
| 211 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(1/sqrt((1-(x^2)))))], [ignore]) |
| 212 |
|
| 213 |
AT_DATA([function.scm], |
| 214 |
[[ |
| 215 |
(define f (evaluator-create "atan(x)")) |
| 216 |
(display (evaluator-evaluate-x f 1)) |
| 217 |
]]) |
| 218 |
|
| 219 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.785398163397448], [ignore]) |
| 220 |
|
| 221 |
AT_DATA([function.scm], |
| 222 |
[[ |
| 223 |
(define f (evaluator-create "atan(x)")) |
| 224 |
(define f_prim (evaluator-derivative-x f)) |
| 225 |
(display (evaluator-get-string f_prim)) |
| 226 |
]]) |
| 227 |
|
| 228 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/(1+(x^2)))], [ignore]) |
| 229 |
|
| 230 |
AT_DATA([function.scm], |
| 231 |
[[ |
| 232 |
(define f (evaluator-create "acot(x)")) |
| 233 |
(display (evaluator-evaluate-x f 1)) |
| 234 |
]]) |
| 235 |
|
| 236 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.785398163397448], [ignore]) |
| 237 |
|
| 238 |
AT_DATA([function.scm], |
| 239 |
[[ |
| 240 |
(define f (evaluator-create "acot(x)")) |
| 241 |
(define f_prim (evaluator-derivative-x f)) |
| 242 |
(display (evaluator-get-string f_prim)) |
| 243 |
]]) |
| 244 |
|
| 245 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(1/(1+(x^2))))], [ignore]) |
| 246 |
|
| 247 |
AT_DATA([function.scm], |
| 248 |
[[ |
| 249 |
(define f (evaluator-create "asec(x)")) |
| 250 |
(display (evaluator-evaluate-x f 1)) |
| 251 |
]]) |
| 252 |
|
| 253 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 254 |
|
| 255 |
AT_DATA([function.scm], |
| 256 |
[[ |
| 257 |
(define f (evaluator-create "asec(x)")) |
| 258 |
(define f_prim (evaluator-derivative-x f)) |
| 259 |
(display (evaluator-get-string f_prim)) |
| 260 |
]]) |
| 261 |
|
| 262 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/((x^2)*sqrt((1-(1/(x^2))))))], [ignore]) |
| 263 |
|
| 264 |
AT_DATA([function.scm], |
| 265 |
[[ |
| 266 |
(define f (evaluator-create "acsc(x)")) |
| 267 |
(display (evaluator-evaluate-x f 1)) |
| 268 |
]]) |
| 269 |
|
| 270 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.5707963267949], [ignore]) |
| 271 |
|
| 272 |
AT_DATA([function.scm], |
| 273 |
[[ |
| 274 |
(define f (evaluator-create "acsc(x)")) |
| 275 |
(define f_prim (evaluator-derivative-x f)) |
| 276 |
(display (evaluator-get-string f_prim)) |
| 277 |
]]) |
| 278 |
|
| 279 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(1/((x^2)*sqrt((1-(1/(x^2)))))))], [ignore]) |
| 280 |
|
| 281 |
AT_DATA([function.scm], |
| 282 |
[[ |
| 283 |
(define f (evaluator-create "sinh(x)")) |
| 284 |
(display (evaluator-evaluate-x f 1)) |
| 285 |
]]) |
| 286 |
|
| 287 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.1752011936438], [ignore]) |
| 288 |
|
| 289 |
AT_DATA([function.scm], |
| 290 |
[[ |
| 291 |
(define f (evaluator-create "sinh(x)")) |
| 292 |
(define f_prim (evaluator-derivative-x f)) |
| 293 |
(display (evaluator-get-string f_prim)) |
| 294 |
]]) |
| 295 |
|
| 296 |
AT_CHECK([matheval.sh function.scm], [ignore], [cosh(x)], [ignore]) |
| 297 |
|
| 298 |
AT_DATA([function.scm], |
| 299 |
[[ |
| 300 |
(define f (evaluator-create "cosh(x)")) |
| 301 |
(display (evaluator-evaluate-x f 1)) |
| 302 |
]]) |
| 303 |
|
| 304 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.54308063481524], [ignore]) |
| 305 |
|
| 306 |
AT_DATA([function.scm], |
| 307 |
[[ |
| 308 |
(define f (evaluator-create "cosh(x)")) |
| 309 |
(define f_prim (evaluator-derivative-x f)) |
| 310 |
(display (evaluator-get-string f_prim)) |
| 311 |
]]) |
| 312 |
|
| 313 |
AT_CHECK([matheval.sh function.scm], [ignore], [sinh(x)], [ignore]) |
| 314 |
|
| 315 |
AT_DATA([function.scm], |
| 316 |
[[ |
| 317 |
(define f (evaluator-create "tanh(x)")) |
| 318 |
(display (evaluator-evaluate-x f 1)) |
| 319 |
]]) |
| 320 |
|
| 321 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.761594155955765], [ignore]) |
| 322 |
|
| 323 |
AT_DATA([function.scm], |
| 324 |
[[ |
| 325 |
(define f (evaluator-create "tanh(x)")) |
| 326 |
(define f_prim (evaluator-derivative-x f)) |
| 327 |
(display (evaluator-get-string f_prim)) |
| 328 |
]]) |
| 329 |
|
| 330 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/(cosh(x)^2))], [ignore]) |
| 331 |
|
| 332 |
AT_DATA([function.scm], |
| 333 |
[[ |
| 334 |
(define f (evaluator-create "coth(x)")) |
| 335 |
(display (evaluator-evaluate-x f 1)) |
| 336 |
]]) |
| 337 |
|
| 338 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.31303528549933], [ignore]) |
| 339 |
|
| 340 |
AT_DATA([function.scm], |
| 341 |
[[ |
| 342 |
(define f (evaluator-create "coth(x)")) |
| 343 |
(define f_prim (evaluator-derivative-x f)) |
| 344 |
(display (evaluator-get-string f_prim)) |
| 345 |
]]) |
| 346 |
|
| 347 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(1/(sinh(x)^2)))], [ignore]) |
| 348 |
|
| 349 |
AT_DATA([function.scm], |
| 350 |
[[ |
| 351 |
(define f (evaluator-create "sech(x)")) |
| 352 |
(display (evaluator-evaluate-x f 1)) |
| 353 |
]]) |
| 354 |
|
| 355 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.648054273663885], [ignore]) |
| 356 |
|
| 357 |
AT_DATA([function.scm], |
| 358 |
[[ |
| 359 |
(define f (evaluator-create "sech(x)")) |
| 360 |
(define f_prim (evaluator-derivative-x f)) |
| 361 |
(display (evaluator-get-string f_prim)) |
| 362 |
]]) |
| 363 |
|
| 364 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(sech(x)*tanh(x)))], [ignore]) |
| 365 |
AT_DATA([function.scm], |
| 366 |
[[ |
| 367 |
(define f (evaluator-create "csch(x)")) |
| 368 |
(display (evaluator-evaluate-x f 1)) |
| 369 |
]]) |
| 370 |
|
| 371 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.850918128239322], [ignore]) |
| 372 |
|
| 373 |
AT_DATA([function.scm], |
| 374 |
[[ |
| 375 |
(define f (evaluator-create "csch(x)")) |
| 376 |
(define f_prim (evaluator-derivative-x f)) |
| 377 |
(display (evaluator-get-string f_prim)) |
| 378 |
]]) |
| 379 |
|
| 380 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(coth(x)*csch(x)))], [ignore]) |
| 381 |
|
| 382 |
AT_DATA([function.scm], |
| 383 |
[[ |
| 384 |
(define f (evaluator-create "asinh(x)")) |
| 385 |
(display (evaluator-evaluate-x f 1)) |
| 386 |
]]) |
| 387 |
|
| 388 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.881373587019543], [ignore]) |
| 389 |
|
| 390 |
AT_DATA([function.scm], |
| 391 |
[[ |
| 392 |
(define f (evaluator-create "asinh(x)")) |
| 393 |
(define f_prim (evaluator-derivative-x f)) |
| 394 |
(display (evaluator-get-string f_prim)) |
| 395 |
]]) |
| 396 |
|
| 397 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/sqrt((1-(x^2))))], [ignore]) |
| 398 |
|
| 399 |
AT_DATA([function.scm], |
| 400 |
[[ |
| 401 |
(define f (evaluator-create "acosh(x)")) |
| 402 |
(display (evaluator-evaluate-x f 1)) |
| 403 |
]]) |
| 404 |
|
| 405 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 406 |
|
| 407 |
AT_DATA([function.scm], |
| 408 |
[[ |
| 409 |
(define f (evaluator-create "acosh(x)")) |
| 410 |
(define f_prim (evaluator-derivative-x f)) |
| 411 |
(display (evaluator-get-string f_prim)) |
| 412 |
]]) |
| 413 |
|
| 414 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/sqrt(((x^2)-1)))], [ignore]) |
| 415 |
|
| 416 |
AT_DATA([function.scm], |
| 417 |
[[ |
| 418 |
(define f (evaluator-create "atanh(x)")) |
| 419 |
(display (evaluator-evaluate-x f 0.5)) |
| 420 |
]]) |
| 421 |
|
| 422 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.549306144334055], [ignore]) |
| 423 |
|
| 424 |
AT_DATA([function.scm], |
| 425 |
[[ |
| 426 |
(define f (evaluator-create "atanh(x)")) |
| 427 |
(define f_prim (evaluator-derivative-x f)) |
| 428 |
(display (evaluator-get-string f_prim)) |
| 429 |
]]) |
| 430 |
|
| 431 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/(1-(x^2)))], [ignore]) |
| 432 |
|
| 433 |
AT_DATA([function.scm], |
| 434 |
[[ |
| 435 |
(define f (evaluator-create "acoth(x)")) |
| 436 |
(display (evaluator-evaluate-x f 2)) |
| 437 |
]]) |
| 438 |
|
| 439 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.549306144334055], [ignore]) |
| 440 |
|
| 441 |
AT_DATA([function.scm], |
| 442 |
[[ |
| 443 |
(define f (evaluator-create "acoth(x)")) |
| 444 |
(define f_prim (evaluator-derivative-x f)) |
| 445 |
(display (evaluator-get-string f_prim)) |
| 446 |
]]) |
| 447 |
|
| 448 |
AT_CHECK([matheval.sh function.scm], [ignore], [(1/((x^2)-1))], [ignore]) |
| 449 |
|
| 450 |
AT_DATA([function.scm], |
| 451 |
[[ |
| 452 |
(define f (evaluator-create "asech(x)")) |
| 453 |
(display (evaluator-evaluate-x f 1)) |
| 454 |
]]) |
| 455 |
|
| 456 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 457 |
|
| 458 |
AT_DATA([function.scm], |
| 459 |
[[ |
| 460 |
(define f (evaluator-create "asech(x)")) |
| 461 |
(define f_prim (evaluator-derivative-x f)) |
| 462 |
(display (evaluator-get-string f_prim)) |
| 463 |
]]) |
| 464 |
|
| 465 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-((1/(x*sqrt((1-x))))*sqrt((1/(1+x)))))], [ignore]) |
| 466 |
|
| 467 |
AT_DATA([function.scm], |
| 468 |
[[ |
| 469 |
(define f (evaluator-create "acsch(x)")) |
| 470 |
(display (evaluator-evaluate-x f 1)) |
| 471 |
]]) |
| 472 |
|
| 473 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.881373587019543], [ignore]) |
| 474 |
|
| 475 |
AT_DATA([function.scm], |
| 476 |
[[ |
| 477 |
(define f (evaluator-create "acsch(x)")) |
| 478 |
(define f_prim (evaluator-derivative-x f)) |
| 479 |
(display (evaluator-get-string f_prim)) |
| 480 |
]]) |
| 481 |
|
| 482 |
AT_CHECK([matheval.sh function.scm], [ignore], [(-(1/((x^2)*sqrt((1+(1/(x^2)))))))], [ignore]) |
| 483 |
|
| 484 |
AT_DATA([function.scm], |
| 485 |
[[ |
| 486 |
(define f (evaluator-create "abs(x)")) |
| 487 |
(display (evaluator-evaluate-x f 1)) |
| 488 |
]]) |
| 489 |
|
| 490 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.0], [ignore]) |
| 491 |
|
| 492 |
AT_DATA([function.scm], |
| 493 |
[[ |
| 494 |
(define f (evaluator-create "abs(x)")) |
| 495 |
(define f_prim (evaluator-derivative-x f)) |
| 496 |
(display (evaluator-get-string f_prim)) |
| 497 |
]]) |
| 498 |
|
| 499 |
AT_CHECK([matheval.sh function.scm], [ignore], [((2*step(x))-1)], [ignore]) |
| 500 |
|
| 501 |
AT_DATA([function.scm], |
| 502 |
[[ |
| 503 |
(define f (evaluator-create "step(x)")) |
| 504 |
(display (evaluator-evaluate-x f 1)) |
| 505 |
]]) |
| 506 |
|
| 507 |
AT_CHECK([matheval.sh function.scm], [ignore], [1.0], [ignore]) |
| 508 |
|
| 509 |
AT_DATA([function.scm], |
| 510 |
[[ |
| 511 |
(define f (evaluator-create "step(x)")) |
| 512 |
(define f_prim (evaluator-derivative-x f)) |
| 513 |
(display (evaluator-get-string f_prim)) |
| 514 |
]]) |
| 515 |
|
| 516 |
AT_CHECK([matheval.sh function.scm], [ignore], [delta(x)], [ignore]) |
| 517 |
|
| 518 |
AT_DATA([function.scm], |
| 519 |
[[ |
| 520 |
(define f (evaluator-create "delta(x)")) |
| 521 |
(display (evaluator-evaluate-x f 1)) |
| 522 |
]]) |
| 523 |
|
| 524 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 525 |
|
| 526 |
AT_DATA([function.scm], |
| 527 |
[[ |
| 528 |
(define f (evaluator-create "delta(x)")) |
| 529 |
(define f_prim (evaluator-derivative-x f)) |
| 530 |
(display (evaluator-get-string f_prim)) |
| 531 |
]]) |
| 532 |
|
| 533 |
AT_CHECK([matheval.sh function.scm], [ignore], [nandelta(x)], [ignore]) |
| 534 |
|
| 535 |
AT_DATA([function.scm], |
| 536 |
[[ |
| 537 |
(define f (evaluator-create "nandelta(x)")) |
| 538 |
(display (evaluator-evaluate-x f 1)) |
| 539 |
]]) |
| 540 |
|
| 541 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 542 |
|
| 543 |
AT_DATA([function.scm], |
| 544 |
[[ |
| 545 |
(define f (evaluator-create "nandelta(x)")) |
| 546 |
(define f_prim (evaluator-derivative-x f)) |
| 547 |
(display (evaluator-get-string f_prim)) |
| 548 |
]]) |
| 549 |
|
| 550 |
AT_CHECK([matheval.sh function.scm], [ignore], [nandelta(x)], [ignore]) |
| 551 |
|
| 552 |
AT_DATA([function.scm], |
| 553 |
[[ |
| 554 |
(define f (evaluator-create "erf(x)")) |
| 555 |
(display (evaluator-evaluate-x f 0)) |
| 556 |
]]) |
| 557 |
|
| 558 |
AT_CHECK([matheval.sh function.scm], [ignore], [0.0], [ignore]) |
| 559 |
|
| 560 |
AT_DATA([function.scm], |
| 561 |
[[ |
| 562 |
(define f (evaluator-create "erf(x)")) |
| 563 |
(define f_prim (evaluator-derivative-x f)) |
| 564 |
(display (evaluator-get-string f_prim)) |
| 565 |
]]) |
| 566 |
|
| 567 |
AT_CHECK([matheval.sh function.scm], [ignore], [(2_sqrtpi*exp((-(x^2))))], [ignore]) |
| 568 |
|
| 569 |
AT_CLEANUP |