The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Opaque functions and fsolve / numerical methods
04-07-2021, 08:34 PM
Post: #1
Opaque functions and fsolve / numerical methods
Suppose I have an opaque f(x) on the reals. By "opaque" I mean, we don't peek at the function definition, we rely on evaluating it at specific reals. For the sake of example here is a definition to (not) peek at

Code:
EXPORT OPAQUE(I) BEGIN
IF I > 3 THEN
RETURN I;
END;
RETURN I*3+1.2;
END;

Code:

OPAQUE(9)        // 9

Unsurprisingly, we cannot symbolically solve equations like OPAQUE(x)==9. But perhaps surprising, we cannot solve numerically either:

Code:

fsolve(OPAQUE(x)==9,x)  // []

//Prime the solver with a guess that is the correct answer
fsolve(OPAQUE(x)==9,x,9) 
//"fsolve((OPAQUE(x)) = 9,x,9) Error: Bad Argument Type"

The latter might be because of another annoyance, the function cannot be evaluated with subst:

Code:

subst(OPAQUE(x),x=9) //Error: Bad argument type

I suppose I can solve this graphically, but is there a more practical way to use the numerical methods than with fsolve?

My theory is it's trying to pass some CAS type into function input and see if it can exploit the definition of OPAQUE somehow. However, since the function doesn't have a CAS "definition" the nonreal input is a "Bad argument type". But it's a mystery how to force the real input from a numerical solver...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Opaque functions and fsolve / numerical methods - compaqdrew - 04-07-2021 08:34 PM



User(s) browsing this thread: 1 Guest(s)