这个打数学符号的软件是什么软件

您的举报已经提交成功,我们将尽快处理,谢谢!
用开发者账号,上传
大家还关注
(window.slotbydup=window.slotbydup || []).push({
id: '2081942',
container: s,
size: '1000,60',
display: 'inlay-fix'^ 这是什么符号,怎么打出来
^ 这是什么符号,怎么打出来
09-12-28 &
这个符号用英文读Hat。在数学中表几次方。如:3^2,表示3的平方。打出来很简单,在英文输入法下,按“Shift”和“6“。
请登录后再发表评论!查看: 1566|回复: 9|关注: 0
那是每个matlab程序都要有function么 “#”这个符号是什么意...
还有就是&&&
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
这句话是什么意思呢
程序运行时总是出现
Error: Missing variable or function
哪里出错了呢
附上源代码:
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
import numpy as np
import matplotlib
matplotlib.rcParams['lines.linewidth'] = 2.0
matplotlib.rcParams['lines.markersize'] = 6
matplotlib.rcParams['lines.markersize'] = 8
matplotlib.rcParams['font.size'] = 16
matplotlib.rcParams['axes.labelsize'] = 15
matplotlib.rcParams['legend.fontsize'] = 12
matplotlib.rcParams['xtick.labelsize'] = 12
matplotlib.rcParams['ytick.labelsize'] = 12
matplotlib.rcParams['savefig.dpi'] = 300
import matplotlib.pyplot as mpl
from clawpack.pyclaw.solution import Solution
from clawpack.visclaw import geoplot, colormaps
from multilayer.aux import bathy_index,kappa_index,wind_index
import multilayer.plot as plot
def setplot(plotdata,eta=[0.0,-300.0],rho=[5.0],g=9.81,dry_tolerance=1e-3,bathy_ref_lines=[-30e3]):
& & Specify what is to be plotted at each frame.
& & Input:&&plotdata, an instance of pyclaw.plotters.data.ClawPlotData.
& & Output: a modified version of plotdata.
& & b = Solution(0,path=plotdata.outdir,read_aux=True).state.aux[bathy_index,:]
& & def bathy(cd):
& && &&&return b
& & def kappa(cd):
& && &&&return Solution(cd.frameno,path=plotdata.outdir,read_aux=True).state.aux[kappa_index,:]
& & def wind(cd):
& && &&&return Solution(cd.frameno,path=plotdata.outdir,read_aux=True).state.aux[wind_index,:]
& & def h_1(cd):
& && &&&return cd.q[0,:] / rho[0]
& & def h_2(cd):
& && &&&return cd.q[2,:] / rho[1]
& & def eta_2(cd):
& && &&&return h_2(cd) + bathy(cd)
& & def eta_1(cd):
& && &&&return h_1(cd) + eta_2(cd)
& & def u_1(cd):
& && &&&index = np.nonzero(h_1(cd) & dry_tolerance)
& && &&&u_1 = np.zeros(h_1(cd).shape)
& && &&&u_1[index] = cd.q[1,index] / cd.q[0,index]
& && &&&return u_1
& & def u_2(cd):
& && &&&index = np.nonzero(h_2(cd) & dry_tolerance)
& && &&&u_2 = np.zeros(h_2(cd).shape)
& && &&&u_2[index] = cd.q[3,index] / cd.q[2,index]
& && &&&return u_2
& & def hu_1(cd):
& && &&&index = np.nonzero(h_1(cd) & dry_tolerance)
& && &&&hu_1 = np.zeros(h_1(cd).shape)
& && &&&hu_1[index] = cd.q[1,index] / rho[0]
& && &&&return hu_1
& & def hu_2(cd):
& && &&&index = np.nonzero(h_2(cd) & dry_tolerance)
& && &&&hu_2 = np.zeros(h_2(cd).shape)
& && &&&hu_2[index] = cd.q[3,index] / rho[1]
& && &&&return hu_2
& & def add_bathy_dashes(current_data):
& && &&&mpl.hold(True)
& && &&&for ref_line in bathy_ref_lines:
& && && && &mpl.plot([ref_line,ref_line],[-10,10],'k--')
& && &&&mpl.hold(False)
& & def add_horizontal_dashes(current_data):
& && &&&mpl.hold(True)
& && &&&mpl.plot([-400e3,0.0],[0.0,0.0],'k--')
& && &&&mpl.hold(False)
& & def km_labels(current_data):
& && &&&r&&&Flips xaxis and labels with km&&&
& && &&&mpl.xlabel('km')
& && &&&locs,labels = mpl.xticks()
& && &&&labels = np.flipud(locs)/1.e3
& && &&&mpl.xticks(locs,labels)
& & def time_labels(current_data):
& && &&&r&&&Convert time to hours&&&
& && &&&pass
& & xlimits = [-400e3,0.0]
& & ylimits_depth = [-.0]
& & xlimits_zoomed = [-30e3-1e3,-30e3+1e3]
& & ylimits_surface_zoomed = [eta[0] - 0.5,eta[0] + 0.5]
& & ylimits_internal_zoomed = [eta[1] - 2.5,eta[1] + 2.5]
& & ylimits_momentum = [-40,10]
& & ylimits_velocities = [-0.04,0.04]
& & ylimits_kappa = [0.0,1.2]
& & plotdata.clearfigures()
& & def fill_items(plotaxes):
& && &&&plotitem = plotaxes.new_plotitem(plot_type='1d_fill_between')
& && &&&plotitem.plot_var = eta_1
& && &&&plotitem.plot_var2 = eta_2
& && &&&plotitem.color = plot.top_color
& && &&&plotitem.plotstyle = plot.surface_linestyle
& && &&&plotitem.show = True
& && &&&plotitem = plotaxes.new_plotitem(plot_type='1d_fill_between')
& && &&&plotitem.plot_var = eta_2
& && &&&plotitem.plot_var2 = bathy
& && &&&plotitem.color = plot.bottom_color
& && &&&plotitem.plotstyle = plot.internal_linestyle
& && &&&plotitem.show = True
& && &&&plotitem = plotaxes.new_plotitem(plot_type='1d_plot')
& && &&&plotitem.plot_var = bathy
& && &&&plotitem.plotstyle = plot.bathy_linestyle
& && &&&plotitem.show = True
& && &&&plotitem = plotaxes.new_plotitem(plot_type='1d_plot')
& && &&&plotitem.plot_var = eta_2
& && &&&plotitem.color = 'k'
& && &&&plotitem.plotstyle = plot.internal_linestyle
& && &&&plotitem.show = True
& && &&&plotitem = plotaxes.new_plotitem(plot_type='1d_plot')
& && &&&plotitem.plot_var = eta_1
& && &&&plotitem.color = 'k'
& && &&&plotitem.plotstyle = plot.surface_linestyle
& && &&&plotitem.show = True
& & plotfigure = plotdata.new_plotfigure(name='Full Depths',figno=102)
& & plotfigure.show = True
& & def bathy_axes(cd):
& && &&&km_labels(cd)
& && &&&mpl.xticks([-300e3,-200e3,-100e3,-30e3],[300,200,100,30],fontsize=15)
& && &&&mpl.xlabel('km')
& & plotaxes = plotfigure.new_plotaxes()
& & plotaxes.title = 'Full Depths'
& & plotaxes.xlimits = xlimits
& & plotaxes.ylimits = [-]
& & plotaxes.afteraxes = bathy_axes
& & fill_items(plotaxes)
& & plotfigure = plotdata.new_plotfigure(name=&momentum&)
& & plotfigure.show = True
& & def momentum_axes(cd):
& && &&&km_labels(cd)
& && &&&mpl.xticks([-300e3,-200e3,-100e3,-30e3],[300,200,100,30],fontsize=15)
& && &&&mpl.xlabel('km')
& && &&&mpl.title(&Layer Momenta at t = %4.1f s& % cd.t)
& && &&&mpl.legend(['Top Layer Momentum','Bottom Layer Momentum'],loc=4)
& & def inset_momentum_axes(cd):
& && &&&r&&&This does not refresh correctly...&&&
& && &&&fig = mpl.figure(cd.plotfigure.figno)
& && &&&axes = fig.add_subplot(111)
& && &&&axes.plot(cd.x, hu_1(cd), 'b-')
& && &&&axes.plot(cd.x, hu_2(cd), 'k--')
& && &&&axes.set_xlim(xlimits)
& && &&&axes.set_ylim(ylimits_momentum)
& && &&&momentum_axes(cd)
& && &&&from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
& && &&&from mpl_toolkits.axes_grid1.inset_locator import mark_inset
& && &&&inset_axes = zoomed_inset_axes(axes, 0.5, loc=3)
& && &&&inset_axes.plot(cd.x, hu_1(cd), 'b-')
& && &&&inset_axes.plot(cd.x, hu_2(cd), 'k--')
& && &&&inset_axes.set_xticklabels([])
& && &&&inset_axes.set_yticklabels([])
& && &&&x_zoom = [-120e3,-30e3]
& && &&&y_zoom = [-10,10]
& && &&&inset_axes.set_xlim(x_zoom)
& && &&&inset_axes.set_ylim(y_zoom)
& && &&&mark_inset(axes, inset_axes, loc1=2, loc2=4, fc='none', ec=&0.5&)
& && &&&mpl.draw()
& & plotaxes = plotfigure.new_plotaxes()
& & plotaxes.title = &Momentum&
& & plotaxes.xlimits = xlimits
& & plotaxes.ylimits = ylimits_momentum
& & plotaxes.afteraxes = inset_momentum_axes
& & plotitem = plotaxes.new_plotitem(plot_type='1d')
& & plotitem.plot_var = hu_1
& & plotitem.plotstyle = 'b-'
& & plotitem.show = True
& & plotitem = plotaxes.new_plotitem(plot_type='1d')
& & plotitem.plot_var = hu_2
& & plotitem.plotstyle = 'k--'
& & plotitem.show = True
& & include_kappa = False
& & if include_kappa:
& && &&&plotfigure = plotdata.new_plotfigure(name='Velocity and Kappa',figno=14)
& && &&&plotfigure = plotdata.new_plotfigure(name='Velocities',figno=14)
& & plotfigure.show = True
& & def twin_axes(cd):
& && &&&fig = mpl.gcf()
& && &&&fig.clf()
& && &&&x = cd.patch.dimensions[0].centers
& && &&&vel_axes = fig.add_subplot(111)& &&&
& && &&&bottom_layer = vel_axes.plot(x,u_2(cd),'k-',label=&Bottom Layer Velocity&)
& && &&&top_layer = vel_axes.plot(x,u_1(cd),'b--',label=&Top Layer velocity&)
& && &&&if include_kappa:
& && && && &# Kappa
& && && && &kappa_line = kappa_axes.plot(x,kappa(cd),'r-.',label=&Kappa&)
& && && && &kappa_axes.plot(x,np.ones(x.shape),'r:')
& && &&&vel_axes.set_xlabel('km')
& && &&&mpl.xticks([-300e3,-200e3,-100e3,-30e3],[300,200,100,30],fontsize=15)
& && &&&for ref_line in bathy_ref_lines:
& && && && &vel_axes.plot([ref_line,ref_line],ylimits_velocities,'k:')
& && &&&if include_kappa:
& && && && &vel_axes.set_title(&Layer Velocities and Kappa at t = %4.1f s& % cd.t)
& && &&&else:
& && && && &vel_axes.set_title(&Layer Velocities at t = %4.1f s& % cd.t)
& && &&&vel_axes.set_ylabel('Velocities (m/s)')
& && &&&vel_axes.set_xlim(xlimits)
& && &&&vel_axes.set_ylim(ylimits_velocities)
& && &&&if include_kappa:
& && && && &plot.add_legend(vel_axes,'Kappa',location=3,color='r',linestyle='-.')
& && && && &kappa_axes.set_ylabel('Kappa')
& && && && &kappa_axes.set_ylim(ylimits_kappa)
& && &&&else:
& && && && &vel_axes.legend(loc=3)
& && &&&try:
& && && && &mpl.subplots_adjust(hspace=0.1)
& && &&&except:
& && && && &pass
& & plotaxes = plotfigure.new_plotaxes()
& & plotaxes.afteraxes = twin_axes
& & plotfigure = plotdata.new_plotfigure(name='Zoomed Depths',figno=13)
& & plotfigure.show = True
& & plotfigure.kwargs = {'figsize':(6,6)}
& & plotaxes = plotfigure.new_plotaxes()
& & plotaxes.axescmd = 'subplot(2,1,1)'
& & plotaxes.title = 'Surfaces'
& & plotaxes.xlimits = xlimits
& & plotaxes.ylimits = ylimits_surface_zoomed
& & def top_afteraxes(cd):
& && &&&mpl.xlabel('')
& && &&&locs,labels = mpl.xticks()
& && &&&# labels = np.flipud(locs)/1.e3
& && &&&labels = ['' for i in xrange(len(locs))]
& && &&&mpl.xticks(locs,labels)
& && &&&add_bathy_dashes(cd)
& && &&&mpl.ylabel('m')
& && &&&mpl.title(&Surfaces t = %4.1f s& % cd.t)
& & plotaxes.afteraxes = top_afteraxes
& & plotaxes = fill_items(plotaxes)
& & plotaxes = plotfigure.new_plotaxes()
& & plotaxes.axescmd = 'subplot(2,1,2)'
& & plotaxes.title = ''
& & plotaxes.xlimits = xlimits
& & plotaxes.ylimits = ylimits_internal_zoomed
& & def internal_surf_afteraxes(cd):
& && &&&km_labels(cd)
& && &&&mpl.title('')
& && &&&mpl.ylabel('m')
& && &&&mpl.subplots_adjust(hspace=0.05)
& && &&&mpl.xticks([-300e3,-200e3,-100e3,-30e3],[300,200,100,30],fontsize=15)
& && &&&mpl.xlabel('km')
& & plotaxes.afteraxes = internal_surf_afteraxes
& & plotaxes = fill_items(plotaxes)
& & plotdata.printfigs = True& && && && &&&
& & plotdata.print_format = 'png'& && && &&&
& & plotdata.print_framenos = [0,30,100,200,300]
& & plotdata.print_fignos = 'all'& && && &
& & plotdata.html = True& && && && && && && &
& & plotdata.html_homelink = '../README.html'& &
& & plotdata.latex = True& && && && && && &
& & plotdata.latex_figsperline = 2& && && &
& & plotdata.latex_framesperline = 1& && && &
& & plotdata.latex_makepdf = False& && && &
& & return plotdata
关注者: 3
我怎么觉得你这是 python 的代码呢?
# 号是用来注释的,在 python 中
天天向尚磊 发表于
我怎么觉得你这是 python 的代码呢?
# 号是用来注释的,在 python 中
那是不能用matlab来编的意思么
关注者: 3
那是不能用matlab来编的意思么
你看开头就知道,import matplotlib 表示引入一个作图的包,def 这些就是定义的语句。这不是 MATLAB 的语言。你可以用 python 来执行。
你看开头就知道,import matplotlib 表示引入一个作图的包,def 这些就是定义的语句。这不是 MATLAB 的语 ...
我说呢怎么怎么运行都不行
我说呢怎么怎么运行都不行
请问我要是想用matlab来编写这个程序要怎么改呢
关注者: 3
请问我要是想用matlab来编写这个程序要怎么改呢
简单的说,我不知道怎么改,python 用得比较少。
简单的说,我不知道怎么改,python 用得比较少。
这个代码哪里错了?
function [F,amax] = HLL_SOLVER(hl,hr,ul,ur,vl,vr,nx,ny)
global grav
% calculate normal velocity across a cell's edge
wl = ul*nx+vl*
wr = ur*nx+vr*
% calculate celercities of left and right waves
cl = (grav*hl)^0.5;
cr = (grav*hr)^0.5;
% calculate velocity and celercity of middle wave
wm = 0.5*(wl+wr)+cl-
cm = 0.25*(wl-wr)+0.5*(cl+cr);
% calculate wave speed considering dry bed condition
if hl&0 && hr&0
& & & & sl = min(wl-cl,wm-cm);
& & & & sr = max(wr+cr,wm+cm);
elseif hl&=0 && hr&0
& & & & sl = wr-2*
& & & & sr = wr+
elseif hr&=0 && hl&0
& & & & sl = wl-
& & & & sr = wl+2*
& & & & sl = 0;
& & & & sr = 0;
% evaluate normal fluxes across the cell's edge
if abs(sr-sl) &= 1.0e-10
& & if sl&=0
& && &&&F1 = hl*
& && &&&F2 = hl*wl*ul+0.5*grav*hl*hl*
& && &&&F3 = hl*wl*vl+0.5*grav*hl*hl*
& & elseif sr&0
& && &&&FL1 = hl*
& && &&&FL2 = hl*wl*ul+0.5*grav*hl*hl*
& && &&&FL3 = hl*wl*vl+0.5*grav*hl*hl*
& && &&&FR1 = hr*
& && &&&FR2 = hr*wr*ur+0.5*grav*hr*hr*
& && &&&FR3 = hr*wr*vr+0.5*grav*hr*hr*
& && &&&F1 = (sr*FL1-sl*FR1+sl*sr*(hr-hl))/(sr-sl);
& && &&&F2 = (sr*FL2-sl*FR2+sl*sr*(hr*ur-hl*ul))/(sr-sl);
& && &&&F3 = (sr*FL3-sl*FR3+sl*sr*(hr*vr-hl*vl))/(sr-sl);
& && &&&F1 = hr*
& && &&&F2 = hr*wr*ur+0.5*grav*hr*hr*
& && &&&F3 = hr*wr*vr+0.5*grav*hr*hr*
& & F1 = 0;
& & F2 = 0;
& & F3 = 0;
F = [F1; F2; F3];
amax = max([abs(sl) abs(sr)]);
关注者: 3
这个代码哪里错了?
function [F,amax] = HLL_SOLVER(hl,hr,ul,ur,vl,vr,nx,ny)
你给个输入参数吧,不然,也不好检测其有效性。
你给个输入参数吧,不然,也不好检测其有效性。
老师说那个和我的方程无关的。。也不告诉我哪里无关。。
现在是在研究这个了
%% Shallow Water Chapter Recap
% This is an executable program that illustrates the statements
% introduced in the Shallow Water Chapter of &Experiments in MATLAB&.
% You can access it with
% water_recap
% edit water_recap
% publish water_recap
% Related EXM programs
% waterwave
%% Finite Differences
% A simple example of the grid operations in waterwave.
%% Create a two dimensional grid.
[x,y] = ndgrid(-1: 2/(m-1): 1);
%% The water drop function from waterwave.
U = exp(-5*(x.^2+y.^2));
%% Surf plot of the function
h = surf(x,y,U);
%% Colormap
c = (37:100)';
cyan = [0*c c c]/100;
colormap(cyan)
%% Indices in the four compass directions.
n = [2:m m];
s = [1 1:m-1];
%% A relation parameter. Try other values.
% Experiment with omega slightly greater than one.
omega = 1;
% Repeatedly replace grid values by relaxed average of four neighbors.
tfinal = 500;
for t = 1:tfinal
U = (1-omega)*U + omega*(U(n,:)+U(:,e)+U(s,:)+U(:,w))/4;
set(h,'zdata',U);
。。让我知道方程的原型。。参数是什么。。那些是未知的 快被搞疯了
matlab这东西我就只会最简单的指令操作。。
站长推荐 /1
Powered by您的举报已经提交成功,我们将尽快处理,谢谢!
用搜狗啊 ,可以打出来的 啊
大家还关注
(window.slotbydup=window.slotbydup || []).push({
id: '2081942',
container: s,
size: '1000,60',
display: 'inlay-fix'}

我要回帖

更多关于 符号计算软件 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信