Coding solution to code step by step algorithm-solver - python

This is a rather general question: There is this webpage which lets you calculate Eigenvalues, Eigenspaces, etc... It also gives you step-by-step solutions. Is there any coding language or module (preferably in Python) which makes it easier to code something like this, or must this be coded manually?
Thank you for your help.

Related

Understanding Gurobi Python as a Beginner

I am novice in Gurobi Language. I am trying to solve some LPs and MIPs using GurobiPy, so the approach I thought I would take was to look at some examples how to add constraints and all. But in the examples provided by Gurobi website, the actual documentation on how to add mathematical constraints to the model was like finding a needle in haystack. From my fellow seniors I would like to know how can I approach to learn to add constraints actually. Thank you. I already found some understanding, but there are things like sum( * , 1) etc which I don't really understand.
These tutorials can be a starting point:
https://www.gurobi.com/resource/abremod-getting-started-intro/
To get more help here on StackOverflow, please consider phrasing your question less broad and try to ask a specific question.

Algorithms for implementing analytic calculus

I'm interested in writing a program in Python that can parse a mathematical expression and carry out operations on it in algebraic form. Most of these will be pretty easy, something like 2x+5x+xy. My program would take this and return the simplified 7x+xy. However I'd also like to eventually extend it's functionality to calculus as well, so if it's given something like integrate: 5x it should be able to return (5x^2)/2 + c. I'm aware that for this the sympy library can be used, but I'm interested in implementing it myself as a learning process. Are there any algorithims that exist to carry out algebraic calculus for any arbitrary integral/differential I could implement, or is this a more daunting task I've set for myself here? Any reasources would be appreciated.
It might be worthwhile to ask why you're looking at doing this, and understanding the sorts of things that you want to be able to integrate, because I think you might not know that you've actually stumbled onto a very difficult question.
If you are looking for an exercise to learn about simple low level polynomial integration and python - ie. something of the form x^2 + 2x + 7 - and the idea is to learn about string manipulation and simple math, then by all means I think you should attempt to do this and see how far you can get. Look at the various math related libaries (like Sympy or Numpy) and see what you can get.
If you are looking to produce a powerful tool to be used for Calculus, then I think you should rethink your idea and consider using something like Wolfram Alpha. A project like this could take years and you might not get a good result from it.

Python Procedural 2d map generator explanation

So i found a certain procedural map generator in Python and I understand parts of it but i'm having a very hard time piecing it together to be able to modify it to suite my needs so I was wondering if it is possible for someone to explain step by step what exactly the generator does. Overall I understand the concept but the way it is written makes it very hard for me to follow the math involved.
The generator is here and some explanations would be welcomed and probably help anyone else trying to learn procedural generation as this example honestly yields beautiful results.
First you must understand how Perlin Noise works.
I recommend you write your own Perlin Noise code, something minimal, then play a bit with it and see the results.
Then move on to more advanced techniques and variants.
Here for example the user has some settings which more or less control the output:
basePerlinValue = (snoise2(float(x)*perlinScale, float(y)*perlinScale, octaves=8, persistence=0.5, lacunarity=2.0, repeatx=2048, repeaty=2048, base=perlinOffset) + 1)/2.0;
Play with them and see how they affect the result.
Octaves is standard Perlin Noise stuff.

Can difflib be used to make a plagiarism detection program?

I am trying to figure this out...
Can the difflib.* library in Python be used to make some kind of plagiarism detection program? If so how?
Maybe anyone could help me to figure out this question.
It could be used, but you're going to face all the same general issues you find in automated plagiarism detection. It might give you a little bit of a head start on implementing some of the algorithms you need, but I don't think it is likely to take you very far.
The short answer is yes.
The long answer is that it will be a lot of work and you'll probably find that you'd be better using another language or an off-the-shelf tool, depending on the vast amount of sources you're likely to be referencing.

How to convert Math Formula to Python code?

Are there any easy ways to convert mathematical formulas to Python code?
Perhaps translators, web reference, specific book chapters, anything ~
For regular expressions there are programs such as Kodos and sites such as pythonregex.com, so I was hoping there would be something similar for formula notation and Python.
No, this isn't possible in general. There are mathematical functions that aren't computable (for example, see wikipedia/Halting_problem). There are other mathematical functions where it's just not obvious how to code them up (consider a difficult integral or differential equations). There are many books written on finding numerical solutions to these sorts of problems (you can find some links here: wikipedia/Numerical_analysis).
For simple cases, you can transcribe mathematical formulae directly, but any automated means of translation would require a formal language for writing mathematical formulae in what would be a programming language in itself. This would beg the question, since you would be trading writing mathematical formulae in one language with writing them in another.
You could try to make your own with sympy and pyparsing.
so how to convert a math formula into python?
well, i myself dont know pretty much of python (i am just a beginner) but i have got some tips to help you:
first, you should like calculate the formula using x and y (or a and b) and write that down on a paper.
lets say phythagoras theory ( which is kinda basic).
c2 = a2 + b2;
so you have to input those a and b and write this formula to calculate c (which will be c = sqrt a2 + b**2)
now lets say you dont know this formulas (i can hear you). then? well, you should search it up on internet, listen to its explanation and try to transform them to python.
this is like noobs advice, but you know - no easy ways in programming.
(well, just search it on internet, i guess?)

Categories