On Tuesday, September 2, 2014 11:17:35 PM UTC-7, Joachim Durchholz wrote:
>
> Am 03.09.2014 um 02:07 schrieb Richard Fateman: 
> > Sure.  Unlikely to be easy to do by simply hacking on trees. Here's a 
> > classic pattern: 
> > 
> > a*x^2+b*x+c.        a,b,c are pattern variables.  x, in this context, 
>  is a 
> > symbolic constant. 
> > You might like to also impose  a,b,c free of x, and a is non-zero,  to 
> > complete the pattern "quadratic in x" 
> > 
> > match this against the expression 
> > 
> > (45*x+10)^2/5 +q*x+pi 
> > 
> > Yes this can be done, but can you do it by placing attributes on + and 
> *? 
>
> Easily, actually. 
> Just store the entire pattern, including preconditions, in the attribute 
> of the top-level node (+ in this case). 
>
This sounds like "assume that we have a solution"  .  Theorem.  "We have a 
solution".
If you store the entire pattern, then you are hypothesizing that you have a 
program
that matches quadratics.
 

> Actually Python makes this relatively easy since reifying functions is 
> fussless and reifying expressions as lambdas is lightweight (can't beat 
> Haskell or Lisp in that area, of course). 
>
> This would probably also make it easier to check for pattern overlap. 
>
I don't understand why you say this. 

>
> > I suppose there is also the question of whether you want this to match 
> or 
> > not. 
>
> That's a strategy question: Which of multiple applicable rules do we 
> want to apply? 
>

If you are writing a program that does something with quadratics, e.g.
integrating   1/quadratic_in_x,   then how do you want to match quadratics?
 

> RUBI requires that at most one rule be applicable at a time (i.e. no 
> pattern overlap), so strategy is encoded in the preconditions of the 
> rules and it's a non-issue. 
>

You seem to be asserting that this requirement is trivially satisfied. 
Are you sure?   The other requirement that I mentioned, related to
termination, is distinctly not trivially satisfied unless you can prove
things about simplification.
 

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/3f495ba5-20f5-4825-a978-f8961ed7c1f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to