指数函数-绘制最小值 [英] Exponential function - plotting the minimum

查看:139
本文介绍了指数函数-绘制最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c = 299792458
kB = 1.380649*10**(-23)
T = 10000
m_h = 1.67*10**(-27)
nun_h = 456805720119461.2
nuth_h = (2*kB*T/m_h)**(0.5)
m_he = 6.64424*10**(-27)
nun_he = 448925513626834.4
nuth_he = (2*kB*T/m_he)**(0.5)
konst = 22*10*6*(pi)**(0.5)*nuth_h*1000
o(x)=(x-nun_h)**2
p(x)=exp(-((x-nun_h)**2)/(nuth_h**2))
f(x) = konst/((pi)**(0.5)*(nuth_h))*exp(-((x-nun_h)**2)/(nuth_h**2))+22337314
g(x) = konst/((pi)**(0.5)*(nuth_he))*exp(-((x-nun_he)**2)/(nuth_he**2))+35663360

我想绘制一个指数函数f(x),该函数的最小值为456805720119461.1875,类似于此数据:

I would like to plot a exponential funkctions f(x) that have a minimum at 456805720119461.1875 similar to this data:

456944973174003.1250 22337314
456943580223203.8125 22299614
456942187280896.9375 22261916
456940794347082.5625 22224216
456939401421760.4375 22186516
456938008504930.7500 22148818
456936615596593.1250 22111118
456935222696747.7500 22073420
456933829805394.3125 22035720
456932436922532.9375 21998022
456931044048163.3750 21959734
456929651182285.6250 21921446
456928258324899.6875 21883746
456926865476005.3750 21839568
456925472635602.6250 21795782
456924079803691.4375 21758082
456922686980271.6875 21713904
456921294165343.1875 21670118
456919901358906.0625 21632418
456918508560960.0625 21588240
456917115771505.2500 21544454
456915722990541.3750 21506754
456914330218068.5625 21462576
456912937454086.5625 21413882
456911544698595.4375 21363616
456910151951594.9375 21319438
456908759213085.1875 21275652
456907366483065.9375 21225386
456905973761537.2500 21175120
456904581048498.9375 21124854
456903188343951.0000 21074590
456901795647893.2500 21024324
456900402960325.7500 20967972
456899010281248.3125 20911226
456897617610661.0000 20854874
456896224948563.5625 20797344
456894832294955.9375 20739814
456893439649838.2500 20683462
456892047013210.2500 20626716
456890654385071.9375 20563884
456889261765423.0625 20494572
456887869154263.7500 20425654
456886476551593.8125 20356342
456885083957413.2500 20287424
456883691371721.8750 20218112
456882298794519.7500 20142714
456880906225806.6250 20067316
456879513665582.6250 19985438
456878121113847.5000 19900222
456876728570601.2500 19812258
456875336035843.8125 19724294
456873943509575.0625 19636330
456872550991794.9375 19542278
456871158482503.4375 19441746
456869765981700.3125 19341216
456868373489385.6875 19234598
456866981005559.3125 19121500
456865588530221.2500 19002316
456864196063371.2500 18876652
456862803605009.4375 18750988
456861411155135.5625 18623362
456860018713749.7500 18482776
456858626280851.6250 18338458
456857233856441.4375 18187270
456855841440518.8750 18030386
456854449033083.8750 17866630
456853056634136.5625 17690702
456851664243676.5625 17508292
456850271861704.0625 17313318
456848879488218.8125 17112256
456847487123220.8750 16898234
456846094766710.0000 16672040
456844702418686.3125 16445845
456843310079149.5625 16214546
456841917748099.7500 15957131
456840525425536.7500 15693237
456839133111460.5625 15429344
456837740805871.0625 15153276
456836348508768.1875 14858163
456834956220151.8125 14568744
456833563940021.9375 14280110
456832171668378.3750 13978517
456830779405221.2500 13689098
456829387150550.1875 13406551
456827994904365.4375 13123611
456826602666666.6250 12855397
456825210437453.8750 12602735
456823818216727.0625 12367449
456822426004486.0625 12148991
456821033800730.8125 11947634
456819641605461.2500 11763753
456818249418677.3125 11596286
456816857240378.8750 11447669
456815465070565.9375 11316606
456814072909238.2500 11201879
456812680756396.0000 11104136
456811288612038.8750 11023338
456809896476167.0000 10958877
456808504348780.0625 10911400
456807112229878.1875 10877235
456805720119461.1875 10858758
456804328017529.0625 10856009
456802935924081.6250 10868949
456801543839118.9375 10897616
456800151762640.7500 10941362
456798759694647.1875 11001406
456797367635138.0000 11077825
456795975584113.1875 11169933
456794583541572.6875 11278986
456793191507516.3750 11405022
456791799481944.1875 11550380
456790407464856.1250 11714528
456789015456252.0000 11893854
456787623456131.7500 12091460
456786231464495.3750 12305285
456784839481342.6250 12536860
456783447506673.6875 12783926
456782055540488.1875 13041733
456780663582786.3750 13318586
456779271633567.8750 13601133
456777879692832.7500 13884073
456776487760580.8750 14179579
456775095836812.3125 14474692
456773703921526.7500 14754687
456772312014724.3750 15043713
456770920116404.8125 15326653
456769528226568.2500 15597026
456768136345214.4375 15860920
456766744472343.4375 16124814
456765352607955.0000 16376534
456763960752049.2500 16609208
456762568904625.8750 16835402
456761177065685.0625 17049424
456759785235226.5000 17250486
456758393413250.2500 17445460
456757001599756.2500 17636902
456755609794744.2500 17815384
456754217998214.3750 17978746
456752826210166.4375 18135630
456751434430600.3750 18286426
456750042659516.1250 18437222
456748650896913.6250 18575060
456747259142792.6875 18707204
456745867397153.4375 18838954
456744475659995.5625 18958138
456743083931319.2500 19071236
456741692211124.1250 19184332
456740300499410.3750 19290950
456738908796177.7500 19394426
456737517101426.3125 19501436
456736125415155.8125 19595882
456734733737366.3750 19683846
456733342068057.6875 19771810
456731950407229.8750 19859774
456730558754882.7500 19947740
456729167111016.3125 20029618
456727775475630.3750 20105016
456726383848725.0000 20180414
456724992230299.9375 20249726
456723600620355.3125 20318644
456722209018890.9375 20388936
456720817425906.6875 20459230
456719425841402.5625 20528148
456718034265378.4375 20590980
456716642697834.3125 20653812
456715251138769.9375 20710164
456713859588185.5000 20766910
456712468046080.6250 20823262
456711076512455.5000 20880008
456709684987309.8750 20936360
456708293470643.8125 20986624
456706901962457.0625 21036890
456705510462749.6875 21087156
456704118971521.5000 21135850
456702727488772.5625 21186116
456701336014502.6250 21236382
456699944548711.8125 21286648
456698553091399.8750 21330826
456697161642566.8125 21374612
456695770202212.5000 21424878
456694378770336.9375 21469056
456692987346939.9375 21512842
456691595932021.6250 21557020
456690204525581.6250 21594720
456688813127620.1250 21638506
456687421738136.9375 21683274
456686030357131.9375 21721562
456684638984605.1875 21765740
456683247620556.4375 21809526
456681856264985.7500 21847224
456680464917892.9375 21884924
456679073579278.0000 21922624
456677682249140.8125 21960322
456676290927481.3750 21998022
456674899614299.5000 22035720
456673508309595.2500 22073420
456672117013368.3750 22111118
456670725725619.0000 22148818
456669334446346.8125 22185338
456667943175551.9375 22223038
456666551913234.1875 22260738

