yacas | Computer calculations | Math library
kandi X-RAY | yacas Summary
kandi X-RAY | yacas Summary
Computer calculations made easy
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of yacas
yacas Key Features
yacas Examples and Code Snippets
Community Discussions
Trending Discussions on yacas
QUESTION
Background:
I am using the Ryacas
package, trying to figure out a symbolic expression for a the large-sample variance of an MLE
estimator.
To do that, I need the (inverse of the) Hessian
matrix of the likelihood function. I don't have mathematica (and the online version seems too cumbersome to use to me) and hence I am trying with the Ryacas
package which is an interface to the YACAS
computer algebra system.
Question:
I can't seem to figure out how to compute the Hessian
, however. Using the guide here: https://cran.r-project.org/web/packages/Ryacas/vignettes/high-level.html gives me an error for this. Here is a minimal reproducible example (taken from that guide)
ANSWER
Answered 2019-Oct-27 at 18:21The error, Error in Hessian(L) : could not find function "Hessian"
, is due the fact that Hessian
function is not part of Ryacas
package, instead it is part of numDeriv
package in R.
Also below is the documentation of Hessian
function in R:
https://www.rdocumentation.org/packages/numDeriv/versions/2016.8-1.1/topics/hessian
I hope this solves your problem. So please install numDeriv
package first and then use the Hessian
function.
I also tried to use the above example, below are the results:
QUESTION
I am trying to solve an optimization problem using two equations. But the derivative of the first equation will be used in the second equation. As you can see below, I need something between c and d. c set the first derivative equal to zero and bring y to the right-hand side, and the y is used in the second equation.
...ANSWER
Answered 2019-May-03 at 09:48The question is asking for something that will extract just the right-hand side "(60 - x)/2" and use it as a function .
QUESTION
Out of pure curiosity I'm interested if there is a function/package that allows to solve simple nonlinear equations in R?
Let's say I want to (symbolically) solve 0 = C + 1/x^2
. The expected result for the above example is x = sqrt(-1/-C)
I tried the Ryacas
package:
ANSWER
Answered 2019-Apr-17 at 09:04We can use package Ryacas
(thanks for the hint @Bhas) an interface to the library yacas
for symbolic equation solving:
QUESTION
I am trying to solve a system of 3 equations using Ryacas package in R.
...ANSWER
Answered 2018-Dec-14 at 23:56It's hard to fully prove it, but it's most likely that OldSolve
is too weak for this system.
A couple of important points from the manual:
This command tries to solve one or more equations.
Hence, no guarantees.
Note that only one solution is found and returned.
Meaning that there surely is no way to get all three solutions that you mentioned.
Again, at most a single solution is returned.
The fact that you got BB == BB
and P == P
means infinitely many solutions, so possibly we can see it as an evidence of failure to solve the system.
Multiple equations are solved recursively: firstly, an equation is sought in which one of the variables occurs exactly once; then this equation is solved with SuchThat; and finally the solution is substituted in the other equations by Eliminate decreasing the number of equations by one. This suffices for all linear equations and a large group of simple nonlinear equations
So, this kind of explains why OldSolve
may fail in your system. First, it's nonlinear, giving no guarantees. Second, each of the variables appears in each of the equations 1-4 times. If I understand the algorithm correctly, after solving one equation (w.r.t. AA
, say) and substituting the solution to the other two - we are done. That's because then both BB
and P
appear in both of the remaining equations more than once (and, as a result, OldSolve
fails to solve any of them). You can also try to switch the order of the equations; you will see that then a different variable gets solved for.
QUESTION
I have a small MATLAB script mainly doing derivatives using symbolic toolbox that I want to rewrite into R. I chose Ryacas package because I found rSymPy too tricky to install... Here is my R code
...ANSWER
Answered 2018-Jan-01 at 16:43There are several problems with the R code in the question:
it is attempting to assign an S3 object to elements of a logical matrix:
QUESTION
I'm attempting to implement the Adaptive function plotting algorithm using the psuedocode from these two examples (both examples the same really)
https://www.andr.mu/logs/acquiring-samples-to-plot-a-math-function-adaptive/ http://yacas.readthedocs.io/en/latest/book_of_algorithms/basic.html
The problems I've encountered (from my probably incorrect implementation) are:
(1) Duplicated coordinates are being created. I know this is because of the splitting, where both ends are kept for each spilt, so the end of one interval is the start of the other interval - same x value evaluated twice. But is there a way to setup the algorithm to avoid deplicated coordinates. I could avoid adding the start or end coordinate as a dirty fix (see comment in code below) but then I'd be missing one them for the whole interval.
(2) Some parts of the plot are missing coordinates for what is essentially a symmetrical function, which is strange. The algorithm should work the same way for both sides, yet it doesn't. This starts to happen when depth >= 6, it does an extra split to the right side of the function and nothing for the left side around the origin. The rest of the coordinates away from the origin seem to match up. The right side seems to get more splits than the left side overall.
Problem (2)
My Implementation of algorithm
...ANSWER
Answered 2017-Nov-21 at 06:38I think you've implemented faithfully, but the algorithm is broken. Asymmetric quadrature can easily give asymmetric results. I get the same kinds of weirdness.
But you can eliminate duplicate points by maintaining them in a sorted set and using the invariant that the endpoints have already been inserted when the recursive analyzer runs.
Here's a simplification using modern Java features more fully:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install yacas
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page