Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0
  •   was successfully added to your cart.
  • Home
  • Buy proxies
  • Extra features
  • Help
  • Contact
  • Login
  • 50% OFF
    BUY NOW!
    50
    PROXIES
    $19
    --------------------
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    $29
    $49
    $109
    $179
    $299
    --------------------
    --------------------
    --------------------
    --------------------
    --------------------
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    100
    200
    500
    1,000
    2,000
    TOP SELLER
    BEST VALUE
    For All Private Proxies!

Introduction

This is really a parsing question. But the context is that given the right side of first order ode, I want to automatically determine the class of the RHS. It can be either separable, or linear. If it is none of these, then I can do something else.

For learning, I am writing a step-by-step ODE solver in Mathematica.

Currently the correct solver is explicitly called based on type of RHS, by first visually looking at it and seeing which form the RHS is.

So I have solver for linear RHS, one for separable RHS, one for exact RHS, etc…

But I want to automate this part, just like one calls DSolve and have the program figure which solver to call based on the type of the RHS.

But the problem it is very hard to parse the RHS and determine the form. I do not know how DSolve does all of this.

description of problem

Given a first order ODE in $ x$ and $ y(x)$ , the general form is $ y'(x)=f(x,y(x))$

So need a function, which takes in $ f(x,y(x))$ and return if it is linear, or separable or neither and also return back these parts.

$ f(x,y(x))$ is separable if it can be written as product of two functions, where one function depends only on $ x$ and the other function depends only on $ y(x)$ .

As in $ f(x,y(x)) = p(x) q(y(x))$ where $ p(x)$ depends on $ x$ only and $ q$ depends on $ y(x)$ only. Examples of separable are

$ f=x^2+x^2 y(x) = x^2 (1+y(x))$ . Here $ p=x^2$ and $ q=1+y(x)$

$ f=1+\cos(x)$ Here $ p=1+\cos(x)$ and $ q=1$

$ f=y(x)$ Here $ p=1$ and $ q=y(x)$

There are some which are tricky, such as

$ f=1−x+y^2(x)−x y^2(x)$ this is separable since it can be written as $ (1−x)(1+y^2(x))$ and in this case $ p=(1−x)$ and $ q=1+y^2(x)$

$ f(x,y(x))$ is linear if it can be written as sum of two functions as follows $ f(x,y(x))=p(x)+y(x) q(x)$ where $ p(x)$ and $ q(x)$ here depend on $ x$ only.

Examples of a linear $ f$ is $ f=x^2+x^3 y(x)$ , here $ p=x^2$ and $ q=x^3$ . This can’t be written as separable.

But $ f$ sometimes can be both linear and separable at same time. In this case, I want to classify it as separable. For example $ f=x^2+x^2 y(x)$ can be viewed as $ x^2(1+y(x))$ which is separable, or as linear where $ f=p(x)+y(x)q(x)$ with $ p=q=x^2$

Some RHS is not separable nor linear. These I will just flag as neither and worry about them later. For example $ f=\frac{1}{x+y}$ as this can’t be written in the form $ p(x)+y(x)q(x)$ and it also can’t be written as $ f=p(x) q(y(x))$

Input for testing

Here are test inputs, and expected output to make it easier to answer this question.

input={    x^2+x^2 y[x],    2 x+1,    Cos[2 x],    y[x],    (x-1)/y[x],    Log[1+y[x]^2],    1-x+y[x]^2-x y[x]^2,    x^2+x^3 y[x],    1/(x+y[x]),    (1+Sqrt[x])/(1+Sqrt[y[x]]),    (1-x^2+y[x]^2-x^2 y[x]^2)/x^2,    2 x y[x]^2+3 x^2 y[x]^2,    3 Exp[2 x]+2 y[x],    (5 Sqrt[x]-y)/ x,    2 x y[x]+3 x^2 Exp[x^2],    Sqrt[1+x+y[x]^2] } 

And expected output for each one these inputs is

out={   {x^2,1+y[x],"separable"},   {2x+1,1,"separable"},   {1,y[x],"separable"},   {Cos[2 x],1,"separable"},   {(x-1),1/y[x],"separable"},   {1,Log[1+y[x]^2],"separable"},   {(1-x),1+y[x]^2,"separable"},   {x^2,x^3,"linear"},   {"","","neither"},   {(1+Sqrt[x]),1/(1+Sqrt[y[x]]),"separable"},   {(1-x^2)/x^2,1+y[x]^2,"separable"},   {2 x+3 x^2,y[x]^2,"separable"},   {3 Exp[2 x],2,"linear"},   {5 Sqrt[x]/ x,-1/x,"linear"},   {3 x^2 Exp[x^2],2 x,"linear"},   {"","","neither"} } 

This is summarized in

Mathematica graphics

For example, let the parsing function be called parse then the call using the first example is

parse[ x^2+x^2 y[x], x, y[x]] 

And this should return

 {x^2, 1 + y[x], "separable"} 

as in

parse[f_, x_, y_] := Module[{p, q, class},   If[FreeQ[f, y[x]],    p = f; q = 1; class = "seperable";    Return[{p, q, class}, Module]    ];    {p, q} = f /. Times[p_, q_] :> {p, q};   (*etc....not working*)          ] 

Basic parsing methods do not really work. For example doing something like

expr=x^2+x^2 y[x] {p,q}=Simplify[expr]/.Times[p_,q_]:>{p,q} 

Mathematica graphics

Works, but not here

expr=1-t+y[t]^2-t y[t]^2 expr/.Times[p_,q_]:>{p,q} 

Mathematica graphics

Using Simplify sometimes help and sometimes now. So this approach is not robust to do what I want.

How does DSolve manages to parse such complicated input and it figures which part of the expression is which? I am sure it does something much more advanced than basic pattern matching.

What is the general approach to write such a parser? Can just using pattern matching function work? Or it needs special parsing methods? May be a hint towards a general approach to solve this will be enough. Since trying to do this case by case is not getting to anywhere.

✓ Extra quality

ExtraProxies brings the best proxy quality for you with our private and reliable proxies

✓ Extra anonymity

Top level of anonymity and 100% safe proxies – this is what you get with every proxy package

✓ Extra speed

1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!

50 proxies

$19/month

50% DISCOUNT!
$0.38 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

100 proxies

$29/month

50% DISCOUNT!
$0.29 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

200 proxies

$49/month

50% DISCOUNT!
$0.25 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

500 proxies

$109/month

50% DISCOUNT!
$0.22 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

1,000 proxies

$179/month

50% DISCOUNT!
$0.18 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

2,000 proxies

$299/month

50% DISCOUNT!
$0.15 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

USA proxy location

We offer premium quality USA private proxies – the most essential proxies you can ever want from USA

100% anonymous

Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies

Unlimited bandwidth

Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!

Superfast speed

Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!

99,9% servers uptime

Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems

No usage restrictions

You have freedom to use your proxies with every software, browser or website you want without restrictions

Perfect for SEO

We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies

Big discounts

Buy more proxies and get better price – we offer various proxy packages with great deals and discounts

Premium support

We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!

Satisfaction guarantee

24/7 premium support, free proxy activation and 100% safe payments! Best reliability private proxies for your needs!

Best Proxy Packs

  • 2,000 Private Proxies $600.00 $299.00 / month
  • 1,000 Private Proxies $360.00 $179.00 / month

Quick Links

  • More information
  • Contact us
  • Privacy Policy
  • Terms and Conditions

Like And Follow Us


Copyright ExtraProxies.com | All Rights Reserved.
  • Checkout
  • Contact
  • Help
  • Home
  • My Account
  • My Cart
  • News
  • Privacy Policy
  • Proxy features
  • Proxy packs
  • Terms and Conditions
Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0 items