mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2012-08-28, 09:41   #12
davieddy
 
davieddy's Avatar
 
"Lucan"
Dec 2006
England

2·3·13·83 Posts
Default

Initialize

x = x + dx
y= y + dy
dx = dx - k*y
dy = dy - k*x
PLOT (x,y)

Keep taking the medicine

TRUST ME

D
davieddy is offline   Reply With Quote
Old 2012-08-28, 11:49   #13
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Quote:
Originally Posted by devarajkandadai View Post
Code:
? plot(x=-5,5,sqrt(25-x^2))
4.9993701 |''''''''''''''''''''''__xxx""""""""xxx__''''''''''''''''''''''|
          |                  _xx"                  "xx_                  |
          |               _x"                          "x_               |
          |             _x                                x_             |
          |           _"                                    "_           |
          |         _x                                        x_         |
          |        _                                            _        |
          |       x                                              x       |
          |      "                                                "      |
          |     "                                                  "     |
          |    "                                                    "    |
          |   "                                                      "   |
          |  x                                                        x  |
          |                                                              |
          | "                                                          " |
          |                                                              |
          |x                                                            x|
          |:                                                            :|
          |:                                                            :|
          :                                                              :
          :                                                              :
        0 _,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_
          -5                                                             5
(10:20) gp >
I got the above which is actually a semi-circle; how do I get a complete circle pl?
well each x value would need 2 solutions I would think:

Quote:
plotlines(w,X,Y,{flag=0}): draws an open polygon in rectwindow w where X and Y contain the x (resp. y) coordinates of the vertices. If X and Y are both single values (i.e not vectors), draw the
corresponding line (and move cursor). If (optional) flag is non-zero, close the polygon.
may work but you need a rectwindow made first
science_man_88 is offline   Reply With Quote
Old 2012-08-28, 14:51   #14
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by axn View Post
Something that almost works

Code:
plot(x=-5,5,sqrt(25-x^2)); plot(x=-5,5,-sqrt(25-x^2))
yeah I tried doing the ploth version it still needs a copy and paste plus some resizing lol
Attached Thumbnails
Click image for larger version

Name:	gpcircle.jpg
Views:	89
Size:	7.2 KB
ID:	8485  

Last fiddled with by science_man_88 on 2012-08-28 at 15:05
science_man_88 is offline   Reply With Quote
Old 2012-08-29, 04:03   #15
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

176116 Posts
Default

Here's a crude technique that works for that case:
Code:
ploth(x=-5,5,sqrt(25-x^2)*(-1)^random(2),64)
CRGreathouse is offline   Reply With Quote
Old 2012-08-29, 10:31   #16
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

5·1,889 Posts
Default

If the threads were merged, then OP's post #8 and my post #10 should be deleted. And this current post too. Thanks.
LaurV is offline   Reply With Quote
Old 2012-08-29, 13:59   #17
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

838410 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Here's a crude technique that works for that case:
Code:
ploth(x=-5,5,sqrt(25-x^2)*(-1)^random(2),64)
Code:
ploth(x=-5,5,(5-abs(x))*(-1)^random(2),64)
works for a rough diamond
science_man_88 is offline   Reply With Quote
Old 2012-08-29, 21:41   #18
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

how could you ploth a rectwindow with multiple curves/lines in it, I know how to make rectwindows and I know how write to a rectwindow I don't see how to ploth the results.

edit: think I found it (plotrecthraw) but don't see how to get it working,okay got it working but not exactly what I wanted by the looks of it.

Last fiddled with by science_man_88 on 2012-08-29 at 21:53
science_man_88 is offline   Reply With Quote
Old 2012-08-30, 02:59   #19
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

5·1,889 Posts
Default

Why my solution in post #9 is not good for you?
Pari's "ploth" is a very clever function, it can plot vectors of functions, even recursion, in many different parametric ways. Try playing with the last "1", make it "0" or none. Or RTFM, it has good examples.

If you keep that fixed idea of using the sqrt(blabla) function, why not try:

ploth(x=-5,5,[sqrt(25-x^2),-sqrt(25-x^2)])

edit: try this for a start:
ploth(x=-5,5,[x^3/25,5*sin(x),x*sin(20*x)/5-1.1*x,sqrt(25-x^2),-sqrt(25-x^2)])

Last fiddled with by LaurV on 2012-08-30 at 03:14
LaurV is offline   Reply With Quote
Old 2012-08-31, 03:38   #20
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

1001111002 Posts
Default pari

Quote:
Originally Posted by science_man_88 View Post
how could you ploth a rectwindow with multiple curves/lines in it, I know how to make rectwindows and I know how write to a rectwindow I don't see how to ploth the results.

edit: think I found it (plotrecthraw) but don't see how to get it working,okay got it working but not exactly what I wanted by the looks of it.
Wd be glad to receive step by step instruction for drawing rectwindow.
devarajkandadai is offline   Reply With Quote
Old 2012-08-31, 12:22   #21
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Quote:
Originally Posted by devarajkandadai View Post
Wd be glad to receive step by step instruction for drawing rectwindow.
see that's kinda my problem I can enter data into them but can't get them by name:

plotinit() initializes a rectwindow
plotrecth() writes data to a rectwindow
plotclip() clips the data to the correct size.
but I can't figure out which one draws the results.

Last fiddled with by science_man_88 on 2012-08-31 at 12:26
science_man_88 is offline   Reply With Quote
Old 2012-08-31, 18:08   #22
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

33·107 Posts
Default

A simple graph of a circle in Pari:

Code:
ploth(X=0,2*Pi,[sin(X),cos(X)], "Parametric")
kar_bon is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is best in life? Is it PARI/GP? JM Montolio A Lounge 11 2018-03-08 06:26
Pari/GP to PFGW carpetpool Programming 6 2017-12-21 06:04
LLL in GP/Pari paul0 Programming 2 2015-11-17 13:04
PARI vs GAP skan Miscellaneous Math 0 2012-12-16 00:13
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22

All times are UTC. The time now is 17:58.

Tue May 11 17:58:14 UTC 2021 up 33 days, 12:39, 1 user, load averages: 2.99, 2.92, 2.93

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.