Do you know how I could find the solution to the integral
Integral_(-1)^1 (LegendreP(n, x) LegendreP(m, x))/(1-x^2) dx
using MATLAB? I know that with Mathematica it'is pretty easy but I do not have access to it. I tried it in different ways using MATLAB but it does not seem to work.
Related
In LP or other kinds of programming, cvx + Matlab may get the lagrange multipliers with easy codes, but is there any commands for Gurobi to achieve things like this?
With Gurobi's Matlab API, the optimization call will return a single data instance that contains all results from that optimization, including the dual values: Matlab API
You would need to inspect this returned data object to find the values you are looking for.
As part of my tutorial, I would like to show the plots of a) sum 1/n z^n, b)Log(z)=log|z|+i Arg(z) to drive home the point of analytic continuation.
Plotting the second is easy but not the second one. Any suggestions for Matlab, mathematica or c++?
So far I've been trying with the symbolic sum function, but it was too heavy for my machine. I might leave it for few hours to run.
Any quicker ways? Here is a graph of a natural boundary image I found online to get an idea (not enough rep to post).
https://upload.wikimedia.org/wikipedia/en/1/1b/Natural_boundary_example.gif
I have an optimization problem shown in uploaded figure file.
Determining the optimal matrix X maximizing given objective function is the problem.
However, since the function inside the log-function is non-concave, MATLAB CVX doesn't work.
How can I solve the problem? How should I transform the form?
Please give me a hand
I need to plot y = m*x where x ranges from, say 0 to 10. But m is a symbolic constant here, I dont want to supply a specific value.
Here's what my desired graph looks like (similar to how a class teacher would draw this):
[Consider m=a]
Sympy:
Tried doing this:
sympy.plot(m*x,(x,0,10))
but this shows the following error:
ValueError: The same variable should be used in all univariate expressions being plotted.
I cant really understand the error message, bit I am guessing it cant plot m as a (symbolic) constant in this case. Is it so? And in general, how can I do this?
Matlab:
Soon, I wanted to know if this is a limitation of sympy only, and thought maybe popular ones like matlab can do it? But with a bit of search on docs and SO, I couldnt find any. Both plot and fplot doesnt seem to cover this, they expect numerical values.
Others:
I am not acquainted with other plotting or CAS softwares, but it will be interesting to know if they support this out of the box
So, to repeat the main question, how to draw similar graphs, preferably without managing the plotting code yourself ?
The solution must be generic enough like plot to be applied to other equations.
[ The question was heavily edited from a sympy-specific question ]
Only for some functions with specific conditions you can plot thus in Maple. In Python (using matplotlib, sympy or any other packages) or Matlab you need to create code to manage that (assuming values and then replace ticks with literal ticks).
The following equation is to be solved for M by MATLAB:
(Atemp/At)^2=1/M^2*((2/(gamma+1))*(1+(gamma-1)*M^2/2))^((gamma+1)/(gamma-1))
It is not possible to solve this equation symbolically. In Maple it is easily possible to solve such an equation implicitly; now, is there also a pre-made function in Matlab that does this for me? I could program one myself, but as my skills are limited, its performance would not fit my needs.
I would try using fzero, or if that encounters problems because of complex values/infinities, fminbnd.