Coder Social home page Coder Social logo

sympy_gamma's Issues

log(e) terms could be cancelled to 1

Hi,

for example for the input: "diff(sin(cos(x^3)^2 + log(e^x)) / (3x^2 + x), x)"

the result contains a log(e) term.

I suspect this could easily be canceled to a 1.

Screenshot:

Anecdotally, for the same input, Maxima is also giving a log(e) term, but when I spell it as "%e", it happily cancels it down.

It's a detail, but then I guess fixing this would make the software ever-so-slightly better than it was before. My feelings about software development is that this the most that can be done on any given day.

Anyway, best regards and congrats on having what seems at a quick glance like a pretty readable and well-organized codebase :)

Cannot multiply integral by constant

It seems that when I multiply an integral by a constant, it only calculates the integral part and ignores the constant. If I put the constant in the integral, it works fine.

It shows the the proper calculation at the top of the first ("SymPy") box, but the formatted version below does not show the constant. The answer it shows in the "Antiderivative forms" section does not account for the constant and the full answer is not shown anywhere.

SymPy Live does not seem to have this issue.

works:
http://www.sympygamma.com/input/?i=integral%281%2F2*x%29

doesn't work:
http://www.sympygamma.com/input/?i=1%2F2*integral%28x%29

Integration steps with multiple substitutions always use "u"

When asking for the integration steps for an integral where multiple substitutions are needed, the variable "u" is always used. For example,
integrate(1/(x_log(x)_log(log(x))))
integrates to log(log(log(x))). Currently, two methods are reported: the first has us substituting u = log(x), and then substituting u = log(u). This second substitution ought not to reuse the variable u - it should say v = log(u), or in any case something that's not u or x. (The second method, substituting u = log(log(x)) in one go, is fine.)

Geometry in SymPy Gamma

