Hi everybody =)
If got a question about how to do some math stuff in vb.net

I got this function:

f(x) = (((player_hp^1.5)/(player_hp^1.5+x^1.5))
Let's say that player_hp = 3882, so we put in that number instead of "player_hp":
f(x) = (((3882^1.5)/(3882^1.5+x^1.5))

If I differentiate that function on my calculator, I get this:
f'(x) = -(((241870.7195*x^(3)-(10^11*1.755043349)*x^(1.5)-(1.414978659*10^16)))/((x^(1.5)+241870.7195)^(3)))
(yeah, it looks a bit complicated, but that's not intentional. I don't even understand it so well myself.. I only know that I need to solve it.)

Now my question is: how do I solve this equation using visual basic code in asp.net:
-(((241870.7195*x^(3)-(10^11*1.755043349)*x^(1.5)-(1.414978659*10^16)))/((x^(1.5)+241870.7195)^(3))) = 0
(My calculator found out that x = 8609.440178)

If somebody knows, I would also like to know how to differentiate this function using vb code in asp.net:
f(x) = (((3882^1.5)/(3882^1.5+x^1.5))

Thanks in advance! I hope some of you can help =)

ASP.NET 2.0 VB.NETfunctionsolvemathdifferentiationequation

Well, according to your description, I find there is only x^3 and x^1.5 in the equations above.

If we display them like the way below, it will be more clear.

Dim x As Double
Dim a As Double = 241870.7195 * x ^ 3
Dim b As Double = 10 ^ 11 * 1.755043349
Dim c As Double = 1.414978659 * 10 ^ 16
Dim d As Double = 241870.7195
f(x) = -((a - b * x ^ (1.5) - c) / (x ^ 1.5 + d) ^ 3)

So, my suggestion is, let replace x^1.5 with y, so that x^3 will be equal to y^2.

Then, you can get y with some quadratic formulas (you can find them on Internet) and get x with
y^(2/3).

All the other numbers in the equation are just the constants, what you need to do is replace the a, b, c in the formula with them.

Thanks for your help!
You made me understand that there is no such function built in asp.net to solve equations or differentiate them, but that it is possible to solve quadratic equations by writing some code myself. This time, however, I will not do that, because I have found a
simpler way to "solve my problem".
I eventually found out that the solution of f'(x) = 0 was pretty easy to find:
x = player_hp * 2,2167
Complicated formula made simple :)

## iver56

Member

6 Points

35 Posts

## Solve equation using vb.net

Aug 07, 2008 07:20 PM|iver56|LINK

Hi everybody =)

If got a question about how to do some math stuff in vb.net

I got this function:

f(x) = (((player_hp^1.5)/(player_hp^1.5+x^1.5))

Let's say that player_hp = 3882, so we put in that number instead of "player_hp":

f(x) = (((3882^1.5)/(3882^1.5+x^1.5))

If I differentiate that function on my calculator, I get this:

f'(x) = -(((241870.7195*x^(3)-(10^11*1.755043349)*x^(1.5)-(1.414978659*10^16)))/((x^(1.5)+241870.7195)^(3)))

(yeah, it looks a bit complicated, but that's not intentional. I don't even understand it so well myself.. I only know that I need to solve it.)

Now my question is: how do I solve this equation using visual basic code in asp.net:

-(((241870.7195*x^(3)-(10^11*1.755043349)*x^(1.5)-(1.414978659*10^16)))/((x^(1.5)+241870.7195)^(3))) = 0

(My calculator found out that x = 8609.440178)

If somebody knows, I would also like to know how to differentiate this function using vb code in asp.net:

f(x) = (((3882^1.5)/(3882^1.5+x^1.5))

Thanks in advance! I hope some of you can help =)

ASP.NET 2.0 VB.NET function solve math differentiation equation

## Shengqing Ya...

All-Star

40465 Points

2967 Posts

## Re: Solve equation using vb.net

Aug 15, 2008 07:47 AM|Shengqing Yang - MSFT|LINK

Hi iver56,

Well, according to your description, I find there is only x^3 and x^1.5 in the equations above.

If we display them like the way below, it will be more clear.

So, my suggestion is, let replace x^1.5 with y, so that x^3 will be equal to y^2.Then, you can get y with some quadratic formulas (you can find them on Internet) and get x with

y^(2/3).All the other numbers in the equation are just the constants, what you need to do is replace the a, b, c in the formula with them.

Hope the information helps.

Best Regards,

Shengqing Yang

If you have any feedback about my replies, please contact msdnmg@microsoft.com.

Microsoft One Code Framework

## iver56

Member

6 Points

35 Posts

## Re: Solve equation using vb.net

Aug 15, 2008 09:25 PM|iver56|LINK

Hi! :)

Thanks for your help!

You made me understand that there is no such function built in asp.net to solve equations or differentiate them, but that it is possible to solve quadratic equations by writing some code myself. This time, however, I will not do that, because I have found a simpler way to "solve my problem".

I eventually found out that the solution of f'(x) = 0 was pretty easy to find:

x = player_hp * 2,2167

Complicated formula made simple :)

Best regards