Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 06-28-2018 06:44 AM
(591 views)

Hi,

I'm trying to find the root of my function and after some googling i found the FROOT function. As far as I can see/find there is no way to use this on a function that has more than one input. Surely it is possible to something along the lines of:

start Func(x,a,b);

return(a*x##2-b);

finish;

bounds = {0,2};

roots = froot( "Func", bounds);

To clarify I want to send in constants in the function and find the root changing only "x".

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I think you are trying to do something like this:

```
proc iml;
start Func(x) global(a,b);
return(a*x##2-b);
finish;
a = 1;
b = 2;
bounds = {-2 0,
0 2};
roots = froot( "Func", bounds);
print roots;
```

The FROOT function is a numerical root-finder, which means that all symbols must have assigned values. Note also that the FROOT function will return one root for each interval that you specify. If you think you have multiple roots but do not have a good estimate for the intervals on which they occur, read the article "Finding roots: Automating the search for an initial guess."

If you are looking for a SYMBOLIC answer (like the quadratic formula) that gives x in terms of symbolic parameters a and b, then you need to use symbolic software such as Wolfram Alpha. However, only a very small number of functions are invertible.

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I think you are trying to do something like this:

```
proc iml;
start Func(x) global(a,b);
return(a*x##2-b);
finish;
a = 1;
b = 2;
bounds = {-2 0,
0 2};
roots = froot( "Func", bounds);
print roots;
```

The FROOT function is a numerical root-finder, which means that all symbols must have assigned values. Note also that the FROOT function will return one root for each interval that you specify. If you think you have multiple roots but do not have a good estimate for the intervals on which they occur, read the article "Finding roots: Automating the search for an initial guess."

If you are looking for a SYMBOLIC answer (like the quadratic formula) that gives x in terms of symbolic parameters a and b, then you need to use symbolic software such as Wolfram Alpha. However, only a very small number of functions are invertible.

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.