Ask Your Question

Map_threaded and restriction on the precision

asked 2022-08-25 10:13:49 +0200

Cyrille gravatar image

When Applying map_threaded, is there a way to restrict the number of decimals displayed?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-08-25 10:22:35 +0200

slelievre gravatar image

Use something like .n(digits=4).

Here is an example.

sage: f = lambda x: log(x).n(digits=4)
sage: map_threaded(f, [[1, 2], [3, e]])
[[0.0000, 0.6931], [1.099, 1.000]]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-08-25 10:13:49 +0200

Seen: 99 times

Last updated: Aug 25 '22