COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### My first Script (polynomials)

• Email
• Follow

```I need to make a function that differentiates a polynomial. It needs to be in the form: function dy = differ(a, x), where a is a vector of any length representing the coefficients of the polynomial, and x is a vector of any length giving the points at which the derivative is evaluated.

For example, if a = [2 4 7 3 4], it would be 2x^4 + 4x^3 + 7x^2 + 3x + 4.
And say x = [1 2 4 5]. The program should take a and differentiate it (in this case giving 8x^3 + 12x^2 + 14x + 3) and then apply it to the values in the vector x. So this input would return 37, 143, 763, 1373.

Another example, if a = [1 2 0 1] (meaning 1x^3 + 2x^2 + 1 which is differentiated to 3x^2 + 4x) and x = [1 2 3], then the output would be 7, 20, 39.

I cannot use existing matlab functions here. Does anyone know how i would go about making this function? Thanks.
```
 0

See related articles to this posting

```dishes <fartybarstard123@hotmail.com> wrote in message <1035469021.125241.1256728397328.JavaMail.root@gallium.mathforum.org>...
> I need to make a function that differentiates a polynomial. It needs to be in the form: function dy = differ(a, x), where a is a vector of any length representing the coefficients of the polynomial, and x is a vector of any length giving the points at which the derivative is evaluated.
>
> For example, if a = [2 4 7 3 4], it would be 2x^4 + 4x^3 + 7x^2 + 3x + 4.
> And say x = [1 2 4 5]. The program should take a and differentiate it (in this case giving 8x^3 + 12x^2 + 14x + 3) and then apply it to the values in the vector x. So this input would return 37, 143, 763, 1373.
>
> Another example, if a = [1 2 0 1] (meaning 1x^3 + 2x^2 + 1 which is differentiated to 3x^2 + 4x) and x = [1 2 3], then the output would be 7, 20, 39.
>
> I cannot use existing matlab functions here. Does anyone know how i would go about making this function? Thanks.

Everything you have said here points to this being a homework problem.  People here are more inclined to give homework hints when the student first exhibits some genuine effort at having solved it themselves.

the cyclist
```
 0
Reply thecyclist (381) 10/28/2009 12:44:19 PM

1 Replies
75 Views

Similar Articles

12/15/2013 10:20:23 AM
page loaded in 40964 ms. (0)

Similar Artilces:

my first script..
simple code I copied from a book: isn't working.. what's wrong w/it?? thak you... Frances (ommitted comments in book, for the sake of brevity, since you guys know what everything is..) <%@ page language="java" %> <%! char c = 0; %> <% for (int i = 0; i < 26; i++) { c = (char)(0x41 + (26 - i + j)%26); %> <%= c %> <% } %> <br> <% } %> On Tue, 08 Jun 2004 11:47:42 -0400, Frances Del Rio wrote: > sub: my first script.. It is important to be precise, and use of the...

Getting MySQL table info in perl script Options There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There w
..ie the column name, definitions (varchar(100) etc). The most obvious way is to parse the output from describe table_name. Is there an easier way? On Sat, 03 Nov 2007 13:45:47 -0700, Occidental <Occidental@comcast.net> wrote: > ..ie the column name, definitions (varchar(100) etc). The most >obvious way is to parse the output from describe table_name. Is there >an easier way? It all depends on what you want to do. Parsing the output from describe table_name would work but might not be the easiest way. Have a look at: http://dev.mysql.com/doc/refman/5.1/en/information-sch...

Absolute newbie very first script
Hi everyone, I've been introduced to UNIX a couple of weeks ago, and after the basics the time has come for me to write my very first script. The exercise is as follows: Pre-requisites Create a file with x amount of lines in it, the content of your choice. Script 1 Write a script that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument. Note! The file must retain the original name So I created file1 with...

