Fork me on GitHub
Math for the people, by the people.

User login

code for Simpson's rule

Type of Math Object: 
Algorithm
Major Section: 
Reference

Mathematics Subject Classification

65D32 no label found

Comments

I thought it would be a nice idea having examples of coding some of algorithms in here, but instead of creating 20 pages for each major language, it'd be better to post all versions into a single page

I've written this one in python, but if anyone else wants to add some other languages, could be meerged with this entry. Just remember
*CLARITY and SIMPLICITY* over optimizations and language-specific tricks.

It's much better to have code which can be read and understood, even if it's not the most efficient way.

Ah, and about the bug of autolinking happeningg inside verbatim, I'm about to fill a bug report on that (I couldn't find a getaround)
f
G -----> H G
p \ /_ ----- ~ f(G)
\ / f ker f
G/ker f

Not a bad idea to add code.

I'm a little skeptical about your "actual value" for the integral;
the integral can be done algebraically to get the "actual" actual value.

I agree the actual value is not the actual vallue I should correct that
f
G -----> H G
p \ /_ ----- ~ f(G)
\ / f ker f
G/ker f

I guess I could fi x this entry by adding manual linkstops, but it will break again whenever a new link (say a new entry mentioning a term) is created, and I cannto be watching over this entry (and other code-related ones I intend to create) all the time.

so, any idea how to make autolinks not wok at all?
f
G -----> H G
p \ /_ ----- ~ f(G)
\ / f ker f
G/ker f

Perhaps \PMlinkescapetext the whole entry, just take care with formatting instructions (formatting commands render only when set outside of \PMlinkescapetext.

--
"Do not meddle in the affairs of wizards for they are subtle and quick to anger."

yes, that's the problem
I need to use verbatim environments, which stop the rendering of autolinks
so when viewwing the rendering, not only a link is NOT created, but also the commands that would create the link are inserted and displayed mixed with the code

and I can't use verbatim INSIDE the pm-pseudo latex commands as stated in the documentation

f
G -----> H G
p \ /_ ----- ~ f(G)
\ / f ker f
G/ker f

Can you use link controlling within verbatim? Like when you want something in italics not to be linked you write
\textit{foo \PMlinkescapetext{bar}}
and it works.

--
"Do not meddle in the affairs of wizards for they are subtle and quick to anger."

Yes, I just tried it. It should work by just writing
\begin{verbatim}
\PMlinkescapetext{foo
bar
}
\end{verbatim}

--
"Do not meddle in the affairs of wizards for they are subtle and quick to anger."

it ALMOST works, except by showing the PMlinkescape command as if it were part of the code (i.e. not hidden during rendering)
check the entry on which this thread is attached to see
f
G -----> H G
p \ /_ ----- ~ f(G)
\ / f ker f
G/ker f

I tried your source and it seems to work if you replace \PMlinkescape by \PMlinkescapetext.

--
"Do not meddle in the affairs of wizards for they are subtle and quick to anger."

my god, I didn't notice the mistake, thanks
f
G -----> H G
p \ /_ ----- ~ f(G)
\ / f ker f
G/ker f

Subscribe to Comments for "code for Simpson's rule"