[Question] Graphing with a List
04-30-2017, 03:59 PM
Post: #2
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: [Question] Graphing with a List
(04-30-2017 03:46 PM)Freire Wrote:  I want to make a graph like this:
Code:
FOR k FROM 1 TO 500 STEP 2 DO y:=k*0.15; x1:=30+f1(k)*0.15; x2:=30+f2(k)*0.15; ARC_P(G0,x1,220-y,0.1,RGB(0,0,255)); ARC_P(G0,x2,220-y,0.1,RGB(255,0,0)); END;
But it takes a long time to evaluate the functions(the functions do lots of tasks), taking like 30 seconds to finish the plot.
To solve this I tried to make lists with values, then to copy to my program,
But I dont know how to copy the values in an easy way instead of formatting myself.
Does someone has an easy solution for this?
Code:
L1:=MAKELIST(30+f1(k)*0.15,k,1,500,2); L2:=MAKELIST(30+f2(k)*0.15,k,1,500,2); L3:=MAKELIST(k*0.15,k,1,500,2);`

Given a list, you can access the elements using the function syntax. For example, L1(3) would retrieve the third item from list L1. It also works for local variables created in a program. Unless your data changes frequently, I think you have the fastest approach (i.e. generate the data outside of your program, and have your program simply graph the data).

Would it be possible to share your formula for your functions? Perhaps there could be something in the functions that we could help optimize.

Graph 3D | QPI | SolveSys
 « Next Oldest | Next Newest »

 Messages In This Thread [Question] Graphing with a List - Freire - 04-30-2017, 03:46 PM RE: [Question] Graphing with a List - Han - 04-30-2017 03:59 PM RE: [Question] Graphing with a List - Freire - 04-30-2017, 04:31 PM RE: [Question] Graphing with a List - Freire - 05-01-2017, 02:59 AM RE: [Question] Graphing with a List - Giancarlo - 05-01-2017, 11:31 AM RE: [Question] Graphing with a List - Freire - 05-01-2017, 03:30 PM RE: [Question] Graphing with a List - Tim Wessman - 05-01-2017, 04:26 PM

User(s) browsing this thread: 1 Guest(s)