## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Albert D. Rich
@AlbertRich
@SorinS I look forward to seeing what you come up with for integrating elliptic integral functions.
Since Rubi 4.16.1.0 was released, the rule for Int[f(x),{x,a,b}]has been modified to provide direction of approach information when computing the limits. With his change Int[Sqrt[a^2-y^2], {y, -a, a}] now returns a^2 Pi/2.

To make this improvement in your copy of Rubi, near the end of the file Rubi.m replace the definition

Int[u_, {x_Symbol, a_, b_}] :=
With[{result = Int[u, x]},
Limit[result, x -> b] - Limit[result, x -> a]]

with

Int[Fx_,{x_Symbol,a_,b_}] :=
If[EqQ[a,b],
0,
With[{result=Int[Fx,x]},
If[PosQ[b-a],
Limit[result,x->b,Direction->1] - Limit[result,x->a,Direction->-1],
Limit[result,x->b,Direction->-1] - Limit[result,x->a,Direction->1]]]]

Then delete or rename the old paclet directory, and rebuild the system.

Kuba Podkalicki
@kubaPod

Hi @AlbertRich , I was told (by @halirutan ) that you could probably give me a hint to a problem I have.
The question is:
How to verify that something is a general solution to a diff equation? Automatically, in WL, of course.
I know that I can substitute and simplify to verify a specific solution.
But the problem with general is that it has n symbolic constants.
e.g. A Sin[t] + B Cos[t] is a general solution, how to verify that A1 Sin[t] + A2 Cos[t] is too and A Sin[t] + A Cos[t] is not?

The point is, is there a standard method to do so? If not, I will try to cook something up

Probably based on Simplify[ exampleGeneralSol - giveGeneralSol] and analyzing constant - otherConstant terms. Not sure how easy it will be.

Albert D. Rich
@AlbertRich
@kubaPod Sorry differential equations are not my area of expertise. Maybe @nasser1 can help.
Nasser M. Abbasi
@nasser1

I am not an expert on ODE's either other than what I learned from classes I took on the subject and from writing a program that solves ODE's step by step for 2 years now, which is still in progress.

But this is what I think could be done: First determine the order of the ODE.

Next, count the number of unique constants of integrations in the candidate solution. If number of unique constants is not the same as the order of the ODE, then reject it right away. To do this one must use convention as to what the constant of integrations are.

In Mathematica, it uses C[1], C[2], etc... in Maple, it looks for _C1, _C2, etc.... (It needs to know this, so not to confuse the constant of integrations with other parameters).

Next, if the number of constants of integrations is the same as the order, then the standard way, is as you said. Replace and simplify:

Replace the candidate solution (and all needed derivatives) in the ODE. If you get zero, then it is a general solution. If not, then one would need to simplify the difference to see if the difference is equivalent to zero or not.

Sometimes if the solution is complicated, this simplification could fail to give zero, even though the solution could be correct and it is actually zero.

This is a hard problem. This now becomes a problem of simplification to determine if an expression is zero or not. This is known problem in computer algebra. To determine the equivalence of expressions.

I made a post about many such cases in Maple, where it can't verify its own solution is a general solution to an ODE, even though the solution is actually correct. In Mathematica one can use FullSimplify and other tricks to check more if it is not zero.