我得到一个错误:

Warning: empty y range [2.23373e+07:2.23373e+07], adjusting to [2.21139e+07:2.25607e+07]

但至少:

gnuplot> print(p(456805720119461.1875))
1.0

指数函数为1,乘以1的其余部分为132000000.0.

the exponencial function is 1 and the rest that is multiplied by 1 is 132000000.0.

因此,为什么函数f等于

Thus, why does the function f equals

gnuplot> print(f(456944973174003.1250))
22337314.0

那是一个数字,被添加到整个表达式中.

that is a number that is added to the whole expression.

推荐答案

首先,您没有显示实际的plot命令. 我认为这很简单

First of all, you don't show your actual plot command. I assume it is simply

plot f(x)

对于功能f(x),您必须给xrange绘制数据的位置. 默认情况下,这是[-10:10].就您而言,这绝对不会带来有用的价值. 由于您的极值点在456805720119461.2附近,因此您应该在该值附近给出一个合适的范围.由于您具有指数函数和非常大的参数,因此该范围可能非常狭窄(或者在这里很窄).

For a function f(x) you have to give a xrange where to plot the data. By default this is [-10:10]. In your case, this will definitely not lead to useful values. Since your extremal point is around 456805720119461.2, you should give a suitable range around this value. Since you have an exponential function and very large parameters this range can be (or here it is) pretty narrow.

长话短说,如果您添加以下行:

Long story short, if you add the lines:

x0 = 456805720119461.2    # or actually  x0 = nun_h
set xrange[x0*(1-1e-10):x0*(1+1e-10)]

您应该得到函数f(x)的图.

代码:

### exponential function range
reset session

c = 299792458
kB = 1.380649*10**(-23)
T = 10000
m_h = 1.67*10**(-27)
nun_h = 456805720119461.2
nuth_h = (2*kB*T/m_h)**(0.5)
m_he = 6.64424*10**(-27)
nun_he = 448925513626834.4
nuth_he = (2*kB*T/m_he)**(0.5)
konst = 22*10*6*(pi)**(0.5)*nuth_h*1000
o(x)=(x-nun_h)**2
p(x)=exp(-((x-nun_h)**2)/(nuth_h**2))
f(x) = konst/((pi)**(0.5)*(nuth_h))*exp(-((x-nun_h)**2)/(nuth_h**2))+22337314
g(x) = konst/((pi)**(0.5)*(nuth_he))*exp(-((x-nun_he)**2)/(nuth_he**2))+35663360

x0 = 456805720119461.2
set xrange[x0*(1-1e-10):x0*(1+1e-10)]
set xtics rotate by -90
set format x "%.0f"
plot f(x)
### end of code

结果:

这篇关于指数函数-绘制最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