找回密码
 欢迎注册
楼主: 无心人

[讨论] PARI/GP的一些笔记

[复制链接]
 楼主| 发表于 2023-11-27 16:56:22 | 显示全部楼层
9)fold, prod, sum

fold(f, A)
f是二元函数f(x, y),A是至少有两个元素的t_VEC
返回f(...f(f(A[1],A[2]),A[3])...,A[#A])
gp > f=(x,y)->x+y
%1 = (x,y)->x+y
gp > fold(f, [1..5])
%2 = 15

prod(X=a, b, expr, {x=1})
遍历a, b然后计算expr, 再把expr结果乘起来
如果最后的参数x默认不是1,再乘以x
gp > prod(i=1, 10, i)
%1 = 3628800
gp > prod(i=1, 10, i, 10)
%2 = 36288000

sum(X = a,b,expr,{x = 0}):
遍历a, b然后计算expr, 再把expr结果加起来
如果最后的参数x默认不是0,再加x
gp > sum(i=1, 10, i)
%1 = 55
gp > sum(i=1, 10, i, 10)
%2 = 65

点评

@nyy, 这个事你来做  发表于 2023-11-28 10:44
nyy
出个pdf  发表于 2023-11-27 20:56
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2024-1-8 12:01:55 | 显示全部楼层
无心人 发表于 2023-11-27 16:56
9)fold, prod, sum

fold(f, A)

我给你添加一个
\l
打开log记录,把输入、输出都保存到log文件里面,也非常有用

点评

nyy
\l第二个是小写字母L  发表于 2024-1-8 13:17
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2024-1-8 13:20:09 | 显示全部楼层
https://spaces.ac.cn/archives/2775/comment-page-1

初试在Python中使用PARI/GP
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2024-1-8 13:30:16 | 显示全部楼层
本帖最后由 nyy 于 2024-1-8 14:04 编辑

关于起始init文件,主要是两个
  1. C:\Program Files (x86)\Pari64-2-15-4\gprc.txt
  2. C:\Program Files (x86)\Pari64-2-15-4\gprc_dft.txt
复制代码


第一个是修改的配置起始init文件,
第二个是配置文件的参考修改文件。

在第一个文件中加入
log=1
那么将开始记录log

所有记录进入
  1. C:\Program Files (x86)\Pari64-2-15-4\pari.log
复制代码

这个文件里面
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2024-1-8 16:02:33 | 显示全部楼层
pari/gp支持在线搜索帮助文件了
https://bbs.emath.ac.cn/thread-18897-1-1.html
(出处: 数学研发论坛)

这个也很重要呀
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2024-1-8 16:14:56 | 显示全部楼层
本帖最后由 nyy 于 2024-1-8 16:16 编辑

log
This can be either 0 (off) or 1, 2, 3 (on, see below for the various modes). When logging mode is turned on, gp opens a log file, whose exact name is determined by the logfile default. Subsequently, all the commands and results will be written to that file (see \l). In case a file with this precise name already existed, it will not be erased: your data will be appended at the end.

The specific positive values of log have the following meaning

1: plain logfile

2: emit color codes to the logfile (if colors is set).

3: write LaTeX output to the logfile (can be further customized using TeXstyle).

The default value is 0.

Note. Logging starts as soon as log is set to a nonzero value. In particular, when log is set in gprc, warnings and errors triggered from the rest of the file will be written in the logfile. For instance, on clean startup, the logfile will start by Done. (from the Reading GPRC:...Done. diagnostic printed when starting gp), then the gp header and prompt.

居然能把结果输出成\(\rm\LaTeX\),这软件有牛逼的地方!

http://pari.math.u-bordeaux.fr/dochtml/html/GP_defaults.html
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2024-1-10 12:19:12 | 显示全部楼层
http://pari.math.u-bordeaux.fr/p ... /2.15.4/refcard.pdf

Pari-GP reference card

这个听过吗?
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2024-1-12 11:22:36 | 显示全部楼层
  1. \\ Limit PARI stack size to 400 Mbytes = 4*10^8 bytes
  2. parisizemax = 400M

  3. \\ Set PARI typical stack size to 40 Mbytes = 4*10^7 bytes (will grow as
  4. \\ needed, up to parisizemax)
  5. parisize = 200M
复制代码


这个是控制内存使用的两个指标!
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-5-2 08:39 , Processed in 0.053470 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表