Google recently added a feature that lets you solve various geometric problems with their search engine (http://googlesystem.blogspot.com/2014/03/google-geometry-calculator.html, https://support.google.com/websearch/answer/4572089), e.g. calculate the diagonal of a square with 6 cm edge, calculate the area of a triangle with height 4 and base 5. Something like this would be nice for Gamma (perhaps without the NLP for now), especially with interactive results. It's also nice how Google shows the formula.

SymPy has some geometry support, but:

  • No 3D support (which Google has)
  • Some things like diagonal length don't seem to be implemented
  • Does plotting of these shapes work?

image

image

This one is quite impressive, it highlights the corresponding part of the formula when the input field is clicked and shows you the necessary constraints:

image

It also gives you a little derivation of the answer:

image

3D Plotting in Gamma

UI have started work on introducing 3D plotting in Gamma and will be discussing all the issues here. Code will be written in Gamma only...like 2D (D3.js's) not in SymPy.

For detailed explanation of how i wish to achieve it, see My Proposed GSoC Project

This is not a GSoC project.

Slow series expansion and Antiderivative forms's steps

Gamma always calculates Series expansion upto 10 terms which is large for some output and thus, it makes Gamma slow (for such outputs it mostly gives error). Similarly, in the case of Antiderivative forms's steps..there is usually an error...
screenshot from 2014-06-12 18 32 41

Tests for SymPy Gamma

Recently I found out that my PR #33 where i sorted a dictionary actually created another issue with satisfiable which needed another PR #39, So i think we should add tests in Django. This will actually help us a lot while reviewing.

TypeError in a predefined example under Discrete Maths

Discrete Mathematics > Boolean Logic > (x | y) & (x | ~y) & (~x | y) gives:

There was an error in Gamma. For referencethe last five traceback entries are: Traceback (most recent call last):
  File "/base/data/home/apps/s~sympy-gamma-hrd/20.374009304867725665/app/views.py", line 278, in eval_card
    result = g.eval_card(card_name, expression, variable, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/20.374009304867725665/app/logic/logic.py", line 326, in eval_card
    'output': card.format_output(result, mathjax_latex)
  File "/base/data/home/apps/s~sympy-gamma-hrd/20.374009304867725665/app/logic/resultsets.py", line 61, in format_output
    return self.card_info['format_output_function'](output, formatter)
  File "/base/data/home/apps/s~sympy-gamma-hrd/20.374009304867725665/app/logic/resultsets.py", line 385, in _format_dict
    for key, val in sorted(dictionary.iteritems()):
  File "/base/data/home/apps/s~sympy-gamma-hrd/20.374009304867725665/sympy/sympy/core/relational.py", line 226, in __nonzero__
    raise TypeError("symbolic boolean expression has no truth value.")
TypeError: symbolic boolean expression has no truth value.

Direct link

function "print_U" in intsteps.py file is not working in the older version of python.

All,
I am using gamma.sympy on older version of python which is 2.6. All the function are working fine. Only "print_U" method in intsteps.py file is not supported in 2.6 version. Particular the below syntax in the "print_U" methods in not supporting
def print_U(self, rule):
with self.new_step(), self.new_u_vars() as (u, du):

So, how can i convert this entire method to support 2.6 version. Or is there any older version of Sympy.gamma exist to support older version of python.

Newer Versions of NumPy need to be made supported in SymPy Gamma

Currently SymPy Gamma, supports the 1.6.1 version of NumPy - listed in app.yaml file.

The latest available version of NumPy as of today, i.e, 18th March'16, is 1.10.4.

Now, if we update NumPy to the latest version,

And then after rebuilding the app.yaml file -:

i) if in app.yaml file , we change the numpy version to the latest one, then the following error pops up n the terminal while starting the Google App Engine-:

(sympygamma) ashutoshsaboo@ASHUTOSH-PC:~/sympy_gamma$ ../Downloads/google_appengine/dev_appserver.py .
Traceback (most recent call last):
  File "../Downloads/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "../Downloads/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1040, in <module>
    main()
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1033, in main
    dev_server.start(options)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 758, in start
    options.config_paths, options.app_id)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 831, in __init__
    module_configuration = ModuleConfiguration(config_path, app_id)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 127, in __init__
    self._config_path)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 424, in _parse_configuration
    config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/api/appinfo_includes.py", line 82, in ParseAndReturnIncludePaths
    appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/api/appinfo.py", line 2190, in LoadSingleAppInfo
    listener.Parse(app_info)
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/api/yaml_listener.py", line 227, in Parse
    self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
  File "/home/ashutoshsaboo/Downloads/google_appengine/google/appengine/api/yaml_listener.py", line 178, in _HandleEvents
    raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: numpy version "1.10.4" is not supported, use one of: "1.6.1"
  in "./app.yaml", line 28, column 1

ii) Or else, in case if we don't edit the app.yaml file after rebuilding it, then error #70 pops up.

I guess, we must ensure that the SymPy Gamma supports the latest version of NumPy, since as newer versions of NumPy come up, it may start deprecating previous functions, then it may cause problems with our code.

Plotting area in SymPy Gamma always shows an Error

This gets displayed in the area where the plot() graphs are generally displayed.

This happens in case of all the queries, in this query as well - plot(sin(x) + cos(2x)). Error shown below. Is there some problem with my installation, or is it an internal issue only? I've followed the installation steps from this link - https://github.com/ashutoshsaboo/sympy_gamma .

I've followed the steps till - Uploading to GAE (Manually) only. As in I haven't followed any steps beyond that title, mentioned in the above link. So, is that causing the issue? Or what is it that's causing this issue?

Plot:
plot(sin(x) + cos(2*x))
There was an error in Gamma. For referencethe last five traceback entries are: Traceback (most recent call last):
  File "/home/ashutoshsaboo/sympy_gamma/app/views.py", line 278, in eval_card
    result = g.eval_card(card_name, expression, variable, parameters)
  File "/home/ashutoshsaboo/sympy_gamma/app/logic/logic.py", line 322, in eval_card
    result = card.eval(evaluator, components, parameters)
  File "/home/ashutoshsaboo/sympy_gamma/app/logic/resultsets.py", line 98, in eval
    return self.card_info['eval_method'](evaluator, components, parameters)
  File "/home/ashutoshsaboo/sympy_gamma/app/logic/resultsets.py", line 562, in eval_plot
    series = series.get_segments()
  File "/home/ashutoshsaboo/sympy_gamma/sympy/sympy/plotting/plot.py", line 457, in get_segments
    sample([self.start, f_start], [self.end, f_end], 0)
