# "Derivative Calculator" Question

• (2 Pages)
• 1
• 2

## 15 Replies - 1920 Views - Last Post: 15 December 2013 - 04:31 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=336526&amp;s=4a93c7cd84f6e2d69942a5a805b8402b&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #16 Minimalist

Reputation: 38
• Posts: 232
• Joined: 13-November 13

## Re: "Derivative Calculator" Question

Posted 15 December 2013 - 04:31 AM

You have to decide what kind of output you want. A simple example like y= mx^n will either return a string in the form of y= m*n * x^n-1 with n and m numbers or it returns a number of the form y= N. For the first case I have attached some code:
```Public Class Form1

End Sub

Private Sub cmdExit_Click(sender As Object, e As EventArgs) Handles cmdExit.Click
Me.Close()
End Sub

Private Sub cmdCalculate_Click(sender As Object, e As EventArgs) Handles cmdCalculate.Click
Dim dbInputn, dbInputm, dbInputx As Double
Dim txtInput As String = ""
'y=mx^n

If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Input missing")
Exit Sub
End If
dbInputn = CDbl(TextBox1.Text) ' input for n
dbInputm = CDbl(TextBox2.Text) 'input for m
If TextBox3.Text = "" Then
TextBox3.Text = "x"
Else
dbInputx = CDbl(TextBox3.Text)  'input for x
End If
Me.Text= "y =" &  dbInputm & " x ^ " & dbInputn
Dim intCase As Integer = 0
If TextBox3.Text = "x" Then
intCase = 1
End If
Dim m, n As Double
Select Case intCase
Case 1
n = dbInputn - 1
m = dbInputm * dbInputn
Label4.Text = "y = " & m & " x ^" & n

End Select
End Sub
End Class
```

It looks like this: