3.2函数导数的解析解

3.2.1函数的导数和高阶导数

>> syms x;
f(x)=sin(x)/(x^2+4*x+3);
f1=diff(f)
 
f1(x) =
 
cos(x)/(x^2 + 4*x + 3) - (sin(x)*(2*x + 4))/(x^2 + 4*x + 3)^2
 
>> ezplot (f,[0,5]),hold on;ezplot(f1,[0,5])
>> f4=diff(f,x,4);latex(f4)

ans =

\frac{\sin\!\left(x\right)}{x^2 + 4\, x + 3} + \frac{12\, \sin\!\left(x\right)}{{\left(x^2 + 4\, x + 3\right)}^2} + \frac{24\, \sin\!\left(x\right)}{{\left(x^2 + 4\, x + 3\right)}^3} - \frac{24\, \cos\!\left(x\right)\, {\left(2\, x + 4\right)}^3}{{\left(x^2 + 4\, x + 3\right)}^4} - \frac{12\, \sin\!\left(x\right)\, {\left(2\, x + 4\right)}^2}{{\left(x^2 + 4\, x + 3\right)}^3} - \frac{48\, \sin\!\left(x\right)\, {\left(2\, x + 4\right)}^2}{{\left(x^2 + 4\, x + 3\right)}^4} + \frac{24\, \sin\!\left(x\right)\, {\left(2\, x + 4\right)}^4}{{\left(x^2 + 4\, x + 3\right)}^5} + \frac{4\, \cos\!\left(x\right)\, \left(2\, x + 4\right)}{{\left(x^2 + 4\, x + 3\right)}^2} + \frac{16\, \cos\!\left(x\right)\, \left(2\, x + 4\right)}{{\left(x^2 + 4\, x + 3\right)}^3} + \frac{8\, \cos\!\left(x\right)\, \left(8\, x + 16\right)}{{\left(x^2 + 4\, x + 3\right)}^3} - \frac{6\, \sin\!\left(x\right)\, \left(2\, x + 4\right)\, \left(8\, x + 16\right)}{{\left(x^2 + 4\, x + 3\right)}^4}

>> tic,diff(f,x,100)
 
ans(x) =
 
