On May 24, 6:23 am, kcrisman <[email protected]> wrote:
> On May 24, 3:04 am, mankoff <[email protected]> wrote:
>
> > y = x^2
> > show(y)
>
> > In a worksheet in the notebook, this shows x and then a small raised
> > two.
> > I'd like it to show 'y = ' and then that symbol.
>
> What is going on here is that in Python (which Sage is based on), y=
> assigns an object to the name y.
>
> So that y IS now "x^2".
>
> > eqn = y == x^2
> > show(eqn)
>
> > does what I want (y=x^2)
>
> Correct - for the same reason.  But now you have a symbolic relation,
> rather than a symbolic expression.  What would y(3) mean in this
> case?  The thing you have is not a function.
>
> I realize this is not what we always do in math - but that is because
> we are sloppy, similarly to how students sometimes write x^2=2x when
> they take derivatives.  It takes time to adjust to this in computer
> systems (or did for me).
>
> > But the upper code (y=x^2) lets me operate on it (y(3), diff(y), etc.)
> > wherease y==x^2 does not.
>
> > This gets more important with longer more complex equations. For
> > example:
>
> > D(H,mu,alpha,x,y,z) = (H*pi*mu*alpha)/(x*y + z^3)
>
> > When displaying it, it would be nice to see:
> > D = ...
> > But instead I see
> > (H,mu,alpha,x,y,z) |-> ...
>
> > Which isn't clear to someone reading the worksheet that the LHS is D.
>
> Again, D here is not the LHS.  D is a function, and the pretty print
> is showing the standard domain |--> range representation.
>
> However, there is a solution to your dilemma, if you're willing to do
> a little extra work.
>
> html("$D:%s$"%latex(D))
>
> What this does is to turn your thing into HTML.  The latex() gives
> what shows up under show() in the notebook, and the %s tell you what
> belongs there.  The $$ tell jsmath to make it look nice, and the ""
> make sure we know it's a Python string, not something else.
>
> Let us know if this is what you need.
>
> - kcrisman


Thanks for the explanation of why things are the way they are, and the
solution. The solution works great.

  -k.

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to