+ Reply to Thread
Results 1 to 5 of 5

Getting incorrect results for non integer Bessel Functions

  1. #1
    Registered User
    Join Date
    10-16-2017
    Location
    Charlotte
    MS-Off Ver
    2016
    Posts
    31

    Getting incorrect results for non integer Bessel Functions

    I found that when I tried putting non integer Bessel Functions into excel I got the same answer as the Bessel function of the largest integer smaller than that number. I have attached a file to demonstrate what I mean

    Non integer bessel functions in general don't have the same values as integer Bessel functions. Is there a way to calculate the correct value for a non integer Bessel function in Excel?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Getting incorrect results for non integer Bessel Functions

    You seem to be referring to the second parameter ("n").

    What's the mystery? From any of the BESSEL function help pages: ``If n is not an integer, it is truncated``.

  3. #3
    Registered User
    Join Date
    10-16-2017
    Location
    Charlotte
    MS-Off Ver
    2016
    Posts
    31

    Re: Getting incorrect results for non integer Bessel Functions

    Well is there a way to get it to not truncate n besides putting in the taylor series for the function?

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,803

    Re: Getting incorrect results for non integer Bessel Functions

    As near as I can tell, Excel does not have a built in bessel type function that allows non-integer "n". Excel is not open source and MSFT keeps its source code pretty tightly wrapped up, so I don't see an easy way to implement this in using native Excel functions (except, as you note, developing the formula from the GAM() and other functions).

    What are your restrictions and limitations? Excel only? Any spreadsheet? Any programming language?

    If you are not limited to Excel only, I quickly browsed help files for other spreadsheets and noticed that Gnumeric's documentation for its bessel functions specifically mentions Excel's limitation to integer alpha in a way that implies that their implementation is not so restricted: https://help.gnome.org/users/gnumeri...nction-BESSELI I cannot test this now, but will be able to test later. However, I mention it now because you might be able to test before I can. Using a spreadsheet other than Excel that is not limited to integer alpha is probably the easiest solution that I see.

    If you are not limited to spreadsheets, you can obviously look to other programming languages. I obviously did not do an exhaustive search, but I see that Python has built in bessel functions (in the scipy library) that are not limited to integer arguments. If you still want the Excel experience, there are ways to write user-defined functions in other programming languages and then link them to Excel (through dlls or add-ins like xlwings). You could write a simple function in another programming language that utilizes a more robust bessel algorithm. Then figure out how to link those functions to Excel (I haven't had to do this myself, so I'm not sure all that is involved. I know of xlwings for python, and I have an add-in where the dll was written in either Fortran or C that has a bunch of VBA "wrapper" functions that call the dll and return results to the spreadsheet rather seemlessly, so I know it can work well).

    A couple of thoughts. A lot depends on whether or not you require a spreadsheet (and/or Excel specifically) for this task or not.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,803

    Re: Getting incorrect results for non integer Bessel Functions

    I cannot verify the absolute accuracy, but I can verify that Gnumeric's bessel functions return different values for real n.
    X -- n -- bessely(x,n)
    0.5 -- 0 -- -0.4445
    0.5 -- 0.5 -- -0.9902
    0.5 -- 1 -- -1.4715

    Not sure if that helps at all.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Gap Analysis / Incorrect results.
    By Ceetrix in forum Excel General
    Replies: 3
    Last Post: 08-06-2019, 10:24 AM
  2. Search and display results in userform Issue. Results are incorrect
    By olypro in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2019, 10:16 AM
  3. [SOLVED] If and OR function gives incorrect results
    By Karnik in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-05-2018, 04:21 AM
  4. [SOLVED] Incorrect results from sort
    By pongmeister in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-12-2016, 11:20 AM
  5. [SOLVED] Some incorrect results from a formula
    By spittingfire in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-09-2015, 08:25 PM
  6. [SOLVED] Incorrect results of UDF function
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-29-2014, 06:28 PM
  7. [SOLVED] Forumula Results Incorrect when data missing. Wanting to hide the incorrect formula.
    By firemedic6265 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-05-2014, 05:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1