Ticket #137 (closed enhancement: duplicate)

Opened 7 years ago

Last modified 5 years ago

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

comment:1 Changed 6 years ago by mabshoff

  • Milestone set to Sage-2.10

comment:2 Changed 5 years ago by jason

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

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

Note: See TracTickets for help on using tickets.