Ticket #137 (closed enhancement: duplicate)
notebook %form widget maker
| Reported by: | boothby | Owned by: | boothby |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-2.10.3 |
| Component: | notebook | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
Example:
%form
Enter an integer n=300
Enter a prime p=2
Show prime factors only primes=False
Operate on primes op=
* sum
* product
{{{
v = factor(n%p)
if primes:
for i in v:
print i[0]
else:
for i in v:
print "%d**%d"%i
if op == "sum"
print "Sum of prime factors"
s = 0
for i in v:
s += i[0]*i[1]
print s
if op == "product"
print "Product of distinct prime factors"
s = 1
for i in v:
s *= i[0]
print s
}}}
The above would make an interactive widget which would make an input form for the variables used in the code block. A submit button would read the input fields and display output from the code.
Change History
Note: See
TracTickets for help on using
tickets.
