Opened 10 years ago

Last modified 5 years ago

#8616 needs_work enhancement

Make desolve deduce the variable if you don't state it

Reported by: yuri.k Owned by: burcin
Priority: major Milestone: sage-6.4
Component: symbolics Keywords: symbolic, type, subexpression
Cc: robert.marik, novoselt Merged in:
Authors: Yuri Karadzhov Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by yuri.k)

Provides autodetect dependent and independent variables in desolve(), desolve_laplace()

Additionally as module which helps to solve first problem provides unified interface for standard python types and sage specific types. Treats everything as symbolic expression which allows to check its type, take operator and operands and extract subexpressions by given types.

http://groups.google.com/group/sage-devel/browse_thread/thread/f2ba2198dc5b79ed

http://groups.google.com/group/sage-devel/browse_thread/thread/e04cbc547095f2ac

Attachments (4)

trac_8616_symbolic_sage.patch (31.8 KB) - added by yuri.k 10 years ago.
symbolic sage module
trac_8616_symbolic_sage.2.patch (31.8 KB) - added by yuri.k 10 years ago.
symbolic sage module
trac_8616_symbolic_sage_correct.patch (52.2 KB) - added by yuri.k 10 years ago.
trac_8616_symbolic_sage_correct2.patch (1.1 KB) - added by yuri.k 10 years ago.
more precise autodetect of independent variable

Download all attachments as: .zip

Change History (20)

comment:1 Changed 10 years ago by yuri.k

  • Status changed from new to needs_review

Changed 10 years ago by yuri.k

symbolic sage module

Changed 10 years ago by yuri.k

symbolic sage module

comment:2 Changed 10 years ago by yuri.k

  • Description modified (diff)

comment:3 Changed 10 years ago by yuri.k

  • Milestone set to sage-4.4

comment:4 Changed 10 years ago by robert.marik

  • Cc robert.marik added
  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to N/A

comment:5 Changed 10 years ago by robert.marik

Hm I have the following error after installing the patch

ImportError: No module named mtype
Error importing ipy_profile_sage - perhaps you should run %upgrade?
WARNING: Loading of ipy_profile_sage failed.

And there is no mtype.* file in sage/symmbolic in my Sage 4.3.4

comment:6 Changed 10 years ago by novoselt

  • Cc novoselt added

Changed 10 years ago by yuri.k

Changed 10 years ago by yuri.k

more precise autodetect of independent variable

comment:7 Changed 10 years ago by yuri.k

  • Description modified (diff)

comment:8 Changed 10 years ago by yuri.k

  • Description modified (diff)

comment:9 Changed 10 years ago by AlexGhitza

  • Summary changed from Symbolic type checking and expression parcing module to Symbolic type checking and expression parsing module

comment:10 follow-up: Changed 10 years ago by robertwb

  • Status changed from needs_review to needs_work

Thank you for working on desolve, that module is in need of a lot of help. I'm really not seeing what mtype has to do with it though (and what does "mtype" mean? wtype, stype, ... are equally obscure). Also _ for a wildcard is very non-standard notation, perhaps "*.integer" would be better.

In any case, my main issue with this patch is that a huge list of isinstance statements is not the way to implement this--it's brittle and requires the module to know about everything in Sage. If we need an mtype (operator, ...), it should be done OO style, with tests just for a few of the builtin types (and even then it could be cleaner, using their names.

comment:11 in reply to: ↑ 10 Changed 10 years ago by yuri.k

Replying to robertwb:

Thank you for working on desolve, that module is in need of a lot of help. I'm really not seeing what mtype has to do with it though (and what does "mtype" mean? wtype, stype, ... are equally obscure). Also _ for a wildcard is very non-standard notation, perhaps "*.integer" would be better.

_ wildcard is used in scala. * is used for multiply operator. desolve module is really bad it is beter to completly rewrite it, but sage doesn't have enough functions to start doing it. mtype is the firs step. It helps to deal with symbolical expression.

In any case, my main issue with this patch is that a huge list of isinstance statements is not the way to implement this--it's brittle and requires the module to know about everything in Sage. If we need an mtype (operator, ...), it should be done OO style, with tests just for a few of the builtin types (and even then it could be cleaner, using their names.

I absolutely agree with you. It is much better to have class hierarchy or at least some common interface which can help to define type. And wraps or mixins should be used for Python types. But I did mtype class to concentrate attention on existing problem - sage is almost useless for complex symbolical computations (it is my opinion as well as opinion of my colleagues) It is hard for people who are new to python. You shouldn't use mtype, but it is good to do smth about this problem in sage.

I made sketch to solve some simple de problems I write some common functions in mtype, which can be easily rewritten to extract only diff operators. So just use it if you want to.

I finished with sage for this year, now I need to do smth real. I'm sorry I can't afford to spend some more time to finish this improvements.

comment:12 Changed 9 years ago by kcrisman

  • Summary changed from Symbolic type checking and expression parsing module to Make desolve deduce the variable if you don't state it

Changing title to more accurately reflect what it's about.

comment:13 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:14 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:15 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:16 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.