(8190*(8548335873066485759869202038672070138117536112821539902238745757111874051293842273096806537292457651590389020131491427003362308606433776739807856678931945768004221904566929915157301960442268280*cos(x) - 5488823342622540576231886602440728106483709892775123701332732621617358243304331720435936168372923052184813480492885514923845268751396946579765495819887425143826549825215067822731643676024933881*sin(x) + 3379804052992162717599691432492752406988707297977175216186609889116226269331605835223789623111559805303391130598274428634526876779145239780646436198582809257298319700346514506233416650084271550520*x^2*cos(x) + 31046205285349005962273677495866328449101903125605346138186956096269760631673617772279266746841678131531141745386201542031053324262209897513425271083093159534431615677905216365721221821116330318260*x^3*cos(x) + 210970648560714061295130727068553127220459390642049194828577835265898410751905916998554985394615722718502817285698347054203209100980554627710677439712591861376374195609822235534471498602245057371040*x^4*cos(x) + 1131023879571338041995397621884485759671693330950849647302197718575388204291215832429747019451957533544682898412657740430973563436823388400971167879956293801304164264897022494521237130441645154417680*x^5*cos(x) + 4981865565953876960717476853677595620424993515643090984160753390569073508391227046411842351934730131695861996940621812128629200058412562825096468615396094947388737692250733711972398202313479199271200*x^6*cos(x) + 18540299677955316971342177837136560037205830379500366925801942842689276054392236118753413094207836817637671382730478223087886581417040283448288348053788217844336512421146021259850876154140975100926960*x^7*cos(x) + 59496846558271699254547048281687543720836243325611834899603309878827440489553127330812525936090000052806737683584166798372804440497202172721251944909838840844356346478367513335601734779513656760611120*x^8*cos(x) + 167204903726548999246519795631782146689072310452724849069689827652651254048344520550140319965971195968368220787666998079229976323425493831495173091923599728416296442294953805729976577634279261140027160*x^9*cos(x) + 416538443737921765586922596450230876608132069150085425388164749633392138293553326355319942739749947096947798848410824671824349277525507402692029947033960268177963009251172338836017402474524734513717040*x^10*cos(x) + 928851625253999158466701171570122098303398681448107294438592977476344878085612623611597301153020559696254519151972193226866738646534890799727075023974915293489507838066878646277496998568621922863383240*x^11*cos(x) + 1868901418467134432834170378291731162632177789638384873695696340556050279172459143880773216418935680821921290620839058546658381810624037314652753127057626408372528322846714355309160562025415700912228000*x^12*cos(x) + 3415466318237297187245291679040817934855923145907916983573781246468680957550237028879012042216675848242740274017481662008403913534320802770764526186544917566108945166461957004578540632320778403683092240*x^13*cos(x) + 5700988191839251816669262320921992577802921271340404570209443109961623892915162988307517897452274939468942792478588484530400834201715146523488626999409326019364596494890099041433668741675979458900516640*x^14*cos(x) + 8732307676918117026965864261182944843727491786642917490276280576152901815848665782358578364559206026417184570500458244905585871688081846569462611407690864522563643785027078748381834834161057798645774960*x^15*cos(x) + 12323234775010868647703310541922242001305989445563792824288932758889338864516720805095000838213290901733125951862784061724686442105887045142888904458094576493062738012321156301887143450169123756305529480*x^16*cos(x) + 16077564063157520253412345776243003349895457450681601921126526335577516914723827565455782580812877636805886763357228840660826097967423097192650678467386009909957049380764914062843631613947936894555279460*x^17*cos(x) + 19448224845838972433215647771634704366371206503479293963420375840123071934421340808745355952899484312368506919031291264770721462312739175904939312488007094040350301740742071114193638452345844852043568200*x^18*cos(x) + 21866338083483508749895337054635543957958442886227958752283279393721379164354504556125469486557327936381389265413524072881515418470585074515500506636984844813103866114004265524127384208790081593374779340*x^19*cos(x) + 22898496481636579343907076146022914147458540234767691759221109525460291275381700767262516847437432310421681180167345493694949258577489129479653332204129436092560859138599478021425622273382224213474080320*x^20*cos(x) + 22372201744917457679375655658279443465412488914557450691851467060818727107425499329778013808816043010992479072906765666252284536633643304106268560811307225121101102956348088375139993753903123013470094240*x^21*cos(x) + 20420170013351279919486020259576526183950766660318152063235230393619505659011222828300528864480517445927043016351992992489721017273966864273544171885269850371057697970280687042971863430341917889030615360*x^22*cos(x) + 17429126974295503966074782632524864918002090978355700265555398625050114123845534648621183839351552924031974386422404500850588191918221584422275306440237088332724151112530076947667954824186556726472344160*x^23*cos(x) + 13918758985920633833781372058605780610029135217709458818980312528134101026213420233787277820939627182496236258065228670495560942679321850593045064927842541680988226984178491004993484810381473076410900000*x^24*cos(x) + 10401058805155379099101182468958993976728624832314491141221235614040573751563386346594089881426685401654086271481958084743212813043418972506512330563366763059720960550554630977333295188133880729694261520*x^25*cos(x) + 7269521342347632691835801829639957973662933728747474655798626344617115320633876177258335478766647760846201751195882811334046404153377753630660112888234727522353141849830788114194621612043459008197664800*x^26*cos(x) + 4746384087398457676439603498139547063187295027556984192798528160833905699323628265867407874424545071419568913487081056396308352891471018539148544677551114121092900648342883502944623427136132861446325040*x^27*cos(x) + 2888495341172560685240921105072259942100443196970688194354968697204971736150135172193087621532482554462014143430174478545056372827187451920250644029413333159382470097372978901820786142712401518348585280*x^28*cos(x) + 1632152506722734910948727289162194270995350964197108827037973231901515364508442909198544425124102078375157843160906097759763800817324684999685537711017316560221347427572731067938554669643409743525790240*x^29*cos(x) + 850752178108275193144270954264725105738120753896355373087937534660649571824679761131989144395996757738747889093499801558236825077869855794603022684010475501924374950854833517701376600945958674943366720*x^30*cos(x) + 404426702216364845383293931386080720108145002409586111195662442396675535620881034374297318497888984308143215776356074466503567357984344873002285181831907646150181995936778686076985222427224135348748000*x^31*cos(x) + 171555501424569623221368374779456424668911854226547878777040754858319312644624588833475820133698126055960789277573346035430146382672538060117697959696597867345618130253039839158035282311629396485262440*x^32*cos(x) + 61851181504554075619478177403276582270114997919572068653931989057564025426144544608773693909767399025429057362954125959972813450235722217640837266314995893495071880875094132413728960863516212132767380*x^33*cos(x) + 16318749173182890072092167413549102370076846452213635619971384259146809035040585492613323220054829498909241358882702591461867052157327559825761086295688508360051716612015372179043284946426366926774440*x^34*cos(x) + 629347188193073449149025674877886593350740819605620983555961819684968736405145821228909943016789618018518512579767394651113708799501677014452907125985608797787545432074395900992420382652210565628060*x^35*cos(x) - 3015386617354664459653108717786850325783444351505872887321007762664031775985527108782400460691160733278620653920619148899718241928535243300127049335405654005998442489517033716007486366803892179737440*x^36*cos(x) - 2745176913296684930528183376685874203493471783840188102971587427217042883055714963644888862531921715310200165434421158883064880721891323874362531136966767025417932136441840718726689326490895900780400*x^37*cos(x) - 1725416473631392199682139220231026923801346192792873131746327036577438455788519167569854872367757975231842837830065143495662277975750991180246515397103550812102945050556144274544142161394289121142240*x^38*cos(x) - 908601433810391624889279308266765909285077404116983315886916867834450512371329499634038336092733730620080879892637665053347365761564296626717476102672410051484556302854145502090894200961756094788240*x^39*cos(x) - 424568789262580103482399967903677965539625701912941898097410903864124570984256948061737982659588288788986843625655941513047528031587570914559436479699735320837378682678803467619335122671356537551760*x^40*cos(x) - 180429572290575332840793904555588639893098322465805483615582081664475789140936111000432584354389274466968864143304499395628169010225740197169895029744491106279675024520995590034908179483962715051080*x^41*cos(x) - 70609221978645460840703236105327722682196099917865386896078892288995588386040547523219155105546636588798995078440661492514401092106521816209090208775670495672403966206477617375570695149094364009360*x^42*cos(x) - 25617836689135194793531543862894397966727277463681797072508182417794982001184747504979135186407016365428609126277517887113569465450613711043726403556594056427163445482840573261258837945525866048600*x^43*cos(x) - 8647742954523770595384214944169561200277569571202275599110482707778963866216796928121566510492558465326848476434479279659584715383337381807888921061526923881755404039392622389721226063975404735840*x^44*cos(x) - 2720104825770181434543437701484776481110773986267815368811888365358491561105553501593969511993121187935318290290842673564535504156650907761080882164805106627455185308143718221636965598289610337520*x^45*cos(x) - 797105683177603746747733427801599220378068003656384982971464721534947547525520819693939599964968922392615060392047291917319149514301255247193460454475364446890466184857029122406175063894870767840*x^46*cos(x) - 217230127224128366228551766799047284881073574307323667580923134553854481928070399694261596371218239516088386810713468636242974870055949839565074759048929778023692166469103708975098261650891932560*x^47*cos(x) - 54851567861066844242406611173529110810019435373808161966943118308421001868315555747750299678637055608862467223727950335257954168944099794204016387071645171879092492788681489174738117229863453160*x^48*cos(x) - 12750033827057307862035249752642736245845807587297102883242614002593965859319014704209689147557766557952975123458099867999727699028465776488625311842342678863895245231046148676314074808321409300*x^49*cos(x) - 2697991928263197043548317425380133959694332524890687963939684476210279981203452201607288522505317731344897907836073639396541372470382850598472952228963341578286223785033714756045183476543464360*x^50*cos(x) - 509189001100320944707817122925311574806178503641912508935094026535241823049521854909355785479106820008941477581751026954540152654689502687207714579978334867812089068427346321150708362752228060*x^51*cos(x) - 82076834733616250413714192114456253959341020814561457672128964354315025174333826154172147655926570228048880628937941828803997595211057760551769056173956728323256281709238389893639195661523200*x^52*cos(x) - 10007694178839917613868340564720165870505297492827514742700902083869694023187576694934649984646076184481910759794319931531077751267376427250254684905961866054705156524015346414643264951352960*x^53*cos(x) - 417105820008864216843386806834115126255802242836262786446538486679661849646196439243712737052506478315883757295577475434830994558894176617928998631817272364306992090919055534263486441596160*x^54*cos(x) + 237359007592475207323338348475436691237305509383184088646465060641429771768790356421775494571269060029884455124383889834897417363608642978207913220656676068923909361884005302880397878605440*x^55*cos(x) + 100298871509906132585692261945307287714820324669407658664461391027298574149827857094998065385109095554344584475030692886671912490102679794428059939775877873117585817757334468689828589859200*x^56*cos(x) + 26498550787759147562391079821090497062207131558567135472850555084723074514277370530902601560057501199341829469420892844339145940632826174189036040137118970242023298374144019378816665868480*x^57*cos(x) + 5611075251851094468584911201661278277603727658833924831920433205666269227936541778132346486453104911524146590417459291234065268015985283788611479188494821736047246982395670273785290316160*x^58*cos(x) + 1009461232288251340486108882466854136108516401085297502033675724395017405015335135818990763937406658373503786268031882241553880695556635104496318289275572872572013301418098411608775471680*x^59*cos(x) + 156206627073120054583620107865487160043034136165406423146299165677238258074512843984933929673257725411712692504113010897698645984646941385429136384247680924714694418864196990944739173120*x^60*cos(x) + 20482646179444900041091341410517427406844768529659756798547923572886894850374729914629933590820244938338253700732855928435518630301740941139239260786304381170958598723494946818523061120*x^61*cos(x) + 2148280013672356433190624574974286114653515969642611079650439590841480028903338441880860348374079761268420417343965669657368414940969163750148270080218263363959825160712828056589971200*x^62*cos(x) + 144685095716739059215399335953391347620119666410715081616702300638528401907826486891589417837920472533293698020013742616169221805419223282565892190806266668741510122353952970731835520*x^63*cos(x) - 3925046869326108907180644798764342667990406325295573421861386144717042929875179739356309178376024007645420252635686221199323370225165524296846268809119155762543922707992714121942480*x^64*cos(x) - 3354342742833270190861243546755776036871465342126010230177951666324071248332577783373651028947172358499195584736453616935093335935637056831046820392542073116772717683137641364823720*x^65*cos(x) - 682342063888193149620357527257060805065636160902336200728015388365224146333159152193990809878467750805360388795957177588441811289277046249341661911800355011455390378604786165242960*x^66*cos(x) - 95670504695627114718344291307892740655878440888128336352473708218428690679938071466130943565961222655388386628824879937665549423520549163546517903700597827029120093355256588942520*x^67*cos(x) - 10116656340065237090369894938859346167434280455601264212998031118702390962413582890796797731196182741604041743017331511654021061770957220669764585674057131962926815644899849873600*x^68*cos(x) - 750917067189787008555887354031657176656763372694798208261481429544099052840998209710170308578190892627746844714215395594477859219876930114119912002065909195105169594340589453280*x^69*cos(x) - 20422878631601751159859401203362973433301871369856081517815487975745981315688480015704947168640425533174905779487383623078908825538192557976998051494370104007035380612291157440*x^70*cos(x) + 4487698187865440141066341540536674318880208889607114474530704060782818248523439830059712943075770061345939860513339240808635291259917461607300395347879256365643961144717207520*x^71*cos(x) + 942788184347458220157089423100695024938340156558247304376593058073547433804910997144376651500294512298638121929305180275536596612483997179280767483952636631531713808501603680*x^72*cos(x) + 106130514116418452400119619705042107420206007829432938563933404326296625628393501555055001673537037020371142157710237698174636012121897338357406056109505452526137949614786480*x^73*cos(x) + 7649438101787583423429295866156751396359335234784463165092985812844103605779419130029350697194228014183622637583878754318437325918421272707850996291140483632749027567362400*x^74*cos(x) + 224015196146814119976364398423256188097187513253746289752319644554276799461038674110548483470399041390325391741582446705796739037589342238018987090982817432932092183207440*x^75*cos(x) - 27867456293767866180176519351935102075448417868406903988173721106145246248794923879875063290912326735179413977482624544378550221821050018905378422219950889083573917030080*x^76*cos(x) - 5161239760572547489959593236953609642096737545366728492906084647138228772299788346610942409452461275817193462184729084836592084393777119575306858343323588458573789832160*x^77*cos(x) - 441660321627149043204359386277144994957173637880704020938090282653549620043699111600870362485426834506031076987775044573980171698017719654593160673807602207527790872000*x^78*cos(x) - 18640486585184764831880377359439173236620658454770515815684119545864237587373826728371951286110018042904881509135870357086918208723594100672203076511027970587853771040*x^79*cos(x) + 560495925896678864146413228292464814688820923186894231545424589580348141378378145463844887304734089071758532458825033960272928257316527887666510405393604288046425040*x^80*cos(x) + 161654208224928354384948583169835638526716798663758467489612740941429695770326547981046133300375348245921435065604801713945988105735473284912690389019167404063586600*x^81*cos(x) + 13004555985251524277274913134937415046650803776686345697921881674809127736372914493492304170457691012845445957621016648739890744109609247328176003085501261943020880*x^82*cos(x) + 418688301283976899461186065769420958576378807161729561090834225758962984424265203887077291574917230712788168352610630738518342723362501496567779329115795257554360*x^83*cos(x) - 23345325290095148095025705203957746496754164395165228603564470046549483050718170016552188234068264582244252110266142939255992104901506573483170222764810748667520*x^84*cos(x) - 3787686536015400130611978779800055766929928657646531773906781437474341034866138258884118006683164374615857539217252908704904751894605785618099774828827089545280*x^85*cos(x) - 203199258191625274489264405907764881533021661118520888753629202670315018669849706047984641722114245735201718892800184182324292475704106913423880701310986826880*x^86*cos(x) - 401288815241323530103547053083592779761296306122015982330877573778135284466488454517300260000176992430748830540636572350212317381296599187273637884700017600*x^87*cos(x) + 721425987880585645647815654226249186161964938492538125962236829512016646060105473148005596000558873009508593527588761768391098642535381667925169973506377920*x^88*cos(x) + 49446156757374691904575271963375319730483609918189019832962586634755409557349094380702405186010453398285576397699792257067237986142718094821734933114394720*x^89*cos(x) + 726642320837022149245568918775705463697647276933215080629232207006327028282152937733009873975670804705973347666508346266940668780948076626232585751897280*x^90*cos(x) - 111049044930783627268603927747083911415445861537892589574595354327892585181020804258474511633719100144054286660853023749622314474994561857789121620635360*x^91*cos(x) - 8318432924559071704632228565874582526999747423344819836213829033441948796808312589294869364381569731900477774456214911292605016171235625866090022894720*x^92*cos(x) - 126375098127643968181070697092061260298925429315643297973044656094501648707436330950722150406964075614260107076400759495114174010013849822982257710400*x^93*cos(x) + 15663478825275865709956578422126710002648094573109395248681314665037907644224502386207328504890909112687742453509415835365267646105194549683414901120*x^94*cos(x) + 1039680344283554878956656549462002860234007285563006718160420820028256710262287069356534924877653080272676733968669043630251850034748387646275607360*x^95*cos(x) + 8425206689946255078125256597949102199362347586922429644733712315499827449196469286263573751151467180182249577539000847807182227919792724743536720*x^96*cos(x) - 1973572758496962220289680990699149641903733832160576496710243276094060333099299809497696599274806739060854782877418317199803685382586596921188120*x^97*cos(x) - 94231386918494417732047283085208693938677385010239066714841346791222554247819962881968769718048408319834880125956640187321130830448498888367920*x^98*cos(x) + 532125643822162652458147655597298016681321364667575180482511244751225337364670797310543811054564410107187575951590201049517475055163879111800*x^99*cos(x) + 199257734550212656544043306593591337078362265268661685000813812973734015685481314778163565575818420330413468285754526317249204588613177110080*x^100*cos(x) + 5498835122999790401590106034992165244471583563191943335640694792155541763757711551845993880512563377807743549294597553018822900664158424480*x^101*cos(x) - 181858245862221325593961452714893555043890247579735997767576112191423828091274656502916740704769938193797097421197458211821649558298168000*x^102*cos(x) - 14440246516352253763467398365687603241913714119703634656045043065436490621278444266658940195838815055263752224988609403209726115530799520*x^103*cos(x) - 91278645476227078318797398311885858735743899743099066200671969766110923573414348201542887065233379371957307226011516759395487836892320*x^104*cos(x) + 19950361338656967276521406946170635614826300221324954907835179807606579404822185615968652971111488924276224961581902183175382402991280*x^105*cos(x) + 583837977393377043251475722513187584133354498730054955024176315119942261181568923847702802451708727276496884197900258417632809896800*x^106*cos(x) - 15744269999689065113111902174656002781060205011509782075298456033663638044310372675956682826404486008296235544629252997444862669040*x^107*cos(x) - 1065941906560509037483804235588787160670969784984644906222660933819181964402794646162821599859318501963599610992799796268056697280*x^108*cos(x) + 1536960895790634923631201476218595314291569073418842722054189088592165639955164721342979501564622540937928505337915740322329760*x^109*cos(x) + 1281490591107314557763840051818430354378269845262121504676998038107952770883125768861016887181544449586453736724153137916203840*x^110*cos(x) + 16164579869627547239967756755924394250812330421276229362432510050995275757001389123292068182305148122019349411346522772115040*x^111*cos(x) - 1141885301480360880343216231019898858495615247649066733262743886097208939773080190978704393315915457784850198331706331314000*x^112*cos(x) - 29108484777951692847042223410475155889930224847566165775604092369486447426420732630024602341515138317387588087287778729960*x^113*cos(x) + 764298140919876695696823923776817563254810834457695548453584351182844721966521515554882779218598717215211664851163227440*x^114*cos(x) + 32941129790742133781756355864368493652225891949316429067034557606632478567110067442434887968812696033297046121866935560*x^115*cos(x) - 352120484287749894997232622461657890526255622332720610461134946554883142742807643934107810426351212878245546925400320*x^116*cos(x) - 28759786926076951636528424346335112816271010832752478310646568176950989260996622785173790688076852162773451428762240*x^117*cos(x) + 53959851598813995685007550212739698783791888167519337153536758129372321516580842388166540411368718909874845152000*x^118*cos(x) + 20692323314517504984622830046431911497657840983577307332511450319354631259247925654287593468338123874892991539840*x^119*cos(x) + 91001362387123760989289999246361807999634589938536206120020907517028204937225909480672713326208506822704603520*x^120*cos(x) - 12654989134243265760564842426745637785992151092297309129397555731028634525233104104619562026239533598111383360*x^121*cos(x) - 121501546016137794612971081742335421264356842479951092780367900244427621620971210848647816825595690336999040*x^122*cos(x) + 6691053346382553434327497926352137992471252163244719332046503800844047370594119814449618395474837133277760*x^123*cos(x) + 96861774332140979345003286963207947041148739351671972703576816857133223904300227403506768522996962528000*x^124*cos(x) - 3086911107084828599454176576203332202537576162661724045134932482030652887122306747317653522940666273920*x^125*cos(x) - 60407711303695495531989551470122751657193261264575724594078067541909744301666547510894636912634824960*x^126*cos(x) + 1247029834669601251923081927341801674247522696916473364655329255927207819716501015463686676821527680*x^127*cos(x) + 31767970125226651143931252785230946006453388665763576462012365217256686538848235676589199285482200*x^128*cos(x) - 439951395744854172703655679723713987829602006802007574234983367254910418400586879791417775563380*x^129*cos(x) - 14566923111301520549125581556602971717783374916665029462277587449969831519556077965694992009320*x^130*cos(x) + 133910133523120010986723986342058561333857982447170398376600575392518533223483016503218847300*x^131*cos(x) + 5933737880949929065181848821495739235606669337487406821698868217772445086110826650992361760*x^132*cos(x) - 34028648404458799524747722386076920285356742193487492762472347757811248767827611026565680*x^133*cos(x) - 2172814015775379709725847844995758946598184808701863896936646385173436169699465801369440*x^134*cos(x) + 6547982362670302979431630227464914158381901542356249266633228461919423990616213371440*x^135*cos(x) + 721107384170783588724531432168416457193399119906386741337562193845693484380992489840*x^136*cos(x) - 557409405163677669928103624533292839513847973034527361438285365716645087083379400*x^137*cos(x) - 218181840731298888390831051378619990594635530203030756354041099466626803436066960*x^138*cos(x) - 249554244412360426032109925990200576413462459779503332677617532811207711059160*x^139*cos(x) + 60443014083530658935088517318930269829341467697155012077004759975051718396960*x^140*cos(x) + 171738495937281497286249779375001893773509757079231750113660628137678172880*x^141*cos(x) - 15378246385521058985105297597924003353830476697496274092989870369258687840*x^142*cos(x) - 67604037754722458745415855691893571248030139251666384074248937238962000*x^143*cos(x) + 3600274870813535597084568298232174583783449153925176652575727823654440*x^144*cos(x) + 21135435098007548094735424607542549658344477505816053684727009303220*x^145*cos(x) - 776168311811398039753462506161835157847523001990851340910091899160*x^146*cos(x) - 5684190840418260706107535763272975358175128456479442675677305540*x^147*cos(x) + 153981118128331313367383750309403929547962694320297690749200960*x^148*cos(x) + 1358189291317973853060308455987579869936378465822242597623200*x^149*cos(x) - 28034433762652365532896696569999495040143526021595400391360*x^150*cos(x) - 292963674007223762360859128606280211634500589087892258720*x^151*cos(x) + 4656190998297694653725873004607844154278262374741452320*x^152*cos(x) + 57524698581645528962801893149887683681124424480591120*x^153*cos(x) - 697031325933202399544021070497623053104733107628000*x^154*cos(x) - 10320720382823843272527209511118289097879720906960*x^155*cos(x) + 91678617568681835085163182008376193856431867200*x^156*cos(x) + 1690755315340471287022553297579780706668443680*x^157*cos(x) - 10008284539023862330055128618320311179861440*x^158*cos(x) - 254969475177128994691252245424015037241120*x^159*cos(x) + 567098022730623243784852840014175947720*x^160*cos(x) + 27018560090163711559844356589716903620*x^161*cos(x) - 270378653830566443193484572701412600*x^162*cos(x) - 15907269341286367846041108693866580*x^163*cos(x) - 463614415255307808426510402029280*x^164*cos(x) - 14374708623818630178077338294320*x^165*cos(x) - 438520304959138933584061649760*x^166*cos(x) - 11920489381689347695643079120*x^167*cos(x) - 280249506712998101965467600*x^168*cos(x) - 5624216581013979846808680*x^169*cos(x) - 94216980894611577765840*x^170*cos(x) - 1257141728700537898680*x^171*cos(x) - 12067177231540458720*x^172*cos(x) - 59067521854553520*x^173*cos(x) + 316626675472800*x^174*cos(x) + 8216535927600*x^175*cos(x) + 58527435960*x^176*cos(x) + 111803580*x^177*cos(x) - 451080*x^178*cos(x) - 1260*x^179*cos(x) - 1836136721945461021568515034529496556173600719725291795946993867214296968358659473363029047924481578387930564820080356747976131847064444127316165546864329674304838383520756272088418241054815151200*x^2*sin(x) - 15371741059567599179368670039600584721692048845889241660676981741562945118797106274176212493979035694960970618751683508684557411195390192267976195041406031510424782182276690538533873815581180690840*x^3*sin(x) - 94435072071364062812089406603996253334858134002736937460756295531302233279930803418047308481096673663325977603924658592481478112247679042184792674738431073543576835091585170294424551964499618458035*x^4*sin(x) - 453094169511351318153826484200945220271972071719798828108404791147917999757857096896604013411767350599933487797944312774845091625741262026855243132530677173087839545403876516591854548038205001152064*x^5*sin(x) - 1763183496367259701595396787497317599248793408349993035853097240877222184024876756202432723395055639232756045280210898120136165162428009143039425696302216933861587167771286079894738873024294385112560*x^6*sin(x) - 5699452792516477528509415450208389650902560114067815075395058771704181936673634303432091590664407294007815806804416401622544399588553623897445080705309595502628019603428143246115613609377060737463520*x^7*sin(x) - 15523151984643019345498815160447930805920667292414071763998104037992561622846535143263809040112519074715745924933830806610028467262674951190176933146854216803745907802148433446028733369057221988295630*x^8*sin(x) - 35822428129461334673238067198199838307682541090865884621624651652464561689395609744346062006241666699737447948939708655218752046931473361627789155969309438391121491343025926269862371778138540296662080*x^9*sin(x) - 69658270794740668960850351249658472496662759479073775603890136210811907212374630580234936190022964517638252751784059709987861099712432253740318610602698708487060265461355485308092924099494470224857648*x^10*sin(x) - 111158591911386501155599638067957412747121681508112803627366944551454329874945286617924519443528368827620851897875956901209584264825021073712212797657842712069146674218519797643077640306891687981448880*x^11*sin(x) - 133342369392219690061559661937009513053903181327087445156582140826236845201546096767186405268592786798219188713245353427020262738094423435469187088069568002142528525004979888417401294180973616045843570*x^12*sin(x) - 75173137081851167625680094643138330354319669589673507187007058633389589445970454885029781141516393766388008447418909252845683077805267517497103857027361675597752214850791812290862691401804190961120960*x^13*sin(x) + 163170970891653434780296161676055076839821429082053566214281365490615663990450229676614056630027987202663183442290127325919809889754815252632179451336317724079751337678372627154621263749359601741228400*x^14*sin(x) + 706160619672869769713189195498970378450193689262601958284256043049522072434276603067322783934626325935513257922725939356142836394761230125611082947913156059293724381237959244247265088562128767549650592*x^15*sin(x) + 1664934028340598900792994174966595958417114251970866221629914514681341447628352764718431759055521399800693700411908561912726095436484632141213727076590198507302379809232155855746042814784830040526423605*x^16*sin(x) + 3083384154917075476925615796268509966464115702861873081671951857121616799711092720538786177215382815220412340327277419463695487222184366580391640135529263710043132670069182327842166419435677890376128640*x^17*sin(x) + 4889986688685377979352425748598235793251654534441802729804549604759484916189744940033451503287559121294730244582297867026794848547666971128405695359162486130819024865939897851824875855458894317745627600*x^18*sin(x) + 6881953918688140459841525662276961135101335008524764588293768872343868290880918404067413080152538665862440538758859750167880092106228480661891493651622677069896438376201534909027529863131643364424527320*x^19*sin(x) + 8758204831538841468545988355340692435718061563732007304347537791855332604192350309115455429641963188316059053311532466781335181354414367115502871110130460390981605688489962338996097487222972445053487039*x^20*sin(x) + 10195694157386353322222441775818671998439719613852636519891868013315959960435059561197598799792499977871327283032246117908494433893082242130215838921942464170472869333113909423829124783059731494759512960*x^21*sin(x) + 10941638476883982702421597472939328306469190115725534716196128053830611965675021622926329628777608041696387716329494010758683870133491859222692785378506376398646673465605360677181694665221579934268675360*x^22*sin(x) + 10885110998186873076602190757467550556937766591205941979698635172431607267207606676662698504136813410725213896958168963757403169333911668746925407042901576838674864989167690610305124410677320577681687360*x^23*sin(x) + 10080752928159030227970025188202341856226792660227282827789946786120718303607146353904311255300862189742579517345251856588533359506994080014300513232541879402430331387637057046585655076581185814456037820*x^24*sin(x) + 8719331022579202518902005130382990364767662247631906063276567959297525227889075591154895182121165522677307921336189241331772104582869540133804926654854032294531666327345149851279236006425305234524533120*x^25*sin(x) + 7062091470653596374710272009228654211778636813959609806098247472536616584263600104967114360819060171731259307322165412477975621789328626644880098316251866472729191106714572534236052090541455445725126560*x^26*sin(x) + 5367269588388311981890050516221...输出已截断。文本超出命令行窗口显示的行长度,最多为 25,000 个字符。
 

 

>> syms x;
f(x)=sin(x)/(x^2+4*x+3);
f1=diff(f,x,1);f2=diff(f,x,2);f3=diff(f,x,3);f4=diff(f,x,4);
 
%ezplot (f,[0,5]),hold on;
subplot(2,2,1),ezplot(f1,[0,5]),
subplot(2,2,2),ezplot(f2,[0,5]),
subplot(2,2,3),ezplot(f3,[0,5]),
subplot(2,2,4),ezplot(f4,[0,5])
>> syms x;
f(x)=sin(x)/(x^2+4*x+3);
f1=diff(f,x,1);f2=diff(f,x,2);f3=diff(f,x,3);f4=diff(f,x,4);
 
ezplot (f,[0,5]),hold on;
ezplot(f1,[0,5]),
ezplot(f2,[0,5]),
ezplot(f3,[0,5]),
ezplot(f4,[0,5])

 

 

>> syms t f(t);
F=t^2*f*sin(t);
G=simplify(diff(F,t,3))
 
G(t) =
 
6*cos(t)*f(t) + 6*sin(t)*diff(f(t), t) + 3*t^2*cos(t)*diff(f(t), t, t) + 12*t*cos(t)*diff(f(t), t) - 6*t*f(t)*sin(t) + t^2*sin(t)*diff(f(t), t, t, t) - 3*t^2*sin(t)*diff(f(t), t) + 6*t*sin(t)*diff(f(t), t, t) - t^2*cos(t)*f(t)
 

 

>> syms x;H=[4*sin(5*x),exp(-4*x^2);3*x^2+4*x+1,sqrt(4*x^2+2)]
 
H =
 
[      4*sin(5*x),               exp(-4*x^2)]
[ 3*x^2 + 4*x + 1, 2^(1/2)*(2*x^2 + 1)^(1/2)]

3.2.2多元函数的偏导数

>> syms x y ;z(x,y)=(x^2-2*x)*exp(-x^2-y^2-x*y);
>> zx=simplify(diff(z,x)),zy=diff(z,y)
 
zx(x, y) =
 
exp(- x^2 - x*y - y^2)*(2*x + 2*x*y - x^2*y + 4*x^2 - 2*x^3 - 2)
 
 
zy(x, y) =
 
exp(- x^2 - x*y - y^2)*(- x^2 + 2*x)*(x + 2*y)
 
>> zx=diff(z,x)
 
zx(x, y) =
 
exp(- x^2 - x*y - y^2)*(2*x - 2) + exp(- x^2 - x*y - y^2)*(- x^2 + 2*x)*(2*x + y)
 
>> simplify(zy)
 
ans(x, y) =
 
-x*exp(- x^2 - x*y - y^2)*(x + 2*y)*(x - 2)
 
>> [x0,y0]=meshgrid(-3:.2:2,-2:.2:2);z0=double(z(x0,y0));
>> surf(x0,y0,z0),zlim([-0.7 1.5])

>> contour(x0,y0,z0,30),hold on;zx0=double(zx(x0,y0))

>> zy0=double(zy(x0,y0));quiver(x0,y0,-zx0,-zy0)

>> contour(x0,y0,z0,30),hold on;zx0=double(zx(x0,y0));
zy0=double(zy(x0,y0));quiver(x0,y0,-zx0,-zy0)

这个double用处在哪?去掉就是错的(03.21)

答:x0,y0,都是double型

 

 

 

 

 

>> syms x y z;
>> f(x,y,z)=sin(x^2*y)*exp(-x^2*y-z^2);
>> df=diff(f,x,x,y,z);
>> F=simplify(df)
 
F(x, y, z) =
 
-4*z*exp(- y*x^2 - z^2)*(cos(x^2*y) - sin(x^2*y) + 4*x^4*y^2*cos(x^2*y) + 4*x^4*y^2*sin(x^2*y) - 10*x^2*y*cos(x^2*y))

3.2.3   jacobi矩阵

>> syms r theta phi;
x=r*sin(theta)*cos(phi);
y=r*sin(theta)*sin(phi);
z=r*cos(theta);
J=jacobian([x;y;z],[r theta phi])
 
J =
 
[ cos(phi)*sin(theta), r*cos(phi)*cos(theta), -r*sin(phi)*sin(theta)]
[ sin(phi)*sin(theta), r*cos(theta)*sin(phi),  r*cos(phi)*sin(theta)]
[          cos(theta),         -r*sin(theta),                      0]

3.2.4参数方程的导数

function result = paradiff(y,x,t,n)
%递归调用,求参数方程的导数
    if n<=0,%这里书上写错了
        error('n should positive integer,please correct')
    else,   
        if n==1,
            result=diff(y,t)/diff(x,t);
        else,
            result=diff(paradiff(y,x,t,n-1),t)/diff(x,t);
        end
end
------------------------------------------------------------
>> syms t;
y=sin(t)/(t+1)^3;
x=cos(t)/(t+1)^3;
f=simplify(paradiff(y,x,t,3))

f =
 
(3*(t + 1)^7*(23*cos(t) + 24*sin(t) - 6*t^2*cos(t) - 4*t^3*cos(t) - t^4*cos(t) + 12*t^2*sin(t) + 4*t^3*sin(t) - 4*t*cos(t) + 32*t*sin(t)))/(3*cos(t) + sin(t) + t*sin(t))^5
 

3.2.5隐函数的偏导数

function dy = impldiff(f,x,y,n)
%递归调用,求隐函数方程的导数
    if n<=0,
        error('n should positive integer,please correct')
    else,   
       F1=-simplify(diff(f,x)/diff(f,y));
       dy=F1;
       for i=2:n,dy=simplify(diff(dy,x)+diff(dy,y)*F1);
       end
end
-------------------------------------------------------------------
>> syms x y;f=(x^2-2*x)*exp(-x^2-y^2-x*y);
F1=impldiff(f,x,y,1),F2=impldiff(f,x,y,2),F3=impldiff(f,x,y,3),F4=impldiff(f,x,y,4)
 
F1 =
 
(2*x + 2*x*y - x^2*y + 4*x^2 - 2*x^3 - 2)/(x*(x + 2*y)*(x - 2))
 
 
F2 =
 
-(2*(3*x^6 + 3*x^5*y - 12*x^5 + 3*x^4*y^2 - 12*x^4*y + 7*x^4 - 12*x^3*y^2 + 16*x^3*y + 16*x^3 + 16*x^2*y^2 - 8*x^2*y - 6*x^2 - 8*x*y^2 + 8*x*y - 8*x + 8*y^2 + 4))/(x^2*(x + 2*y)^3*(x - 2)^2)
 
 
F3 =
 
(2*(- 27*x^9 - 27*x^8*y + 162*x^8 - 27*x^7*y^2 + 162*x^7*y - 241*x^7 + 162*x^6*y^2 - 308*x^6*y - 204*x^6 - 276*x^5*y^2 + 132*x^5*y + 582*x^5 + 64*x^4*y^3 + 36*x^4*y^2 + 216*x^4*y + 64*x^4 + 32*x^3*y^4 - 192*x^3*y^3 + 408*x^3*y^2 - 208*x^3*y - 444*x^3 - 96*x^2*y^4 + 384*x^2*y^3 - 336*x^2*y^2 + 192*x^2*y + 48*x^2 + 192*x*y^4 - 256*x*y^3 + 192*x*y^2 - 96*x*y + 144*x - 128*y^4 - 96*y^2 - 48))/(x^3*(x + 2*y)^5*(x - 2)^3)
 
 
F4 =
 
-(4*(216*x^12 + 270*x^11*y - 1728*x^11 + 324*x^10*y^2 - 2160*x^10*y + 4293*x^10 + 108*x^9*y^3 - 2592*x^9*y^2 + 6168*x^9*y - 600*x^9 + 54*x^8*y^4 - 864*x^8*y^3 + 7560*x^8*y^2 - 6144*x^8*y - 11354*x^8 - 432*x^7*y^4 + 2976*x^7*y^3 - 8352*x^7*y^2 - 2776*x^7*y + 8768*x^7 + 1968*x^6*y^4 - 5184*x^6*y^3 - 120*x^6*y^2 + 8608*x^6*y + 12072*x^6 + 576*x^5*y^5 - 4512*x^5*y^4 + 7616*x^5*y^3 + 5664*x^5*y^2 - 3408*x^5*y - 12160*x^5 + 192*x^4*y^6 - 2304*x^4*y^5 + 9568*x^4*y^4 - 8960*x^4*y^3 + 432*x^4*y^2 - 512*x^4*y - 5336*x^4 - 768*x^3*y^6 + 6912*x^3*y^5 - 12160*x^3*y^4 + 9216*x^3*y^3 - 3840*x^3*y^2 + 3008*x^3*y + 7296*x^3 + 2304*x^2*y^6 - 9216*x^2*y^5 + 8448*x^2*y^4 - 6656*x^2*y^3 + 4416*x^2*y^2 - 3456*x^2*y + 288*x^2 - 3072*x*y^6 + 4608*x*y^5 - 3328*x*y^4 + 2816*x*y^3 - 3456*x*y^2 + 1152*x*y - 1920*x + 1536*y^6 + 1408*y^4 + 1152*y^2 + 480))/(x^4*(x + 2*y)^7*(x - 2)^4)
 

3.2.6场的梯度旋度散度

>> syms x y z;
v=[(x^2)*sin(y),(y^2)*sin(x*z),x*y*sin(cos(z))];
>> d=divergence(v,[x,y,z]),c=curl(v,[x,y,z])
 
d =
 
2*y*sin(x*z) + 2*x*sin(y) - x*y*cos(cos(z))*sin(z)
 
 
c =
 
 - x*cos(x*z)*y^2 + x*sin(cos(z))
                   -y*sin(cos(z))
      y^2*z*cos(x*z) - x^2*cos(y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值