In this example, if officename has more than one word, the only word added to the input field is the first word. document.getElementById('office').innerHTML="Office / Company Name:<input type='text' name='org' size='30' id='org' value="+officename+" />"; What happened to the other words and How do I get it to show all the words ? groups2@reenie.org said: > > >In this example, if officename has more than one word, the only word >added to the input field is the first word. > >document.getElementById('off...

Sorry: its my first script. what is wrong?
Please can you find out what's wrong, fix the script and tell me what was wrong. Im just beginning <html> <head> <title>Random Mad Lib!</title> <script language="JavaScript"> <!-- Hide function displaymadlib(w1, w2, w3, w4, w5, w6, w7, w8, w9, w0, w11, w22, w33, w44, w55) { document.writeln("The attack of the purple tissue!!!<br> Once there was a/an " + w1 + " tissue attacking a " + w2 + " in" + w3 + "! The tissue was even" ...

First script. Need some help
#Enter in firstname.lastname (bob.smith) #Count the amount of letters(x) and vowels(y) #Then work out if bob is > but not equal to 6 letters #If firstname is less than 6 print firstnamesurnamexy #If firstname is equal to or greater than 6 print firstnamexy #Copy result to clipboard http://codepad.org/Emzpix3H I think you can see what i'm trying to do here. I will definitely elaborate if anyone needs me to. Thanks ledpepper wrote: > #Enter in firstname.lastname (bob.smith) > #Count the amount of letters(x) and vowels(y) > #Then work out if bob is > but not...

I made my first real perl script
I made my first real perl script for work and I really like perl. It's easy to use and I can do a lot with it quickly. ilikesluts@gmail.com wrote: > I made my first real perl script for work and I really like perl. It's > easy to use and I can do a lot with it quickly. Welcome to Perl and to this newsgroup. Since you are new to both, you probably don't realize that the regular participants in this particular Perl newsgroup encourage folks to post messages here in accordance with the group's posting guidelines, which represent a consensus of this group's regular ...

Evaluate my first python script, please
I've written my first python program, and would love suggestions for improvement. I'm a perl programmer and used a perl version of this program to guide me. So in that sense, the python is "perlesque" This script parses /etc/hosts for hostnames, and based on terms given on the command line (argv), either prints the list of hostnames that match all the criteria, or uses ssh to connect to the host if the number of matches is unique. I am looking for advice along the lines of "an easier way to do this" or "a more python way" (I'm sure that&...

First lex script. Parsing C expressions.
Hello. I'm writing my first lex-fil. It's supposed to recognize tokens from C - ultimately, I want to match expressions. An expression can contain an expression - so there is recursion allowed. My definitions section looks like this: DATATYPES union|enum|struct|char|double|float|long|short|signed|int|unsigned|void STORAGE_CLASS volatile|register|auto|extern|static|const RESERVED break|case|continue|default|do|else|for|goto|if|return|sizeof|switch|typedef|while KEYWORDS {DATATYPES}|{STORAGE_CLASS}|{RESERVED} W [ \t]* ...

First PHP script, need your help to debug
Hello, I tested a PHP script with a FORM of 2 element and it delivered the mail but then when I added more FORM elements, it failed to deliver. Following is the content of the PHP script that I'm talking about, it is my first PHP script. Please advise what's wrong. The mail server, kind of unlikely, the first try it sent the mail (beginner's luck?), all of sudden, it went down? it's not on my box. Thanks. <?php \$to_addr = 'donli@yahoo.com'; if (isset(\$_REQUEST['submit'])) { \$mail_body .= "WHYSELLING: ".\$_REQUEST['WHYSELLING']; ...

First lex script. Parsing C expressions.
Hello. I'm writing my first lex-fil. It's supposed to recognize tokens from C - ultimately, I want to match expressions. An expression can contain an expression - so there is recursion allowed. My definitions section looks like this: DATATYPES union|enum|struct|char|double|float|long|short|signed|int|unsigned|void STORAGE_CLASS volatile|register|auto|extern|static|const RESERVED break|case|continue|default|do|else|for|goto|if|return|sizeof|switch|typedef|while KEYWORDS {DATATYPES}|{STORAGE_CLASS}|{RESERVED} W [ \t]* ...

Only functions in first included script are available after onLoad
Hi there. Has anyone experienced an intermittent problem where only functions from the first included script tag are available to the onLoad event handler? An example: <html> <head> <script src="library1.js></script> <script src="library2.js></script> <script> function doLoad() { functionCallFromLibrary2(); } </script> </head> <body onLoad="doLoad();"> </body> </html> The script _ocassionally_ (once every 20 or 30 times, I would say) halts at the functio...

Trying to write a first plain ruby script
In irb, the method "one\ntwo\nthree".split worked fine but in a file.. ------------------------------- @text = " line one line two line three " @lines = @text.split(/\n/) ------------------------------- .. it fails: "private method `split' called for nil:NilClass (NoMethodError)" After getting the array of lines, again I need to call split() on each line, then joing them with ", " (basically I need a CSV file for 14,000 lines verb annotation from WordNet) It's late, so I probably could not figure this out myself tonight. Any help is welc...

Script that Fills Table with Copies of First Cell
http://eastontario.com/promo/tableCellMultiplier.htm For a rectangular/square n column, m row table, this script formats so that all cells hold the same contents. Check out the source and vary for your standard html first cell and number of columns and rows. Comments to aug@eastontario.comNOSPAM without the NOSPAM I'm interested in how this might be used for your organization Gord wrote: > http://eastontario.com/promo/tableCellMultiplier.htm > > For a rectangular/square n column, m row table, this script formats so > that all cells hold the same contents. > > Check...

first ruby script mysql data input
Hello all, I'm trying to use ruby for the first time. I want to make a script that is going to parse through my file and pick stuff up and place it into a database. When I put it into the database I would like to first ask the database if there is something already like it and if there is an "empty" primary key to use. The key ID's in the database go something like: 1 2 3 5 6 7 8 10 11 12 18 22 23 24 and so on. I want to put stuff into ID 4, 9, 13 and so on. I was wondering what modules I should use and how to go about this. I come from Perl and I'm pretty use to doing t...

Add a line as the first line in a file using a script
Hello, I want to add a (known) line to a file (named myFile.txt) ***as the first line*** in a BASH script To add text after the end of a file, all I have to do in the script is: cat "my text" >> myFile.txt Is it possible to add this text as the first line of this file (in a BASH script)? Regards, IB ianbrn@gmail.com wrote: > Hello, > I want to add a (known) line to a file (named myFile.txt) ***as the > first line*** > in a BASH script > > > To add text after the end of a file, all I have to do in the > script is: > > cat "my text&q...

Script a "Cancel" to go to first layout(or any particular one)?
There are times when I have scripts that end up in printing, but sometimes, I just want to look at the info (which is on PREVIEW so I can make sure the printout will look correct) and cancel the print if I don't need to. Usually, a cancel leaves me on the layout that I am canceling on. -- ROCK FOR CHOICE - JANUARY 23rd. 2004 7pm (Tickets available through Ticketmaster) Hollywood Palladium, presenting Sheryl Crow and Ben Harper, with solo performances with Melissa Ethridge and special guests. If you folks feel you can make it, please do. I've been working with the FMF for years n...

MS SQL geek wants to jump ship, plz help on first Perl script
I've struggled a few days on whether or not to shamefully send this message to beg for help. But time is limited, so here goes. I'm a MS SQL Server DB Analyst working on backend CRM and financial systems, our company was bought out by an internet company which is mainly a FreeBSD & OSS. Now, we're slowly but steadily being migrated to MySQL and Oracle. So, as u can imagine, if I don't jump ship and aquire new skillset, I'm sure to be laid off. We now have a data quality project to cleans the data before we migrate to Oracle, what I need to do, is to import multiple...

Calling scripts from script file
Can you call another script from inside another script file? I don't want to make the script file I want to call a function because it has a ridiculous amount of inputs and that would just be a mess. I just want to separate two large programs but instead of having to run one or the other (or combine them into one giant program with an if/else control loop determining which one is loaded), I wanted to make a simple calling program which loads one of the programs based on a user input. I can't figure out how to do this (if it's possible at all). Any assistance would be greatl...

command/script execution from script
Running a do:while loop to montior for a process in memory and within that loop, I do a condition check for a process...if it comes back missing, if PROC = "" then echo to log file that it's down and execute a restart. For my restart, I've tried to actually start it as root with su -c "/home/user/run.sh" and I've tried to embed the su -c command execution within a script and call that script. Problem is, when I kill the process to be monitored, it is able to see that it's down and it will run the startMileage script, but it never restarts my process and I ...