mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2012-08-21, 05:09   #1
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

22·79 Posts
Default pari

Using pari how do we plot graphs: For example would be glad to receive step by step instructions to plot

2^n+ 7.
tks
devarajkandadai is offline   Reply With Quote
Old 2012-08-21, 05:42   #2
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

24·643 Posts
Default

Quote:
Originally Posted by devarajkandadai View Post
would be glad to receive step by step instructions to plot 2^n+ 7.
step 1: open pari/gp
step 2: write at the command prompt: plot(x=-10,10,2^x+7) and press enter

Code:
(12:40:06) gp > ?plot
plot(X=a,b,expr,{Ymin},{Ymax}): crude plot of expression expr, X goes from a to b, with Y ranging from Ymin to Ymax. If Ymin (resp. Ymax) is not
given, the minima (resp. the maxima) of the expression is used instead.

(12:40:10) gp > plot(x=-10,10,2^x+7)

     1031 |''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''"
          |                                                              :
          |                                                             :|
          |                                                             :|
          |                                                             x|
          |                                                             :|
          |                                                            : |
          |                                                            _ |
          |                                                            : |
          |                                                           :  |
          |                                                           x  |
          |                                                              |
          |                                                          _   |
          |                                                              |
          |                                                         x    |
          |                                                        _     |
          |                                                              |
          |                                                      _"      |
          |                                                     _        |
          |                                                   _"         |
          |                                               __x"           |
        0 ________________________________xxxxxxxxxxxxx""",,,,,,,,,,,,,,,,
          -10                                                           10
(12:40:54) gp >

Last fiddled with by LaurV on 2012-08-21 at 05:43 Reason: code
LaurV is offline   Reply With Quote
Old 2012-08-22, 05:18   #3
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

22×79 Posts
Default pari

Thank you very much; will try.
devarajkandadai is offline   Reply With Quote
Old 2012-08-22, 05:24   #4
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

13C16 Posts
Default pari

Thanks once again. Just tried- success!
devarajkandadai is offline   Reply With Quote
Old 2012-08-22, 06:47   #5
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

283016 Posts
Default

you can type "?10" at pari prompt (without quotes) for help on plotting functions. If you have the bitmaps associated with some application (like ms fax wiewer, ACDSee, whatever) then you can also use "ploth" function. That would make a nice bitmap/jpg/gif from your graphic and send it to the associated application, so you can see it on screen in a nice graphic mode.
Try:

ploth(x=-10,10,sin(x)/x)
LaurV is offline   Reply With Quote
Old 2012-08-22, 13:58   #6
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dartmouth NS

2×52×132 Posts
Default

Quote:
Originally Posted by LaurV View Post
you can type "?10" at pari prompt (without quotes) for help on plotting functions. If you have the bitmaps associated with some application (like ms fax wiewer, ACDSee, whatever) then you can also use "ploth" function. That would make a nice bitmap/jpg/gif from your graphic and send it to the associated application, so you can see it on screen in a nice graphic mode.
Try:

ploth(x=-10,10,sin(x)/x)
is there any way for it to only use integer values ? I figured it out, in my older version of GP it does it right inside a new window of pari/gp

Last fiddled with by science_man_88 on 2012-08-22 at 14:01
science_man_88 is online now   Reply With Quote
Old 2012-08-28, 04:57   #7
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

22·79 Posts
Default pari

Quote:
Originally Posted by LaurV View Post
you can type "?10" at pari prompt (without quotes) for help on plotting functions. If you have the bitmaps associated with some application (like ms fax wiewer, ACDSee, whatever) then you can also use "ploth" function. That would make a nice bitmap/jpg/gif from your graphic and send it to the associated application, so you can see it on screen in a nice graphic mode.
Try:

ploth(x=-10,10,sin(x)/x)
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?

Last fiddled with by Batalov on 2012-08-28 at 05:16 Reason: wrapped in [code]
devarajkandadai is offline   Reply With Quote
Old 2012-08-28, 05:02   #8
devarajkandadai
 
devarajkandadai's Avatar
 
May 2004

22·79 Posts
Default completing a circle

Reading GPRC: /cygdrive/c/Program Files/PARI/.gprc ...Done.

GP/PARI CALCULATOR Version 2.3.4 (released)
i686 running cygwin (ix86/GMP-4.2.1 kernel) 32-bit version
compiled: Jul 12 2008, gcc-3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
(readline v5.2 enabled, extended help available)

Copyright (C) 2000-2006 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and
comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
(10:20) gp > 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 >The above is actually a semi-circle; how do I program a full circle pl?
devarajkandadai is offline   Reply With Quote
Old 2012-08-28, 06:29   #9
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

1028810 Posts
Default

How about "ploth(X=0,2*Pi,[sin(X),cos(X)],1)" ?
LaurV is offline   Reply With Quote
Old 2012-08-28, 06:45   #10
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

24×643 Posts
Default

It doesn't make too much sense to ask the same question over and over...
LaurV is offline   Reply With Quote
Old 2012-08-28, 08:22   #11
axn
 
axn's Avatar
 
Jun 2003

43×127 Posts
Default

Something that almost works

Code:
plot(x=-5,5,sqrt(25-x^2)); plot(x=-5,5,-sqrt(25-x^2))
axn is online now   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 14:30.


Fri Jun 9 14:30:41 UTC 2023 up 295 days, 11:59, 0 users, load averages: 1.05, 1.03, 0.97

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, 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.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