0

Not Yet Answered # graphing using python?

Hi! I'm trying to figure out if it's possible to graph a piecewise mathematical function using Python where the limits of the function are dependent on another variable (i.e., if a > b, graph f(x); if b > a, graph g(x)). I've been trying to google stuff about graphing, but it's just left me more confused. I'm fairly new to programming, so any suggestions would be appreciated!

Kharmak Gribouillis 1,273

0

0

Find a windows like API for Python, I think wxPython library is your best bet for getting started with a GUI. You will then have to place down a control to where you can render the Graph to the screen. You can read up on the wxPython documentation on how you can override the rendering of a given control to render your graph. The mathematical concepts such as function f of x and graph function g of x will be the core of you programming efforts. That should put you on the right track on where you should start.

(Optional) For parsing in custom functions defined by the end user like f of x (f(x)):

You will most likely want to read up on how you will take in the custom function defined by the user and I would suggest reading up on parsing techniques such as "Polish_notation" which can be found on Wikipedia. This will help with parsing parenthesis and most importantly ensuring order of operations.

0

I think you should try **matplotlib**. See this code snippet http://www.daniweb.com/code/snippet216915.html and other examples here http://matplotlib.sourceforge.net/ (especially the gallery http://matplotlib.sourceforge.net/gallery.html).

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

I'm trying to figure out how do i print a distinct enum value by using a conditional statement in my construction of array.

I have a enum declaration

`enum Animal {Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Sheep, Monkey, Rooster, Dog, Pig};`

And i construct my array using a voidptr ...

I need to comput and display the sum and average of the cubes of the even natural numbers between 2 and n. Where n is entered by the user. Im stuck on how to average the sum of the cubes. Help Please. This is what I have so far.

`def ...`

I'm new to python, for my project I need to send mail from python.. I'm getting the following error can someone please help me how to get out of it..

```
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for ...
```