0

I can get maxima to solve an equation but can't figure out why it won't show it's numerical value without typing the extra command/step of float(%). Is there away to automatically convert a solved variable to a numerical format.

Example of equation below:

kill(all); alpha:float(.0014931); endfreq:50; dursec:1200; solve(alpha=log(startfreq/endfreq)/dursec,float(startfreq));

what comes back is startfreq=50%e(44793/25000)

I would like it to say 299.988 instead

Rick T
  • 3,349
  • 10
  • 54
  • 119
  • Cross posted to Mathematics Stack Exchange: [maxima and converting output of variable to float](https://math.stackexchange.com/questions/736585/maxima-and-converting-output-of-variable-to-float) – Flux Nov 07 '22 at 09:06

1 Answers1

0

Well, Maxima prefers exact results (i.e., integers, rational numbers, and symbolic constants) instead of inexact (i.e., float and bigfloat numbers). If you want to work only with numerical solutions, take a look at find_root. E.g.:

(%i1) [alpha, endfreq, dursec] : [0.0014931, 50, 1200] $
(%i2) find_root (alpha = log(startfreq / endfreq)/dursec, startfreq, 1, 500);
(%o2)                          299.9881594652534

Note that to use find_root you must know an interval (here 1 to 500) which contains a root of the equation.

Robert Dodier
  • 16,905
  • 2
  • 31
  • 48