defining the zero's of function 
Author Message
 defining the zero's of function

Hi everyone,

I'm looking for the function in Excel (Visual Basic macro), with whom I can
calculate the following function

f(x) = a^x + x + c = 0

I would like to calculte the value of x.

regards,

Vladimir



Wed, 18 Jun 1902 08:00:00 GMT  
 defining the zero's of function
Hi Vladimir,

Do you really need a function?

If you just need a one-off calculation for a given set of a and c you might
as well write your formula in a cell and perform a goalseek.

If you really need a function I could send an example of a VBA goalseek
macro, but I'm sure there are professional ones to be found on the Internet.
I just don't know where.

Groeten,

Niek Otten


Quote:
> Hi everyone,

> I'm looking for the function in Excel (Visual Basic macro), with whom I
can
> calculate the following function

> f(x) = a^x + x + c = 0

> I would like to calculte the value of x.

> regards,

> Vladimir



Wed, 18 Jun 1902 08:00:00 GMT  
 defining the zero's of function
I will make an assumption that you really meant:

    a x^2 + bx + c  = 0

rather than
    a^x + x + c = 0

If you really meant the latter, then disregard.

You just need to implement the quadratic formula.   Here is a quick
example - minimal error checking:

Handles    a X^2 + bX + c  = 0

Sub Quadratic()
Dim a As Double
Dim b As Double
Dim c As Double
Dim x As Double
Dim y As Double

a = 1 'coefficient of X^2 term
b = 0 'coefficient of X^1 term
c = -4 ' coeffient of X^0 term
x = b ^ 2

y = 4 * a * c
If (x - y) >= 0 Then
  res1 = (-b + Sqr(x - y)) / (2 * a)
  res2 = (-b - Sqr(x - y)) / (2 * a)
Else
 res1 = "complex Number"
 res2 = "complex Number"
End If
Debug.Print res1, res2
End Sub

Regards,
Tom Ogilvy


Quote:
>Hi everyone,

>I'm looking for the function in Excel (Visual Basic macro), with whom I can
>calculate the following function

>f(x) = a^x + x + c = 0

>I would like to calculte the value of x.

>regards,

>Vladimir



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Zero's, Zero's, Zero's

2. Run-time error '1004': Appliaction-defined or object-defined error

3. Run-time error '1004':Application-defined or object-defined error

4. 'user-defined type not defined'

5. Using Format function inside User Defined Function changes function value

6. Average function and ignoreing zero's

7. User defined functions won't recalculate

8. Really elementary but I'm stumped - Calling a user-defined function

9. Can't set cell values from user-defined function

10. DirectDependents doesn't work in User-defined function call


 
Powered by phpBB® Forum Software © phpBB Group