geonaf Posted January 29, 2003 Posted January 29, 2003 Hi guys! How can I plot functions in vb net? The user enters a math expression for f(x) and the program plots this.,eg: f(x)=x^2+Sin(x) Is that possible with vb net?? Thanks Quote
PSU_Justin Posted February 28, 2003 Posted February 28, 2003 geonaf, have you answered this question? I'd like to know how to do that too. Quote
PSU_Justin Posted February 28, 2003 Posted February 28, 2003 I figure that you can numerically solve the equation for a small step of x variables and fill an arrary with the soluvtions for both x and f(x), I just don't know how to graph my array. Quote
Leaders Iceplug Posted February 28, 2003 Leaders Posted February 28, 2003 That's what I did. You can just put a function... Private Function F(ByVal X As Currency) As Currency F = X*X End Function Then you can graph it like this: For X = -20 To 20 Y = F(X) 'You can draw Y here with whatever graphics you need 'Preferably a DrawPixel of some sort at (X, Y), however 'it will be upside down, so you'd have to take your Y 'value and negate it. Y = -Y 'Then you need to move it on the visible area of the form. Y += Width 'Where Width is the width of the area that you want to 'see the drawing at. Next Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
geonaf Posted March 2, 2003 Author Posted March 2, 2003 Ok, but the user types in a function, that could be unknown Quote
geonaf Posted March 3, 2003 Author Posted March 3, 2003 Script I have heard that I could use a Script with my application in order to do that.Does anyone know details??? Quote
geonaf Posted March 5, 2003 Author Posted March 5, 2003 Is there a command which can convert string variables to arithmetical values, eg: user types "x^2+5*x" as string and the machine regocnise it as an operation.??????? Quote
Leaders Iceplug Posted March 6, 2003 Leaders Posted March 6, 2003 There may be some addin of some sort (like a MS Scripting addin) that will do this for you, but I doubt if .NET comes with a way to do this, mainly because there are so many ways to parse an arithmetic function. You would have to either hardcode all the functions or use the polynomial approach, in which you specify the coefficients for each exponent... i.e. for x^3 + 3x^2 + 12, you would have 1, 3, 0, and 12. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.