AttributeError: 'NoneType' object has no attribute 'random'

Zooming the axes separately

Try this function: (1/x)^(5x)
The most interesting stuff happens around 0<x<10 and 0<y<10 , but I can't zoom x and y axes separately! That's what I get:
example

Use the stats package of sympy

It would be nice to incorporate the stats package of sympy into gamma, in order to allow using Bernoulli, Binomial, 'Normal,variance`, etc.

Updating SymPy version to '1.0'

Currently SymPy Gamma uses an older version of SymPy. SymPy has recently released version 1.0 and SymPy Gamma should use that.

Download as IPython Notebook

It'd be cool to have a link to open the current page as IPython Notebook.

To implement it, I would simply create a Json file (the IPython Notebook format) with all the commands (i.e. derivatives, integrals, graphs, ...). When you load it to the IPython notebook and execute, it should roughly reproduce the SymPy Gamma page.

about safety of eval function

have few queries

  1. sympy-gamma uses eval function. is it safe if i try to integrate it in my site?
  2. if not safe then wat cud be work around it?

Identifies true equation as FALSE

The following equation returns 'False'
Equation : ((sin(x) - cos(x))(sin(x) + cos(x))) == (1 - 2 (cos(x)**2))

How ever individually the RHS and LHS produce the right results
(1 - 2 (cos(x)**2)) = -cos(2x)
((sin(x) - cos(x))(sin(x) + cos(x))) = -cos(2x)

Integral steps error - AttributeError: 'tuple' object has no attribute '_asdict'

link:
http://www.sympygamma.com/input/?i=%284x%2B2%29%2F%283x-4%29

simply click on the "See Steps" button in the "Antiderivative forms" box

I came across this by accident when testing the integral step-by-step feature. Derivative works fine though.

There was an error in Gamma. For reference the last five traceback entries are: Traceback (most recent call last): 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/views.py", line 278, in eval_card 
    result = g.eval_card(card_name, expression, variable, parameters) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/logic.py", line 322, in eval_card 
    result = card.eval(evaluator, components, parameters) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/resultsets.py", line 97, in eval 
    return self.card_info['eval_method'](evaluator, components, parameters) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/resultsets.py", line 643, in eval_intsteps 
    return intsteps.print_html_steps(integrand, components['variable']) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/intsteps.py", line 341, in print_html_steps 
    a = HTMLPrinter(rule) 
AttributeError: 'tuple' object has no attribute '_asdict' 

Confusing letters in chaing rule

Have a look at screenshot,

in first step you define the variable u=sin(5x), but in the sub step 3a another variable with the same name is defined, I think that is rather confusing and a new name such as A should be used for a every chain rule...

screenshot from 2014-05-20 22 40 18

Absolute value in pipes could be replaced with Abs call

Although I'm not sure how much does this project want to follow the Pythonic syntax but I believe that at least this small addition would enhance the overall experience.

There is a substantial difference between

ln(Abs(x -3) + 2)

and

ln(|x -3| + 2)

It seems that ^ already works the way many would expect (http://www.sympygamma.com/input/?i=a^b).


I could try to take a look at that if you find it worth looking into.

UI Improvements

Mentioned on Hacker News/Reddit:

  • The up/down caret is not clickable in the examples
  • Plot of series shows an exception
  • Show the signature/documentation of the Python function on error
  • Copyable plaintext results
  • Simplify button for results
  • satisfiable showing an error
  • Automatically select the input box when the page loads

Natural language was also mentioned. Some resources:

  • Pattern, which offers NLP and machine learning
  • QuePy, which is a library for parsing natural language questions and turning them into database queries
  • A blog post on modern NLP techniques (apparently more state-of-the-art than what NLTK offers)

AttributeError on integral antiderivative form

http://www.sympygamma.com/input/?i=integrate%28x*cos%28-n*x%29%2C+%28x%2C+-pi%2C+0%29%29

 Antiderivative forms:
There was an error in Gamma. For referencethe last five traceback entries are:
Traceback (most recent call last):
File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/views.py", line 278,
in eval_card result = g.eval_card(card_name, expression, variable, parameters)
File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/logic.py", line 322, in eval_card result = card.eval(evaluator, components, parameters)
File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 117, in eval result = card.eval(evaluator, components, parameters)
File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 98, in eval return self.card_info['eval_method'](evaluator, components, parameters)
File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 636, in eval_integral_manual components['variable'])
AttributeError: 'ExprCondPair' object has no attribute 'is_polynomial' 