Aaron Meurer
@asmeurer
If the solution is a linear combination of the constants, it suffices to check if the particular solutions are linearly independent. This can be done by computing the Wronskian.
Kuba Podkalicki
@kubaPod
Thanks @asmeurer @nasser1 @AlbertRich I will let you know how it went.
@asmeurer I am not sure how to apply you suggestion, consider
DSolve[y'[x] == Sqrt[x + y[x]] - 1, y, x]
Kuba Podkalicki
@kubaPod
{{y -> Function[{x}, 1/4 (-4 x + x^2 + 2 x C[1] + C[1]^2)]}}
So let's say we have an input:
1/4 (-4 x + x^2 + 2 x A + B)

If the solution is a linear combination of the constants

How?

And how to extract particular solutions.
Aaron Meurer
@asmeurer
There is only one constant there, C1, which is right because it's a first order ODE. So if the solution solves the ODE, then that's it. What I said would be more about higher order ODEs, like an ODE that has a solution $C_1\sin(x) + C_2\cos(x)$
I have no idea how to use mathematica. Someone else will have to help you with that.
Albert D. Rich
@AlbertRich
People, this Gitter chat room is for Rule Based Integration. This discussion is better had in one focused on solving ODEs.
Aaron Meurer
@asmeurer
Kuba Podkalicki
@kubaPod
@AlbertRich Apologies, will do. @asmeurer right, I must have missed my coffee, of course this was first order and single constant, sorry for confusion. That is still an example which would need to be verified though. But I will move the question to SE later.
Thanks
Axel Kramer
@axkr
@AlbertRich do you plan to support Surdin future Rubi versions?
The simple rules are easy to implement:
Int[Surd[x_, -1], x_] := Simp[Log[x], x] Int[Surd[x_, n_Integer], x_] := If[n>0, (n/(n+1))*x*Surd[x,n], ((-n/(-n-1))*x)/Surd[x, -n]] /; FreeQ[n, x] && NeQ[n, -1]
but what about all the somehow "similar" other Powerrelated rules?
Albert D. Rich
@AlbertRich
@axkr Thanks for contributing rules for integrating Surd[x,n] where n is an integer.
You might want to add rules to your package for integrating x^m Surd[x,n]^p where m is a positive integer, and n and p can be numeric or symbolic. Then you could post this add-on package to Rubi making it available to the Rubi community.
Axel Kramer
@axkr
Albert D. Rich
@AlbertRich
@axkr Looks good, but why not generalize the rules for noninteger and symbolic n like Mathematica's built-in integrator does?
Also you can use Mathematica's _. pattern object for p to unify your first two rules.
Miguel Raz Guzmán Macedo
@miguelraz
Hello!
I'm interested in bringing RUBI into a Julia-based term-rewriting system.
I tried yesterday to extract the Mathematica statements from the notebook files, but that was quite onerous.
What do people recommend as the path of least resistance here?
I just looked at the symja_android_library's rule dump in their repo and that seems attractive.
I would preferably like a JSON file with all the rules and the notebook filenames included as metadata.
Miguel Raz Guzmán Macedo
@miguelraz
OH WOW. I should have read the repo - I just found out the rules are in the github here
Axel Kramer
@axkr
Miguel Raz Guzmán Macedo
@miguelraz
Thanks a lot @axkr .
I'm not familiar with Java - is there anyway to get the Mathematica syntax for the rules that are here?
Albert D. Rich
@AlbertRich
@miguelraz I'm happy to hear you are interested in porting Rubi to the Julia CAS.
All of Rubi's rules are in the Rubi-4.16.1.0.zip file which is available for downloading on the "Install Rubi" page of Rubi's GitHub website.
Miguel Raz Guzmán Macedo
@miguelraz
@AlbertRich thanks, I finally found that :sweat_smile:
I think by Rubi Rules I meant some of the algebraic simplification Rules as well, like those here: https://github.com/axkr/symja_android_library/blob/master/symja_android_library/rules/ArcCosRules.m
eg
ArcCos(0)=1/2*Pi,
The symjava library also has oodles of tests which (AFAIK) don't seem to come bundled with the Rubi zip.
Albert D. Rich
@AlbertRich
@miguelraz Rubi is a symbolic integrator. The algebraic simplification rules you desire are in Mathematica, not Rubi.
Miguel Raz Guzmán Macedo
@miguelraz
Gotcha. We might be able to lift them off symjava anyways, but that seems orthogonal to the integration rules.
Albert D. Rich
@AlbertRich
Rubi's entire integration test-suite is also available in multiple CAS syntaxes for downloading on the the "Test Problems" page of Rubi's website.
Miguel Raz Guzmán Macedo
@miguelraz
Still, thanks a lot for answering my questions.