mathematica

Mathematica 讲座

…衆ロ難τιáo~ 提交于 2019-12-28 05:28:01
Mathematica 讲座笔记本 [ 下载 ] 第一章 Mathematica 简介 [ 观看 ] [ 下载 ] 第二章 Mathematica 界面和编程语言 [ 观看 ] [ 下载 ] 第三章 符号运算 [ 观看 ] [ 下载 ] 第四章 数值运算 [ 观看 ] [ 下载 ] 第五章 图形运算 [ 观看 ] [ 下载 ] 第六章 案例分析一 [ 观看 ] [ 下载 ] 第七章 案例分析二 [ 观看 ] [ 下载 ] 第八章 案例分析三 [ 观看 ] [ 下载 ] 第九章 与其它程序的交流 [ 观看 ] [ 下载 ] 第十章 Mathematica 讲座总结 [ 观看 ] [ 下载 ] 来源: https://www.cnblogs.com/liangliangdetianxia/p/4042135.html

设计函数f(f(n))== -n

*爱你&永不变心* 提交于 2019-12-17 21:14:59
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我上次面试时遇到的一个问题: 设计一个函数 f ,使得: f(f(n)) == -n 其中 n 是一个32位有 符号整数 ; 您不能使用复数算法。 如果您不能为整个数字范围设计这样的函数,请为最大范围设计它。 有任何想法吗? #1楼 x86 asm(AT&T风格): ; input %edi ; output %eax ; clobbered regs: %ecx, %edx f: testl %edi, %edi je .zero movl %edi, %eax movl $1, %ecx movl %edi, %edx andl $1, %eax addl %eax, %eax subl %eax, %ecx xorl %eax, %eax testl %edi, %edi setg %al shrl $31, %edx subl %edx, %eax imull %ecx, %eax subl %eax, %edi movl %edi, %eax imull %ecx, %eax .zero: xorl %eax, %eax ret 检查代码,传递所有可能的32位整数,错误-2147483647(下溢)。 #2楼 该Perl解决方案 适用于整数,浮点数和字符串 。 sub f { my $n =

Putting a VerticalSlider into Mathematica's Manipulate?

匿名 (未验证) 提交于 2019-12-03 08:28:06
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do you set up manipulate so that you can control a variable with a vertical slider instead of a horizontal slider in Mathematica? 回答1: From the help .... Manipulate[u, {u, 0, 1, ImageSize -> Small}, ControlType -> VerticalSlider, ControlPlacement -> Left] 文章来源: Putting a VerticalSlider into Mathematica's Manipulate?

Mathematica: set default value for argument to nonconstant?

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Can I set the default value for a function argument to be something that's not constant? Example: tod := Mod [ AbsoluteTime [], 86400 ] f [ x_ : tod ] := x In the above, 'tod' changes every time I evaluate it, but "f[]" does not. "?f" yields: f [ x_ : 42054.435657 `11.376386798562935] := x showing the default value was hardcoded when I created the function. Is there a workaround here? 回答1: It seems to work if the function holds its arguments: tod := Mod [ AbsoluteTime [], 86400 ] SetAttributes [ f , HoldAll ]; f [ x_ : tod ] := x

Mathematica: why 3D plot remember last viewpoint/rotation made to it, even after evaluating again?

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I find this a bit annoying. I make a 3D plot, initially it come up in the default orientation. Then, using the mouse, I rotate it some way. Now I run the command again, expecting to obtain the original shape (i.e the original orientation before I rotated it by mouse), but instead, it just gives me the same plot I have on the screen, i.e. it seems to have kept/remembered the last viewpoint in that output cell. I wanted it to go back to the original viewpoint. So, I delete the output cell to make it happen. Do you think this is how

Mathematica Downvalue Lhs

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Does anybody know if there is a built-in function in Mathematica for getting the lhs of downvalue rules (without any holding)? I know how to write the code to do it, but it seems basic enough for a built-in For example: a[1]=2; a[2]=3; BuiltInIDoNotKnowOf[a] returns {1,2} 回答1: This seems to work; not sure how useful it is, though: a[1] = 2 a[2] = 3 a[3] = 5 a[6] = 8 Part[DownValues[a], All, 1, 1, 1] 回答2: This is like keys() in Perl and Python and other languages that have built in support for hashes (aka dictionaries). As your example

How to debug when writting small or big codes using Mathematica? workbench? mma debugger? or something else?

匿名 (未验证) 提交于 2019-12-03 01:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: At mathkb.com, I found a interesting post "Another review of Mathematica's debugger" (by berniethejet) talking about debugging in wolfram workbench. http://www.mathkb.com/Uwe/Threads/List.aspx/mathematica/20986 I think this is a good question worth discussing and I would like hear some experiences of using workbench, even though I've never touched workbench. Is workbench a real debugger but a watcher? what's its advantage over mathematica? How do you debug when you writting big or small codes? mabye workbench is for debugging small codes and

plotting legends in Mathematica

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do you plot legends for functions without using the PlotLegends package? 回答1: I, too, was disappointed by the difficulty of getting PlotLegend to work correctly. I wrote my own brief function to make my own custom figure legends: makePlotLegend[names_, markers_, origin_, markerSize_, fontSize_, font_] := Join @@ Table[{ Text[ Style[names[[i]], FontSize -> fontSize, font], Offset[ {1.5*markerSize, -(i - 0.5) * Max[markerSize,fontSize] * 1.25}, Scaled[origin] ], {-1, 0} ], Inset[ Show[markers[[i]], ImageSize -> markerSize], Offset[ {0.5

In Mathematica, what does @@@ mean?

匿名 (未验证) 提交于 2019-12-03 00:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been working through problems on Project Euler , and some of the solutions that other people have posted use a triple-at-sign, i.e. '@@@'. In the help browser for v7, I find an entry for @@ (which says it's the infix version of 'Apply') but none for @@@. What does it mean? EDIT: Here's an example, which I think I can post without violating the spirit of Project Euler: bloc[n_, f_][t_] := {f @@@ #, #~Tr~f} & /@ Join @@ Partition[t, {n, n}, 1]; 回答1: As others have noted, @@@ is, technically, shorthand for Apply with an optional third

mathematica(二)

匿名 (未验证) 提交于 2019-12-02 23:30:02
mathematica学习笔记 代数运算 Expand[]函数 Factor[]用于因式分解 Together[]用于合并分式 Apart[] Collect[]合并指定符号项 Simplify[]和FullSimplify[] 方程求解 Solve[] Reduce[] FindRoot[] 代数运算 mathematica遇到没有预先定义的字符串会将其处理为变量,比如 软件自动将表达式进行了化简处理 Expand[]函数 Expand[]函数用于展开多项式: Factor[]用于因式分解 Factor[]与Expand[]恰好相反 Together[]用于合并分式 Apart[] Collect[]合并指定符号项 Simplify[]和FullSimplify[] 当Simplify[]不能满足要求时,可使用FullSimplify进行完全化简,FullSimplify将会尝试更多的变换形式,通常 首先使用Simplify,如果得到的结果不满意再考虑使用FullSimplify 方程求解 Solve[] Solve[] 需要两个参数,第一个参数是方程组,第二个参数是自变量: 1.当输入多个方程和多个变量是需要用{}构成列表 2.此时需要使用两个等于号 Reduce[] Solve非常擅长解方程,但有时候需要特定的指令来求解。 此时已经出现提示:可能没有给出所有解