sympygamma.com fails to integrate an expression and asks to report an issue

Originally reported by @10110111 here

I enter the following into sympygamma.com input field:

integrate((sin(x/17) sin(x/15) sin(x/13) sin(x/11) sin(x/9) sin(x/7) sin(x/5) sin(x/3) sin(x))/x^9,(x,0,oo))

It's a Borwein-type integral, taken from Wolfram Mathematica documentation on its Integrate[] function: http://wolfram.com/xid/0mrb9e-iypuw5 (see "Neat Examples" section for expression and result).

sympygamma.com thinks for about a minute, then says "Looks like we've had a problem...Please report the issue to us so we can fix it!". So I'm reporting it here.

treating xor

I couldn't find a way to use Xor in Gamma. It treats ^ always as ** which should not happen. And if that is that case, there is no way to use xor.

TypeError: unsupported operand type(s) for -: 'Mul' and 'NoneType'

This http://www.sympygamma.com/input/?i=integrate%28exp%28-x%29*sin%281%2Fx%29%2C+%28x%2C+0%2C+oo%29%29

Sometimes says "computation timed out", but sometimes it gives this traceback:

There was an error in Gamma. For referencethe last five traceback entries are: Traceback (most recent call last):
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/views.py", line 278, in eval_card
    result = g.eval_card(card_name, expression, variable, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/logic.py", line 322, in eval_card
    result = card.eval(evaluator, components, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 117, in eval
    result = card.eval(evaluator, components, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 98, in eval
    return self.card_info['eval_method'](evaluator, components, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 636, in eval_integral_manual
    components['variable'])
TypeError: unsupported operand type(s) for -: 'Mul' and 'NoneType'

Which seems like a bug.

More robust terminology detection

When I type point it interprets it as p*o*i*n*t and when I type Point it gives me relevant details from the docs.

A user won't be searching for class name(because they don't know it). So we should enhance this search process maybe by capitalizing the first char or by just suggesting a "Did you mean?".

factorint not showing results

Working on my iPhone in Safari, if I run factorint(1000), then I get the text "prime factorization of 1000" rather than the actual factorization.

Documenting SymPy gamma

If we can, we should create sphinx generated documentations for SymPy gamma. This will help newcomers in understanding the code mainly the logic module.

Exception in integral

http://www.sympygamma.com/input/?i=integrate%282x%5E2y+%2B+2y%5E2%284-x%5E2-y%5E2%29+%2B+x%284-x%5E2-y%5E2%29%2C+%28x%2C+0%2C+1%29%2C+%28y%2C+0%2C+1%29%29

If the integral is made indefinite Gamma doesn't actually evaluate it either (giving an Integral object)

There was an error in Gamma. For referencethe last five traceback entries are: Traceback (most recent call last):
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/views.py", line 278, in eval_card
    result = g.eval_card(card_name, expression, variable, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/logic.py", line 322, in eval_card
    result = card.eval(evaluator, components, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 117, in eval
    result = card.eval(evaluator, components, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 98, in eval
    return self.card_info['eval_method'](evaluator, components, parameters)
  File "/base/data/home/apps/s~sympy-gamma-hrd/24.376529677133784673/app/logic/resultsets.py", line 636, in eval_integral_manual
    components['variable'])
TypeError: unsupported operand type(s) for +: 'Add' and 'NoneType'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.