Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 10-02-2011, 05:39 PM   #1 (permalink)
BIOS Terminator
 
nims11's Avatar
 
Join Date: Apr 2008
Location: Ranchi
Posts: 816
Default Function Plotter


I wrote this function plotter for my Csc school project. It takes mathematical function(any function of 'x' containing brackets, basic operators(+,-,/,*,^), trigo functions, log,floor,ceil) from the user in form of a string and then evaluates it and plots it in a graph. My program supports multiple plotting of graph and allows graph manipulation options like increasing precision, zooming in/out and shifting.

i want to share this with you guyz.

The main challenge(which ) of this program was "How do i evaluate a mathematical function from a string without restricting the functions inputted by user" which i solved by writing a header file for string evaluation. it has few minor bugs which i will resolve after my board exams.

please run it and let me know of bugs and features that can be added. Should i upload the code too?(its quite shabby and even i confuse sometimes with it).

i have attached the compiled '.exe'.
to avoid bugs, enclose the unary functions in a bracket. eg . x-sin(x) gives a wrong plot(i still need to figure out why) but writing it as x-(sin(x)) works properly.
Function Plotter
nims11 is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 10-02-2011, 06:02 PM   #2 (permalink)
Excessive happiness
 
furious_gamer's Avatar
 
Join Date: Jun 2008
Location: Bangalore
Posts: 2,974
Default Re: Function Plotter

Quote:
Originally Posted by nims11 View Post
I wrote this function plotter for my Csc school project. It takes mathematical function(any function of 'x' containing brackets, basic operators(+,-,/,*,^), trigo functions, log,floor,ceil) from the user in form of a string and then evaluates it and plots it in a graph. My program supports multiple plotting of graph and allows graph manipulation options like increasing precision, zooming in/out and shifting.

i want to share this with you guyz.

The main challenge(which ) of this program was "How do i evaluate a mathematical function from a string without restricting the functions inputted by user" which i solved by writing a header file for string evaluation. it has few minor bugs which i will resolve after my board exams.

please run it and let me know of bugs and features that can be added. Should i upload the code too?(its quite shabby and even i confuse sometimes with it).

i have attached the compiled '.exe'.
to avoid bugs, enclose the unary functions in a bracket. eg . x-sin(x) gives a wrong plot(i still need to figure out why) but writing it as x-(sin(x)) works properly.
Function Plotter
That is how programs work basically. Ever heard about precedence, then you shouldn't have asked this question.

Read This
__________________
My First Android phone : Samsung Galaxy SL i9003 - Rooted & Gingerbread XXKPQ
Updated : superteekz_V2 ROM for XXKPQ.

PS Request
furious_gamer is offline   Reply With Quote
Old 10-02-2011, 06:32 PM   #3 (permalink)
BIOS Terminator
 
nims11's Avatar
 
Join Date: Apr 2008
Location: Ranchi
Posts: 816
Default Re: Function Plotter

Precedence not a problem. i have well defined it in my code. The problem is that i have not considered '-' as an operator because it can conflict with negative numbers. wherever '-' was used as an operator, i replaced it with(+-). like a-b was evaluated as a+(-b). Everything works fine until a unary function is introduced after a '-'.
even x+sin(x) or x*sin(x) or x-x^2 works fine but program fails when evaluating functions like - .....-sin(x).....
nims11 is offline   Reply With Quote
Old 12-02-2011, 02:18 PM   #4 (permalink)
Sid
Right Off the Assembly Line
 
Join Date: Jan 2011
Posts: 11
Default Re: Function Plotter

Hi,

Tried out the application. Will need the code to understand how you are evaluating the given function.

I tried out giving the input as : x + sin(-x) : which gave the correct plot. Now as this is equivalent to : x - sin(x).

Therefore kinda unsure why it fails to plot the correct values.

So if you upload the code, please add the comments. Secondly, i want to know if you have read about expression evaluation using binary trees. This comes under infix, postfix, prefix expression evaluation. If you haven't used this technique of solving the expression, I suggest you read up on that and implement it.
Sid is offline   Reply With Quote
Old 12-02-2011, 09:23 PM   #5 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: Function Plotter

is it 16bit prog??

i get memory read error on 16 bit dos.
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Old 13-02-2011, 07:25 AM   #6 (permalink)
BIOS Terminator
 
nims11's Avatar
 
Join Date: Apr 2008
Location: Ranchi
Posts: 816
Default Re: Function Plotter

Nope its a 32-bit program. i wrote it and compiled under Dev-C++
nims11 is offline   Reply With Quote
Old 13-02-2011, 02:39 PM   #7 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: Function Plotter

Quote:
Originally Posted by nims11 View Post
Nope its a 32-bit program. i wrote it and compiled under Dev-C++
either the file i d/n is corrupted or my both os xp and win 7 r out their minds
Attached Images
File Type: jpg err1.JPG (12.4 KB, 4 views)
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Old 13-02-2011, 06:40 PM   #8 (permalink)
BIOS Terminator
 
nims11's Avatar
 
Join Date: Apr 2008
Location: Ranchi
Posts: 816
Default Re: Function Plotter

Let me comment my source code and i will upload it 2mrw
nims11 is offline   Reply With Quote
Old 13-02-2011, 07:05 PM   #9 (permalink)
Sid
Right Off the Assembly Line
 
Join Date: Jan 2011
Posts: 11
Default Re: Function Plotter

Quote:
Originally Posted by arpanmukherjee1 View Post
either the file i d/n is corrupted or my both os xp and win 7 r out their minds
I managed to run it on Win X64 Home Premium....
Sid is offline   Reply With Quote
Old 13-02-2011, 10:26 PM   #10 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: Function Plotter

Quote:
Originally Posted by nims11 View Post
Let me comment my source code and i will upload it 2mrw
ok . will try to compile with dev-c++ and VC++.

my c++ and c# programs always work. no issues with other exe's or any virus (that i know of).

most proably the file was changed.

you should zip/rar the exe and then upload it again. never leave exe on sharing site , it may become contaminated.
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Charan

Advertisement




All times are GMT +5.5. The time now is 03:25 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2