Opened 14 years ago

Closed 13 years ago

#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: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

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 (2)

comment:1 Changed 14 years ago by mabshoff

  • Milestone set to Sage-2.10

comment:2 Changed 13 years ago by jason

  • Resolution set to duplicate
  • Status changed from new to closed

This will be easily possible with William's "manipulate" or "interact" patch on #1322.

Note: See TracTickets for help on using tickets.